> ## AI Agent Context
> Get the complete documentation index at: https://aistudio.google.com/llms.txt
> Use this file to discover all available pages.
> For the full documentation in a single file, fetch: https://aistudio.google.com/llms-full.txt

# What's new in Gemini 4 Carbon

Gemini 4 Carbon (`gemini-4-carbon`) is our strongest reasoning model, built for sustained agentic workflows across complex software engineering, multimodal knowledge work, scientific reasoning, and cybersecurity defense. On hard problems, Carbon spends more thinking tokens to explore hypotheses, verify its work, and check edge cases before responding.

Gemini 4 Carbon is available on the paid tier of the Gemini API and in Google AI Studio. Like [Gemini 4 Argon](/docs/whats-new-gemini-4-argon?generate-content=true), it supports a unified 1M-token context window, long decode up to 1M tokens, and tunable thinking levels (`low`, `medium`, `high`) at the same per-token price.

{% card-grid %}
  {% card description="Test prompts and multimodal files with Gemini 4 Carbon in AI Studio." href="https://aistudio.google.com/prompts/new_chat?model=gemini-4-carbon" icon="chat" title="Try in Playground" /%}

  {% card description="Build and verify full-stack web and 3D apps with Gemini 4 Carbon." href="https://aistudio.google.com/apps?model=gemini-4-carbon" icon="experiment" title="Build in AI Studio" /%}

  {% card description="Read practical prompting and multi-agent patterns for Gemini 4 Carbon." href="https://aistudio.google.com/learn/gemini-4-carbon-developer-guide" icon="rocket_launch" title="Developer guide" /%}

{% /card-grid %}

This guide explains what's new in Gemini 4 Carbon, how to choose between Carbon and Argon, API changes, code examples, and migration guidance.

## New model  {% id="new-model" %}

| Model | Model ID | Default thinking level | Pricing | Description |
| :--- | :--- | :---: | :--- | :--- |
| Gemini 4 Carbon | `gemini-4-carbon` | `medium` | Available through Nov 30, 2026 at an introductory price of $2/1M input tokens and $10/1M output tokens ($4/1M input and $20/1M output thereafter). See [pricing](/docs/pricing) for details. | Our strongest reasoning model, built for sustained agentic coding, multimodal knowledge work, scientific discovery, and cybersecurity defense. |

