GeminiManaged AgentsAntigravityAPI Pricing

Antigravity Agent now runs on Gemini 4 Hydrogen by default. Here is how to pin another model

Since November 12, the Gemini API's Antigravity Agent reasons with gemini-4-hydrogen by default. You can pin another model in agent_config and cap spend with max_total_tokens; pricing follows a whole agentic loop, not one prompt.

Antigravity Agent now runs on Gemini 4 Hydrogen by default. Here is how to pin another model

The Antigravity Agent in the Gemini API has used Gemini 4 Hydrogen (gemini-4-hydrogen) as its reasoning model by default since November 12. You can pin Carbon, Argon, or a Flash model in agent_config. It bills the tokens and tool calls of a whole autonomous loop — typically 100k to 3M tokens per interaction — and the preview does not charge for sandbox compute.

Those two facts decide what to check before you connect anything: the default model changes without notice, the budget is yours to set, and the cost belongs to a task rather than a prompt.

Is the API Antigravity Agent the same thing as the Antigravity IDE?

They share one agent harness. The docs say the API agent "uses the same harness as the Antigravity IDE" — the same tools, the same agent loop, the same context management. The difference is where it runs: the API version starts a Google-hosted Linux sandbox from a single call.

That means:

  • IDE habits carry over, such as how you write AGENTS.md or organise skills.
  • Troubleshooting does not. The IDE is a local client; the API agent is a server-side sandbox. Errors, quotas, and network egress live in different places.

If you see Chinese posts asking how to fix "agent execution terminated due to error", check which side it came from first. The Google developer forum thread Antigravity broken, getting only "Agent execution terminated due to error", open since January 15, 2026, sits in the Google Antigravity desktop IDE category, not the Gemini API. Users report every model failing, with logs pointing at 429 rate limits and failed login-token refreshes; restarts, re-login, and cleared local config did not settle it, and the thread has no official resolution.

For the API agent, the state and error fields you can act on are in the Interactions API response. Start there rather than copying IDE cleanup steps. Nbility keeps the two apart as well, in its Antigravity and Antigravity CLI notes.

What changes when the default model does

The agent name antigravity-preview-09-2026 did not change. What changed is the model it uses when agent_config omits model. Callers that never set a model will quietly start reasoning with Hydrogen.

For most tasks the difference is small, but three things deserve a look:

ItemGemini 4 HydrogenWhat to check
Thinking levelhigh by default; also low, medium, xhighThe agent's agent_config does not expose thinking_level; switching model is the lever
Context windowOne 1M window shared by input, thinking, and outputDifferent from 3.8 Flash's split "1M input + 64K output" budget
CachingNo explicit caching; implicit caching runs automaticallyDo not send cached_contents

Hydrogen lists at $1.50 per million input tokens and $7.50 per million output tokens. Moving to Carbon or Argon changes both the rate and the default thinking level; the Gemini 4 Hydrogen migration guide covers that as a migration. Here the question is narrower: what it means to be the agent's default.

How to pin the model

Setting model in agent_config overrides the default. The official example uses Carbon for heavier software engineering and reasoning work:

from google import genai

client = genai.Client(http_options={"api_version": "v1beta"})

interaction = client.interactions.create(
    agent="antigravity-preview-09-2026",
    input="Clean the missing values in /workspace/data.csv and write up what you did.",
    environment="remote",
    agent_config={
        "type": "antigravity",
        "model": "gemini-4-carbon",
        "max_total_tokens": 200000,
    },
)
print(interaction.status)
print(interaction.usage.total_tokens)

Current accepted values for agent_config.model:

ValuePositioning
gemini-4-hydrogenDefault; everyday coding and agent work, fast
gemini-4-carbonStrongest reasoning for complex engineering and long-horizon tasks
gemini-4-argonFrontier reasoning with a lower token spend per turn than Carbon
gemini-3.8-flashBalanced pick from the 3.8 generation
gemini-3.6-flashGeneral agentic workflows
gemini-3.5-flash-liteLow latency, cost-sensitive work

When you create a fixed agent with agents.create, the model locks at creation and cannot be overridden per interaction. That is what you want in production: a change to the official default will not swap your model underneath you. The cost is that upgrades mean creating a new agent, not editing a request.

Model pinning against a moving default

What you are actually billed for

