Use Gemini code execution with Gemini 4 Carbon

by GoogleCode execution

Gemini 4 Carbon uses Gemini code execution through Opper on the generateContent endpoint, passed through as Google defines it.

UseGemini code executionwithin

Add Gemini code execution to Gemini 4 Carbon

Set up with agents

Paste this into your coding agent (Claude Code, Cursor, Codex, and more) and it will set up and build with Opper for you.

Get your API key

In your code

curl "https://api.opper.ai/v3/compat/v1beta/models/gemini/gemini-4-carbon:generateContent" \
-H "Authorization: Bearer $OPPER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"contents": [{"role": "user", "parts": [{"text": "Sum the first 50 primes and show your working."}]}],
"tools": [{"codeExecution": {}}]}'

Where you can run it

Gemini 4 Carbon runs Gemini code execution on the routes below. Some routes also sell flex and priority processing: the same model at another price, picked per request with service_tier. How service tiers work.

ProviderRegionZero data retentionTrainingInputOutputCache read
EUNo$4.40$22.00$0.22Not offered on this routeNot offered on this route
USNo$4.00$20.00$0.20
USNo$4.40$22.00$0.22Not offered on this routeNot offered on this route
MultiNo$4.00$20.00$0.20Not offered on this route

The model

Google Gemini 4 Carbon handles complex software engineering, scientific reasoning, and multi-step agent workflows.

Available on

Pricing from$4.00/ 1M input$20.00/ 1M output$0.20/ 1M cache read1Mcontext

Privacy

ZDR
Training
No
Region
EUUSMulti

Use Gemini code execution with other models

Step-by-step setup for Gemini code execution on each of these models through Opper.

More tools on Opper

Use Gemini code execution with Gemini 4 Carbon

One key, 700+ models, a choice of region, and zero data retention. Tools run in the same request, with every call in your traces.