Support Gemini 4 Argon (`gemini-4-argon`) on `GoogleModel` with long decode past the per-request output cap, and raise the Google providers' default timeout to 20 minutes
This pull request was posted by Claude Code using claude-opus-5-5 on behalf of David.
Why we make these changes
Google launched gemini-4-argon on 2026-10-13, on the Gemini API and on Google Cloud at the global location and the us and eu multi-regions (not single regions such as the default us-central1). One request returns at most 32K output tokens (64K streamed); Google continues longer output, up to the 1M-token context window that input, thinking and output share, in further requests from a continuation token. google-genai 2.30.0 runs those requests inside one generate_content call (automatic_continuation, on by default). Before this PR, with google-genai older than 2.30 (main's lock has 2.25.0), the CONTINUATION finish reason mapped to finish_reason=None, so truncated output read as complete. With 2.30 or later, which a fresh install resolves, the SDK already continued, but per_request_input_tokens_limit and harness compaction read the summed input, and a stream merged the requests into one part. On either version, thinking=False or 'minimal' returned a 400.
There is no issue for this. Related: #6192, migrating GoogleModel to the Interactions API, which long decode does not need.
New public surface
'gemini-4-argon'inLatestGoogleModelNamesandKnownModelName(google:,google-cloud:,gateway/google:,gateway/google-cloud:).
Everything else is private: the __pydantic_ai__.initial_input_tokens metadata marker and _context_size.mark_initial_input_tokens / context_input_tokens / context_tokens.
User-visible behavior
agent = Agent('google:gemini-4-argon', model_settings={'max_tokens': 100_000})
result = agent.run_sync('Write the complete specification.')
# before, with google-genai < 2.30: output cut at the 32K per-request cap, finish_reason=None
# after: the full output in one ModelResponse, finish_reason='stop', usage summed across the requests
- Usage stays summed, which is what Google bills.
RunContext.context_window_used,per_request_input_tokens_limit, harness compaction andclai2's context displays read the first request's input tokens instead. - A streamed long decode starts new parts at each continuation request, matching the merged non-streamed response.
CONTINUATIONwithout a continuation token maps tofinish_reason='length'.- Thinking levels are
low/medium/high;thinking=Falseand'minimal'resolve tolow. - The client the Google providers create, including on the Gateway's Google route, has the 20-minute timeout Google recommends for long decode instead of 600 s, for every model those providers serve (see Deliberate scope).
- The
google-genaifloor is 2.30.0; Google's page names 2.30.1, which only fixes the Interactions API'soutput_text. The lock admits it through auvexclude-newer exception, with a TODO to remove it after 2026-10-20 00:39 UTC.
Deliberate scope
- The 20-minute timeout is not scoped to long-decode models. A non-streamed request can run up to Google's 10-minute server limit, which a 600 s timeout races. For a model that never long-decodes, the only change is how long a hung request waits before failing, and google-genai's own default is no timeout. Scoping it would need a new public
GoogleModelProfileflag and a per-request override that must not lengthen the timeout of a client the user passed. - No manual resume of a response that spent its
max_tokens; the final continuation token is not kept. - A non-streamed long decode checks usage limits once every request is done;
max_tokensbounds it (documented). - A failed continuation request fails the model request. Not streamed, the earlier requests' output is lost, though billed; streamed, the run keeps what it streamed as an interrupted response carrying the finished requests' usage.
- Cache health still reads the summed input.
- google-genai resumes a dropped stream from its last continuation token. A stream that drops after output no token covers fails instead, since resuming would repeat that output and streamed events can't be retracted. Live Argon streams carry a token on every chunk from the first checkpoint on, except the final
STOPchunk, so this hasn't been seen.
Verification
tests/models/google/test_long_decode.py:test_recorded_long_decoderecords a live continued request, unary (7,500 lines) and streamed (14,000 lines), and asserts the merged output, the second request being the first plus the token, one part per request with the first signed, summed usage and the first-request input marker. The other tests script the requests on anhttpx2.MockTransportfor what a live request can't produce on demand:test_one_request_is_unchangedpins request bodies and mapped responses for a response that is not continued;test_continued_requests_are_one_response,test_streamed_continuation_events,test_per_request_input_limit_reads_the_first_request,test_failed_continuation_request_raises,test_stream_drop_resumes_from_the_last_checkpoint,test_stream_drop_that_would_repeat_output_raises.- Context size:
tests/harness/compaction/test_compaction.pytest_long_decode_anchors_on_its_first_request,test_long_decode_input_is_its_first_request;tests/test_run_context_context_window.pytest_context_window_used_counts_first_request_input_of_merged_response. - Profile, model-name and timeout tests:
tests/profiles/test_google.py,tests/test_capability_spec.py,tests/models/test_google.pytest_google_provider_sets_http_options_timeout(Gemini API, Google Cloud and Gateway routes),tests/test_http_client_timeouts.pytest_google_provider_client_keeps_connect_timeout. - Live on 2026-10-13 against
gemini-4-argon, unary and streamed: on the Gemini API at this head (test_recorded_long_decode), and on Vertexglobalwith this branch before the stream-drop check was added. Both APIs: unary 7,500 lines, 36,396 output tokens, 2 requests; streamed 14,000 lines, 72,897 output tokens, 2 requests. Output exact,finish_reason='stop', first-request input marker 109 (unary) and 110 (streamed). - Pricing: pydantic/genai-prices#785.
What changes for existing users
The google extra requires google-genai>=2.30.0 and clients the Google providers create, including on the Gateway's Google route, time out after 20 minutes instead of 600 s; otherwise nothing changes for models that never return a continuation token, which get identical request bodies and mapped responses.
Checklist
- No breaking changes in accordance with the version policy.
- Any permitted compatibility impact has a label, warning, migration, release note, and exact API-check waiver.
- PR title is fit for the release changelog.