Support Gemini 4 Carbon (`gemini-4-carbon`) on `GoogleModel`

Merged
DS
1mo ago
+23-6

This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.

Why we make these changes

Google released Gemini 4 Carbon (gemini-4-carbon) on 2026-11-10: its strongest reasoning model, at Argon's per-token price. Google keeps Argon as the faster model for most work ("Keep Argon where speed matters"), so Carbon is listed alongside Argon, not in its place.

Carbon supports only the low, medium and high thinking levels. Without a profile entry, thinking=False and 'minimal' send MINIMAL, which Google documents as unsupported on Gemini 4 models.

There is no issue for this. Mirrors #10202 (Gemini 4 Argon).

New public surface

  • 'gemini-4-carbon' in LatestGoogleModelNames and KnownModelName (google:, google-cloud:, gateway/google:, gateway/google-cloud:).

User-visible behavior

agent = Agent('google:gemini-4-carbon', model_settings={'thinking': False})
# before: sends thinkingLevel MINIMAL, which Google lists as unsupported on Gemini 4 (Argon answers 400)
# after:  sends thinkingLevel LOW, as on gemini-4-argon; thinking='minimal' does the same
  • Docs: docs/models/google.md names Carbon in the thinking and long decode sections. The google:large/google:xlarge row in docs/model_aliases/AGENTS.md gives Argon's price-based placement and says to repoint to Carbon once genai-prices prices it.
  • add-new-model skill: Gemini 4 element names count as lines, and a thinking entry may come from Google's tables when neither API can be probed.

Verification

  • tests/profiles/test_google.py: Carbon rows in test_model_profile_supports_minimal_thinking_level and test_model_profile_thinking_levels.
  • tests/test_capability_spec.py snapshot rows. tests/models/test_model_names.py, tests/test_docs_model_aliases.py, the docs parity tests and the affected tests/test_examples.py pages pass locally.
  • GET v1beta/models/gemini-4-carbon on the Gemini API lists the model (displayName: Gemini 4 Carbon, thinking: true).
  • Not probed live: Carbon has no free tier, and the only key available returns 429 limit: 0. The level set comes from the Gemini API thinking table and the Vertex thinking table, which agree.
  • Long decode: Google's long decode page names gemini-4-carbon and gemini-4-argon, and its thinking page caps one request of either at 32,768 output tokens non-streamed and 65,536 streamed. Not run live on Carbon.
  • Google Cloud (Vertex) and Pydantic AI Gateway: not attempted. #13058 tracks checking both live, plus OpenRouter once it lists Carbon.

What changes for existing users

Nothing.

Deliberately out of scope

  • GoogleInteractionsModel (#12636): Carbon support follows once it merges.
  • OpenRouter's mandatory-reasoning list: OpenRouter does not list google/gemini-4-carbon yet.
  • Pricing: genai-prices (bundled 0.1.13 and the live feed) has no Carbon entry yet, so ModelResponse.cost() raises LookupError for Carbon until its automation imports one.
  • Docs aliases: google:large and google:xlarge stay on Argon, since the placement rules read prices from genai-prices. #13058 tracks repointing them.
  • The Google Cloud locations note in the long decode section stays Argon-only until Carbon is checked on Vertex.
PR decisions

2026-11-10 · Interactions API out of scope

  • Decision: Add the id on GoogleModel (generateContent) only; GoogleInteractionsModel support follows after #12636 merges
  • Why: David: the Interactions API isn't needed for this; support there comes after it merges
  • Session: d4f40277-53c9-4e44-ba50-af7e5b77afe1

2026-11-10 · Per-id thinking entries, not a gemini-4 prefix

  • Decision: One _MODEL_THINKING_LEVELS entry per Gemini 4 id
  • Why: The table is keyed per family-version, Google's level sets vary within a generation, and the root AGENTS.md scopes a fix to the surfaces it covers
  • Session: d4f40277-53c9-4e44-ba50-af7e5b77afe1

2026-11-10 · Vertex and Gateway verification is a follow-up

  • Decision: Keep the google-cloud: and gateway/ ids (derived from GoogleModelName); live Vertex and Gateway checks go to a follow-up issue
  • Why: David: no Vertex project is set up for this yet, and the Gateway check belongs with it; UNSUPPORTED_GATEWAY_MODEL_NAMES needs evidence the Gateway rejects an id
  • Session: d4f40277-53c9-4e44-ba50-af7e5b77afe1

2026-11-10 · Carbon listed alongside Argon

2026-11-10 · google:large/google:xlarge stay on Argon

  • Decision: Keep both aliases on gemini-4-argon until genai-prices prices Carbon; give Argon's row its price-based reason
  • Why: docs/model_aliases/AGENTS.md reads tier prices from genai-prices; moving early dropped the cost from the message history example
  • Source: https://github.com/pydantic/pydantic-ai/pull/13057#discussion_r4527484415
  • Session: d4f40277-53c9-4e44-ba50-af7e5b77afe1

2026-11-10 · Carbon thinking levels from docs

2026-11-10 · Pre-push review 1 of 3 at 7a8d91e5d

2026-11-10 · Pre-push review 2 of 3 at 10bdac5b5

  • Decision: douwebot's two threads confirmed addressed; three wording findings dismissed with evidence (Google's pricing page lists Carbon at Argon's price; the Argon row states both its introductory and lasting price; Google's model page describes Carbon as a general-purpose reasoning model)
  • Source: https://ai.google.dev/gemini-api/docs/pricing#gemini-4-carbon
  • Session: d4f40277-53c9-4e44-ba50-af7e5b77afe1

2026-11-10 · Penalties rejection left to #12426

  • Decision: Do not gate presence_penalty/frequency_penalty for the new id
  • Why: The Gemini API rejects penalties for every model, not only Gemini 4; open PR #12426 drops them for all
  • Source: https://github.com/pydantic/pydantic-ai/pull/12426
  • Session: d4f40277-53c9-4e44-ba50-af7e5b77afe1

2026-11-10 · Exempt delta f317ebfe7 (chains from reviewed 10bdac5b5)

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.

https://claude.ai/code/session_01NXARKicmbQarYg2AL75otK