For complete details, see the [Gemini 4 Carbon model page](/docs/models/gemini-4-carbon) and [Latest Gemini models](/docs/latest-model?generate-content=true). For introductory pricing details, see the [pricing section](/docs/whats-new-gemini-4-carbon?generate-content=true#pricing) on this page or the [pricing page](/docs/pricing#gemini-4-carbon).

## Quickstart  {% id="quickstart" %}

Use the following example to send a request to `gemini-4-carbon` with the recommended default `thinking_level` (`medium`) and a 64K output token limit:

{% tabs %}
  {% tab label="Python" %}
  ```bash
  pip install -U "google-genai>=2.30.1"
  ```

  ```python
  from google import genai
  from google.genai import types
  
  client = genai.Client()
  
  response = client.models.generate_content(
      model="gemini-4-carbon",
      contents="Write a three.js script that renders a realistic 3D black hole with gravitational lensing.",
      config=types.GenerateContentConfig(
          max_output_tokens=65536,
          thinking_config=types.ThinkingConfig(thinking_level="medium"),
      ),
  )
  
  print(response.text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```bash
  npm install "@google/genai@>=2.29.1"
  ```

  ```javascript
  import { GoogleGenAI } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  const response = await ai.models.generateContent({
    model: "gemini-4-carbon",
    contents: "Write a three.js script that renders a realistic 3D black hole with gravitational lensing.",
    config: {
      maxOutputTokens: 65536,
      thinkingConfig: {
        thinkingLevel: "medium",
      },
    },
  });
  
  console.log(response.text);
  ```

  {% /tab %}

  {% tab label="REST" %}
  ```bash
  curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-4-carbon:generateContent" \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
      "contents": [{
        "parts": [{"text": "Write a three.js script that renders a realistic 3D black hole with gravitational lensing."}]
      }],
      "generationConfig": {
        "maxOutputTokens": 65536,
        "thinkingConfig": {
          "thinkingLevel": "medium"
        }
      }
    }'
  ```

  {% /tab %}

{% /tabs %}

## What's new in Gemini 4 Carbon  {% id="whats-new" %}

* **Extended verification and agentic coding:** Runs deeper build-and-verify loops across complex repositories, frontend UI design, and 3D scenes, isolating root causes and checking fixes against tests.
* **Higher precision on multimodal knowledge work:** Stronger source grounding with fewer unsupported claims across dense PDFs, spreadsheets, slides, and workspace data, paired with strict adherence to output schemas.
* **Scientific and cybersecurity reasoning:** Improved performance on formal proofs, experimental data analysis, vulnerability discovery, and root-cause patching.
* **Unified 1M context window and long decode:** Input, thinking, and output tokens share one 1,048,576-token window (with a 32K per-request cap for non-streaming calls and a 64K per-stream cap for streaming calls), and long decode lets a single generation go up to 1M tokens minus your input. The latest Google GenAI SDKs continue for you by default. See [Long decode](/docs/long-decode?generate-content=true).
* **Supported in Managed Agents:** The [Antigravity agent](/docs/antigravity-agent) in Gemini Managed Agents now supports `gemini-4-carbon`.

## Choosing between Carbon, Argon, and other models  {% id="choosing-between-models" %}

Gemini 4 Carbon and [Gemini 4 Argon](/docs/whats-new-gemini-4-argon?generate-content=true) share the same 1M unified context window, built-in tools, and per-token pricing. The main difference is how many thinking tokens each model spends per turn:

* **Gemini 4 Carbon (`gemini-4-carbon`):** Built for tasks that push the limits of reasoning depth. Carbon spends more thinking tokens per turn to explore thoroughly and verify its work, which increases per-turn token use and latency compared to Argon. Use it for complex root-cause debugging, architectural design, dense multimodal synthesis, scientific proofs, and security auditing.
* **Gemini 4 Argon (`gemini-4-argon`):** Our efficient Gemini 4 frontier reasoning model, ideal for most advanced software engineering and knowledge work tasks. It delivers Gemini 4 intelligence with faster responses and lower token spend per turn compared to Carbon on interactive coding, day-to-day feature work, and fast production loops.

For more guidance on model selection, see [Latest Gemini models](/docs/latest-model?generate-content=true#compare-models).

## Understanding thinking levels  {% id="understanding-thinking-levels" %}

The [thinking level](/docs/thinking?generate-content=true) is your main control over quality, latency, and token use in Gemini 4 Carbon:

| Thinking level | Token use | When to use |
| :--- | :--- | :--- |
| `low` | Fewest tokens, lowest latency | Simpler tasks and cost-sensitive work. Also works for analysis and writing tasks that need light thinking. Quality can drop on hard tasks. |
| `medium` (default) | Balanced | Recommended for most tasks, including complex code and agentic use cases. |
| `high` | Most tokens, slowest first token | Complex reasoning, hard math and science, and the most difficult code or agent tasks. Pairs well with long decode for long outputs. |

Run your evaluations at all three levels with a high `max_output_tokens` so the limit doesn't cut answers short. Then pick the lowest `thinking_level` that meets your quality bar. To learn more, see the [thinking guide](/docs/thinking?generate-content=true).

{% tabs %}
  {% tab label="Python" %}
  ```python
  from google import genai
  from google.genai import types
  
  client = genai.Client()
  
  response = client.models.generate_content(
      model="gemini-4-carbon",
      contents="Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
      config=types.GenerateContentConfig(
          thinking_config=types.ThinkingConfig(
              thinking_level="medium",  # Balanced reasoning effort for complex tasks
          ),
      ),
  )
  
  print(response.text)
  ```

  {% /tab %}

  {% tab label="JavaScript" %}
  ```javascript
  import { GoogleGenAI } from "@google/genai";
  
  const ai = new GoogleGenAI({});
  
  const response = await ai.models.generateContent({
    model: "gemini-4-carbon",
    contents: "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
    config: {
      thinkingConfig: {
        thinkingLevel: "medium", // Balanced reasoning effort for complex tasks
      },
    },
  });
  
  console.log(response.text);
  ```

  {% /tab %}

  {% tab label="REST" %}
  ```bash
  curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-4-carbon:generateContent" \
    -H "x-goog-api-key: $GEMINI_API_KEY" \
    -H 'Content-Type: application/json' \
    -X POST \
    -d '{
      "contents": [{
        "parts": [{"text": "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely."}]
      }],
      "generationConfig": {
        "thinkingConfig": {
          "thinkingLevel": "medium"
        }
      }
    }'
  ```

  {% /tab %}

{% /tabs %}

## Larger output and long decode  {% id="shared-context-window" %}

When a task requires deep reasoning, Gemini 4 Carbon can think longer and work harder to finish complex math, science, and coding problems in a single generation.

* **Unified 1M-token context window:** Input, thinking, and output tokens share one 1,048,576-token window, so Carbon can use up to 1M tokens minus your input tokens for thinking and output combined.
* **Use `thinking_level` to control reasoning depth:** `thinking_level` sets how deeply the model reasons before answering. `max_output_tokens` caps your combined thinking and output tokens. The response stops once thinking plus output hits `max_output_tokens`, so set it high enough to leave room for the final answer.
* **Per-request caps (64K streaming / 32K non-streaming):** One streaming request returns up to 65,536 tokens. One non-streaming request returns up to 32,768 tokens, down from 65,536 on Gemini 3.x. For REST calls, these caps are also the defaults.

The latest Google GenAI SDKs run long decode for you by default. Use Python `google-genai` 2.30.1 or higher, or JavaScript `@google/genai` 2.29.1 or higher.

In these versions, `automatic_continuation` is `True` by default, so you do not need to set it. When you set `max_output_tokens` above the per-request cap, `generate_content` and `generate_content_stream` automatically continue across requests until the model finishes or reaches `max_output_tokens`, returning one combined response.

```python
response = client.models.generate_content(
    model="gemini-4-carbon",
    contents="Write a complete, rigorous proof of the prime number theorem.",
    config=types.GenerateContentConfig(
        max_output_tokens=262144,
        thinking_config=types.ThinkingConfig(thinking_level="high"),
        automatic_continuation=True,  # Default.
    ),
)
```

To run the loop yourself, set `automatic_continuation=False`. If you call REST or use an older SDK, requests stop at the per-request cap. For REST loops, third-party frameworks, token counting, and when to use long decode, see the [long decode guide](/docs/long-decode?generate-content=true).

{% callout type="note" %}
  On a hard task, the model can spend an entire 64K or 32K hop on thinking and return empty text with a `continuation_token`. This is normal, and the final answer arrives in later hops.

{% /callout %}

### Setting output token limits  {% id="setting-output-token-limits" %}

`max_output_tokens` sets the maximum combined thinking and output tokens for a generation, including all continuation requests. Set it high enough that thinking does not cut the answer short. Set it low enough to limit spend when a hard prompt uses all of it.

Use these values as a starting point:

* **Standard tasks:** Keep the default.
* **Existing apps with a limit lower than 32K:** Raise `max_output_tokens` to 32,768. To use fewer tokens, lower `thinking_level`.
* **Tasks that used more than 32K tokens before:** Set `max_output_tokens` to 65,536.
* **Complex reasoning and coding:** Set `max_output_tokens` to 131,072 or 262,144, up to 1,048,576 minus your input tokens.

If a request uses all of `max_output_tokens`, it returns `finish_reason: "MAX_TOKENS"` and still includes a `continuation_token`. You can resume or start again.

* **Resume from the checkpoint:** Send the original request with the latest `continuation_token` and a higher `max_output_tokens`. If you do not raise `max_output_tokens`, the request returns `400 INVALID_ARGUMENT`.
* **Start again:** Send the original request with a higher `max_output_tokens` and no `continuation_token`.

## Migration checklist  {% id="migration-checklist" %}

{% callout type="note" %}
  Automate this migration with a coding agent. If you use a coding agent that supports skills (like Antigravity), install the [gemini-api-dev skill](/docs/coding-agents#gemini-api-dev) and run:

  ```none
  /gemini-api-dev migrate my app to Gemini 4 Carbon
  ```

{% /callout %}

### Migrate from Gemini 4 Argon  {% id="migrate-from-gemini-4-argon" %}

If you already run `gemini-4-argon`, upgrading to `gemini-4-carbon` requires no request schema changes:

* **Update the model ID:** Change your model string from `gemini-4-argon` to `gemini-4-carbon`.
* **Account for longer thinking:** Carbon spends more thinking tokens per turn than Argon on complex tasks. Keep `thinking_level` at `medium` (default) unless a workload needs `high`, and make sure your `max_output_tokens` and HTTP timeouts allow for longer reasoning passes.
* **Keep Argon where speed matters:** Retain [`gemini-4-argon`](/docs/whats-new-gemini-4-argon?generate-content=true) when you want faster responses and lower token spend per turn compared to Carbon on interactive coding, day-to-day feature work, and fast production loops.

### Migrate from Gemini 3 and earlier  {% id="migrate-to-gemini-4-carbon" %}

* **Update the model ID:** Change your model string to `gemini-4-carbon`.
* **Set `max_output_tokens` explicitly:** The default is 64K for streaming and SDK calls, and 32K for non-streaming REST calls.
* **Raise caps lower than 32K:** Raise any cap lower than 32K to at least 32,768. Use `thinking_level` to reduce token spend.
* **Plan for long decode:** For tasks above the per-request cap, use the latest SDK or add a `continuation_token` loop.
* **Replace `thinking_budget` with `thinking_level`:** `thinking_budget` still works and maps to the nearest `thinking_level`, but it returns a warning. Test your workload at `low`, `medium`, and `high`.
* **Move off explicit context caching:** Explicit caching (`cachedContents` / `caches.create`) is not supported on Gemini 4 Carbon and returns an error. Remove calls that create or pass `cached_content` in `GenerateContentConfig`. [Implicit caching](/docs/caching?generate-content=true) is enabled by default for prompts of at least 4,096 tokens and discounts cached input tokens by 95% on cache hits.
* **Remove deprecated parameters:** Remove `temperature`, `top_p`, `top_k`, and `candidate_count` from requests. If provided, sampling parameters are ignored.
* **Increase client timeouts:** Set HTTP client timeouts to at least 20 minutes per call.
* **Preserve thought signatures:** Pass the full conversation history, including [thought signatures](/docs/thinking?generate-content=true#signatures), in multi-turn and function-calling requests.
* **Review your cost estimates:** Every token the model processes is billed, including internal tool system instructions and function declarations when using grounding (see [Pricing](/docs/whats-new-gemini-4-carbon?generate-content=true#pricing)).

## Pricing  {% id="pricing" %}

Gemini 4 Carbon is available at introductory pricing through November 30, 2026:

* **Input tokens:** $2.00 per 1M tokens ($4.00 starting December 1, 2026)  *   **Cached input tokens:** Implicit caching discounts cached input by 95%, to $0.10 per 1M tokens ($0.20 starting December 1, 2026).

* **Output tokens, including thinking tokens:** $10.00 per 1M tokens ($20.00 starting December 1, 2026)

Every token the model processes is counted and billed, including thinking tokens and internal tool system instructions and function declarations when using grounding. Grounding with Google Search also remains billed per query.

Gemini 4 Carbon is not available on the Free tier. For complete pricing tiers, see the [pricing page](/docs/pricing#gemini-4-carbon).

## Other models  {% id="other-models" %}

* [Latest Gemini models](/docs/latest-model?generate-content=true)
* [Gemini 4 Argon](/docs/whats-new-gemini-4-argon?generate-content=true)
* [Gemini 3.8 Flash](/docs/whats-new-gemini-3.8?generate-content=true)
* [Gemini 3.6 Flash and 3.5 Flash-Lite](/docs/whats-new-gemini-3.6?generate-content=true)
* [See all models](/docs/models)

## What's next  {% id="whats-next" %}

* Read the [Gemini 4 Carbon developer guide](https://aistudio.google.com/learn/gemini-4-carbon-developer-guide) for prompting and multi-agent patterns.
* Read the [long decode developer guide](/docs/long-decode?generate-content=true) for full streaming, reconnection, and token-counting patterns.
* Learn how thinking levels and thought summaries work in the [thinking guide](/docs/thinking?generate-content=true).
* Process Word, PowerPoint, and Excel files in the [document understanding guide](/docs/document-processing?generate-content=true#office-documents).
* Test Gemini 4 Carbon in [Google AI Studio](https://aistudio.google.com/prompts/new_chat?model=gemini-4-carbon).

