Migrate to Gemini 4 Carbon: 4 request changes to make
A new model name is not enough. Raise a max_output_tokens set below 32,768, drop explicit caches, remove temperature, and plan for prices that double on Dec 1.
gemini-4-carbon reached general availability on November 10, 2026. Swapping the model string usually still works, but the migration checklist in the docs lists four things that cut answers short or throw off your bill if you leave them. Find and fix each one in your code, in this order.
If you already run gemini-4-argon, the request schema does not change; only the model ID does. Carbon spends more thinking tokens per turn than Argon on hard tasks, so still read steps [1] and [4]. The checks below assume you are coming from Gemini 3 or earlier.
[1] Find every place that sets max_output_tokens and raise any value below 32,768. The docs define it as the combined cap on thinking tokens and answer tokens, so if Carbon spends more of the limit on thinking, the answer is what gets cut off.
$ grep -rnE "max_output_tokens|maxOutputTokens" --include="*.py" --include="*.js" --include="*.ts" --include="*.json" .The docs recommend:
| Situation | Docs guidance |
|---|---|
| Standard tasks | Keep the default of 65,536 or set nothing |
| Existing app with a limit under 32K | Raise to at least 32,768. To use fewer tokens, lower the thinking level (thinking_level) instead |
| Complex reasoning and coding | background: true with 131,072 or 262,144, up to 1,048,576 minus your input tokens |
Check timeouts in the same pass. Hard prompts can take several minutes, so the docs say to use background execution or set HTTP client timeouts to at least 15 minutes.
[2] Remove code that uses explicit context caching (cachedContents / caches.create). The docs say explicit caching is not supported on Carbon and tell you to remove calls that create or reference cached_content.
$ grep -rnE "cachedContents|caches\.create|cached_content" --include="*.py" --include="*.js" --include="*.ts" .Implicit caching is on by default instead. Per the docs it applies to prompts of at least 4,096 tokens and discounts cached input tokens by 95% on a hit. A prompt that opens with the same long part on every request (system instructions, a large document) is the shape that discount fits.
[3] Remove temperature, top_p and top_k from your requests. The migration list says "If provided, they are ignored," so nothing fails; the values just do nothing. That is the risk: code that pinned temperature to 0 for repeatable answers silently stops being repeatable. The troubleshooting docs say these values are ignored and "will return 400 errors in a future release"; the details are in Gemini 4 and 3.6+ ignore temperature, top_p, top_k: remove them; here, just locate them.
$ grep -rnE "temperature|top_?p|top_?k|topP|topK" --include="*.py" --include="*.js" --include="*.ts" --include="*.json" .[4] Split the unit prices in your cost calculation by date. The pricing page lists Carbon at an introductory price through November 30, 2026, and both input and output double on December 1.
| Item (per 1M tokens) | through 2026-11-30 | from 2026-12-01 |
|---|---|---|
| Input | $2.00 | $4.00 |
| Output (including thinking tokens) | $10.00 | $20.00 |
| Cached input (implicit only) | $0.10 | $0.20 |
Output price includes thinking tokens, which ties back to step [1]. Raising the limit raises the most one hard request can spend, so when you want fewer tokens, the docs say to lower thinking_level rather than raise max_output_tokens. The arithmetic is simple: a month with 50 million output tokens is $500 now and $1,000 from December. Carbon is not available on the Free tier, and with grounding, internal tool system instructions and function declarations are billed as tokens too.
With the four fixes, the request shape from the docs looks like this. Pick low, medium (default) or high; the docs say to run your evaluations at all three and choose the lowest level that meets your quality bar.
interaction = client.interactions.create( model="gemini-4-carbon", input="...", generation_config={ "thinking_level": "medium", "max_output_tokens": 65536, },)The docs' examples use the new Interactions API (client.interactions.create), and the same checklist tells you to keep multi-turn and function-calling state on the server with previous_interaction_id. Moving an existing generateContent call to that API is outside this post.
For call errors such as 429 and 503, regardless of model, see Gemini API 429 RESOURCE_EXHAUSTED backoff and 503 model is overloaded.