An Antigravity interaction is not a question and an answer. The agent plans, calls tools, runs code, reads results, and repeats until the task is done. Google puts a single interaction at 100k to 3M tokens and bills:

  • Input, output, and the intermediate input and reasoning tokens produced inside the loop;
  • Tool use at the existing rate structure (Google Search retrieved tokens are excluded, url_context and similar fetched tokens are included);
  • Sandbox compute (CPU, memory, execution), which is not billed during the preview.

The official estimates come from Google's own runs, not independent retesting:

Task typeInput tokensOutput tokensTypical cost
Research and synthesis100k–500k10k–40k$0.30–$1.00
Document and content generation100k–500k15k–50k$0.30–$1.30
Process and system design100k–400k10k–30k$0.25–$0.80
Data processing and analysis300k–3M30k–150k$0.70–$3.25

Two notes under that table matter more than the ranges: 50–70% of input tokens normally hit the cache, and tool-heavy workflows can accumulate 3M to 5M tokens in one interaction, close to $5.

Treat the table as an order of magnitude. The same prompt lands at different points in the range depending on model and tool-call count. To reconcile your own run, take usage.total_tokens from the response and multiply by the current model rate — that is the real cost of that interaction. The same reasoning drives splitting Carbon and Hydrogen by task: choose a model per task instead of estimating per call.

Billing path of one interaction

Putting a ceiling on automated runs

agent_config.max_total_tokens caps the tokens one interaction may consume, counting input, output, and thinking. Cached tokens do not count toward it.

interaction = client.interactions.create(
    agent="antigravity-preview-09-2026",
    input="Analyze /workspace/data.csv and produce a summary report.",
    environment="remote",
    agent_config={
        "type": "antigravity",
        "max_total_tokens": 50000,
    },
)
if interaction.status == "incomplete":
    print("Budget hit, tokens:", interaction.usage.total_tokens)

At the limit the interaction ends with status: "incomplete", and the agent's progress and context are kept. Send a new interaction with previous_interaction_id and the original environment_id to continue; the continuation gets its own budget.

The cap is best-effort. The agent checks the budget between steps, so actual usage can slightly exceed it — do not treat it as an exact stop.

So budget control takes two parts: max_total_tokens on each interaction, and application-side accounting of total_tokens that stops new work as you approach the project or account limit. The reservation-and-stop pattern in giving a nightly agent a budget it can stop on applies here too.

Continuing after a budget stop

What to check before you connect

  • Whether the model is pinned. Omit agent_config.model and the official default applies — and moves when Google changes it. Write it explicitly, or lock it with agents.create, when results must be stable.
  • Parameters that cannot be set. temperature, top_p, top_k, stop_sequences, and max_output_tokens return a 400 on this agent. Control length with max_total_tokens and background execution instead.
  • Not supported yet. Structured output, file_search, computer_use, google_maps; audio, video, and documents as input — text and images only.
  • Stateful-only function calling. You must continue with previous_interaction_id; rebuilding history manually is not supported. Applications that manage their own transcript need to change.
  • Background execution needs storage. background=True requires store=True, which lands right on the new Gemini project storage default; check both together before deploying.
  • Environment lifetime. Environments are permanently deleted after 7 days of inactivity, and idle VMs shut down, so the next request pays a cold start.

Common questions

Is the API agent the same as the IDE's Agent Manager? Same harness, different runtime. Error surfaces and quota sources differ, and IDE fixes do not transfer to API calls.

What happens if I omit model? The current default applies, which is gemini-4-hydrogen. The next default change will silently reach code that omits model.

Can I set the thinking level? AntigravityAgentConfig currently exposes type, model, and max_total_tokens; the docs offer no thinking_level. To reason deeper or shallower, change the model. For what each Hydrogen level does, see the migration guide.

Sandbox compute is free in preview, so can I run anything? No. Tokens and tools still bill, a hard task can approach $5, and free compute only removes the environment line.

Next step

If the agent only needs to do a job, you can call a Gemini-compatible endpoint from Nbility and arrange the sandbox yourself. If you want a hosted sandbox and filesystem, run the checks in order: pin the model, set max_total_tokens, then log usage.total_tokens and the interaction status. That way, when the default model moves again, the cost and outcome still line up.

Related posts

Returning files in Gemini tool results
GeminiFunction CallingFiles

Returning files in Gemini tool results

Gemini multimodal tool results need a valid call ID, typed content, and accessible bytes or a file URI. A filename alone does not deliver the artifact.

Run your Agent workflow through Nbility

Get an API key and connect OpenAI-compatible models and developer tools from one place.

Get an API key