# Gemini API code execution

Official pricing: https://ai.google.dev/gemini-api/docs/code-execution  
Category: agent-sandbox · Isolation: container

## Pricing regimes (raw)

- **Built-in code execution tool (token-billed only)** (sizes): code execution (size not published) ? vCPU/? GiB $0/h [alt]

## Features

Yes: idle auto-stop, code interpreter, Python, spend limits

No: snapshots, memory snapshots, fork/clone, pause/resume, persistent disk, volumes, ≥24 h sessions, custom image (Docker or snapshot), start from your own snapshot, your own Docker/OCI image, Docker inside, nested virtualization, systemd, browser, desktop GUI, computer-use API, browser + desktop control, anti-bot stealth, CAPTCHA solving, preinstalled agents, SSH, public IPv4, HTTPS preview URLs, custom domains, raw TCP inbound, egress allowlist, static egress IP, self-hosting, BYOC, open source, SOC 2, HIPAA, SSO, GPU, arm64, Windows, macOS, Node.js, GPU desktop, HTTP method/path egress rules, wake on request, live resize, live fork (no pause), memory fork, EU data residency, MCP server, automatic snapshots, snapshots on demand, agent harness API, hosted agent API (their own agent), inbound access rules, firewall inside (nftables), secret proxy, secret proxy for any API, extra volumes, shared volumes

Unknown: everything else. Evidence (source + quote) per feature: https://battleships.dev/data/providers/gemini-code-execution.json → feature_evidence

## Caveats

- No compute fee: the whole cost is Gemini model tokens (code + results billed as tokens), which this estimator does not model — the $0 compute line is not the bill.
- 30-second maximum runtime per execution; fixed Python library set, no pip installs.
- Hardware (CPU/RAM/disk) not published.
- Vertex AI / Agent Engine code execution is a different, metered product.
- On a code-execution error the model may regenerate code up to 5 times; the intermediate code and results are billed as tokens.
- Token prices on the paid tier are introductory for current Gemini 3.x models: e.g. $0.75/$3.75 per M through 2026-12-31, doubling to $1.50/$7.50 from 2027-01-01 (price_expires applies to the token side, not modelled).

## How this provider charges


Added by the missing-providers audit (code-interpreter preset).

| Regime | When it applies | How billed | Numbers | Source |
|---|---|---|---|---|
| Built-in tool | code_execution tool enabled | model tokens only | $0 tool fee; 30 s max runtime | https://ai.google.dev/gemini-api/docs/code-execution |

## Gotchas
- The bill is model tokens; code and execution output count as tokens.

## Worked example
Compute $0; tokens per model tariff (not estimated here).

Sources: https://ai.google.dev/gemini-api/docs/code-execution, https://ai.google.dev/gemini-api/docs/pricing
