[KongchangAI]
· 3 min read· 1,881 words

Gemini 4 Argon Developer Guide: thinking_level and Long Decode in Practice

Gemini 4 Argon Developer Guide: thinking_level and Long Decode in Practice

Gemini 4 Argon's thinking_level and max_output_tokens drive cost and latency; public benchmarks all use high while the default is medium.

After the launch of Gemini 4 Argon, thinking_level (low/medium/high, default medium, non-disableable) and max_output_tokens (65,536 synchronous, up to 1,048,576 under long decode) directly determine each request's cost and duration. The core traps: all public benchmarks are collected at high while unspecified requests default to medium; setting the output ceiling too low returns an empty answer yet bills as usual; exceeding 64K tokens requires long decode, which runs in 64K hops billed per hop with a 95% implicit cache discount on repeated input. temperature, top_p, and top_k are completely ignored by Argon, so controlling behavior relies only on thinking level and prompts, and client timeouts should be at least 15 minutes. medium/low accuracy data is missing, and long decode's end-to-end behavior on AIHubMix is unverified.

Gemini 4 Argon thinking_level and long decode developer guide

With the official launch of Gemini 4 Argon, two parameters directly determine the cost and duration of every request: thinking_level (low/medium/high, default medium) and max_output_tokens (synchronous default 65,536, up to 1,048,576 under long decode). Both have official documentation, and both have pitfalls. The core engineering problem: every public benchmark runs at the high level, but requests that don't specify a level default to medium. Set the output ceiling too low and you get an empty answer while still being charged. Exceeding 64K tokens requires long decode, which runs in the background and bills per hop.

Parameter Quick Reference and Level Selection

SettingGemini 4 Argon
Thinking levelslow, medium, high
Default levelmedium
Turn off thinkingNot supported
Synchronous max output65,536 tokens
Long decode max output1,048,576 minus input
Context window1,048,576, shared by input/thinking/output
temperature, top_p, top_kIgnored
Recommended client timeoutAt least 15 minutes

When calling via the OpenAI SDK, reasoning_effort maps as follows: minimal/low maps to low, medium to medium, high to high.

Google's advice is straightforward: run evals at all three levels, then pick the lowest level that meets your quality floor. But all public data was collected at the high level—Google evaluated Argon at its "highest thinking setting," and Artificial Analysis and Vals AI also test at high. GPT-6 Astra and GPT-6.1 Sol were tested at "max," a notch above high. So the so-called "Argon (high) ties Astra (max)" is really a contest between each model's ceiling.

The practical trade-offs of level selection:

  • low: fewest tokens, lowest latency, suited to simple and cost-sensitive tasks
  • medium: balanced, suited to most tasks including complex code and agents
  • high: most tokens, slowest first token, suited to the hardest reasoning, math, and code

Thinking level (reasoning / thinking level) is the internal reasoning budget tier a large model is allowed before producing its final answer. The higher the level, the more tokens the model generates during its "implicit thinking" phase; reasoning quality typically improves, but both first-token latency and total output tokens rise. Argon's low/medium/high is not an on/off switch but a tiered continuous budget, and thinking tokens are tracked separately in usage as total_thought_tokens and billed as output.

Implicit caching is the server-side ability to automatically hit a cache for identical prefixes and bill at a discount. Argon applies it to prompts of at least 4,096 tokens, giving a 95% discount on the repeated portion of the input. Cache hits require identical content, model, and parameters, so switching thinking_level mid-session invalidates the cache and raises long decode costs.

The Real Cost of the high Level

According to test data from Artificial Analysis and Vals AI at the high level:

MetricGemini 4 Argon (high)Comparison
Output tokens per task~62kGPT-6 Astra (max): ~27k
AA Index total output tokens110MMedian model: 85M
Output speed99.5–116.5 tokens/sAI Studio / Vertex AI
Time to first answer token~45 secondsIncludes thinking time
Vals Index single test duration46m33s—

Output billing includes thinking tokens, reflected in usage as total_thought_tokens. At roughly 62k output tokens per task, that's about $0.62 at Google's $10-per-million-token introductory price, or about $1.24 at the $20 price starting December 1. At 99.5–116.5 tokens/s, 62k tokens takes 9 to 10 minutes to generate.

Quick Start: AIHubMix Client Configuration

Prerequisites:

  • Your AIHubMix key stored in the AIHUBMIX_API_KEY environment variable; Argon's model name on AIHubMix is gemini-4-argon
  • Use the OpenAI SDK for regular requests, endpoint https://aihubmix.com/v1
  • Use the Google GenAI SDK for long decode, endpoint https://aihubmix.com/gemini
pip install -U openai google-genai
export AIHUBMIX_API_KEY="your-aihubmix-key"

A standard synchronous request:

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://aihubmix.com/v1",
    api_key=os.environ["AIHUBMIX_API_KEY"],
    timeout=900,
)

resp = client.chat.completions.create(
    model="gemini-4-argon",
    reasoning_effort="medium",
    max_tokens=32768,
    messages=[
        {"role": "user", "content": "Review this payment service for race conditions in its retry logic.\n\n<source code>"},
    ],
)
print(resp.choices[0].message.content)
print(resp.usage)

A few key choices: reasoning_effort="medium" explicitly declares the default so a later change is one word away; max_tokens=32768 is Google's minimum recommended application-side setting, capping both thinking and answer; timeout=900 follows Google's recommendation of at least 15 minutes for hard prompts; and no temperature or top_p, because Argon ignores them.

Long Decode: The Right Way to Exceed 64K

Long decode is what Google originally announced as Long Decode Continuation. On the Interactions API, the server runs the continuation loop for you: set background=True (requires store=true) and max_output_tokens above 65,536. It runs in hops of up to 64K tokens, can run for up to 24 hours, and each hop adds a model_output step.

import os
import time
from google import genai

client = genai.Client(
    api_key=os.environ["AIHUBMIX_API_KEY"],
    http_options={"base_url": "https://aihubmix.com/gemini"},
)

interaction = client.interactions.create(
    model="gemini-4-argon",
    input="Write the full test suite for this payment module, with a test for every edge case.\n\n<source code>",
    background=True,
    generation_config={"max_output_tokens": 262144, "thinking_level": "high"},
)
while interaction.status in ("in_progress", "queued"):
    time.sleep(5)
    interaction = client.interactions.get(id=interaction.id)

text = "".join(
    part.text
    for step in interaction.steps
    if step.type == "model_output"
    for part in step.content
    if part.type == "text"
)
print(interaction.status, interaction.usage)

The alternative is client-side continuation on generateContent. Each hop returns up to 64K tokens (32K for non-streaming REST), ends with finish_reason: CONTINUATION and a continuation_token, and you resend the same request with the token. google-genai 2.30.1 and @google/genai 2.29.1 and above handle this automatically. Each request has a 20-minute limit.

For streaming: save the interaction ID and each event_id, reconnect with last_event_id, read to the end, then check status; set read timeouts to 15–20 minutes. After the first 64K tokens, output arrives in chunks of about 5,000 tokens.

The criteria for when it applies: hard math, science, and proof tasks, the hardest coding and agent tasks, and eval harnesses that stop at the ceiling—these suit long decode. Chat, Q&A, summarization, extraction (under 32K), fixed-length requests, multi-turn tool agents with short turns, prompts approaching the 1M input limit, and latency-sensitive calls—none of them do.

Long Decode Continuation is essentially splitting a single ultra-long generation into multiple 64K-token "hops." The synchronous interface is constrained by output limits and timeouts per request and cannot produce more than 64K at once; long decode instead has the server or client loop the continuation, each hop returning a segment and linking via continuation_token, ultimately concatenated into the full output.

background=True and store=true are the two prerequisite switches for enabling server-side long decode on the Interactions API. Background execution means the request is persisted as a pollable interaction object, the server advances the continuation loop itself for up to 24 hours, and the interaction is stored—so you cannot also set store=False. Billing accrues hop by hop on the tokens actually generated, including pure-thinking hops.

finish_reason: CONTINUATION is the end signal for the client-side continuation path: when a hop reaches 64K (32K for non-streaming REST), the response ends with this marker and a continuation_token, and the caller must resend the same request with that token to get the next hop. google-genai 2.30.1 and above handle this loop automatically; otherwise you implement it manually.

Common Failures and Fixes

Empty or truncated answer but still billed: the response hit max_output_tokens during thinking, status is incomplete, text is truncated or empty, and thinking tokens are billed as usual. The fix is to raise the ceiling to at least 32,768, or lower the thinking level. Don't shrink the ceiling to save money.

400 error: max_output_tokens greater than 65536 not yet supported with background=false: you requested more than 65,536 tokens in a synchronous call. Switch to background=True, or keep the ceiling at 65,536.

400 error: background interaction requires store=true: background execution stores the interaction. Don't set store=False in background calls.

Output stops exactly at 64K: background is false, max_output_tokens wasn't set above 65,536, or an older SDK isn't continuing on generateContent. Set background=True and raise the ceiling above 65,536, or upgrade to google-genai 2.30.1 or later.

Results don't match public scores: benchmarks run at high; your requests default to medium. For benchmark behavior, set reasoning_effort="high" (or thinking_level="high") and measure for yourself whether medium is sufficient.

Changing temperature does nothing: Argon ignores temperature, top_p, and top_k. Remove them and control behavior with thinking level and prompts.

Context compaction kicks in too early: during long decode, total_input_tokens sums each hop's input and overestimates the context. Google's example: a 1,000-token prompt plus 200,000 generated tokens over four hops reports about 397,000 input tokens, while the actual context is about 201,000. The fix is to estimate context as prompt size plus total_output_tokens plus total_thought_tokens.

Long decode billing: every token of every hop is billed, including pure-thinking hops; 95% of the repeated input within each hop is discounted by implicit caching. In Google's example, at introductory pricing, 200,000 output tokens cost $2.00, and roughly 396,000 repeated input tokens add about $0.04 at $0.10 per million. Cancelled and failed interactions are billed for work completed. Use long decode only for applicable cases and limit max_output_tokens to what the task actually needs.

Cache hits disappear mid-session: Argon implicitly caches prompts of at least 4,096 tokens at a 95% discount. Cache hits require identical content, model, and parameters, and switching levels between turns can lose the hit. Pin one level per workflow.

The accounting basis of total_input_tokens is the key to understanding false context-compaction alarms. During long decode, the server resubmits the existing context as input on every hop, so total_input_tokens in usage is the sum of each hop's input, not the true context length. The true context should be approximately the original prompt plus total_output_tokens plus total_thought_tokens; estimating by this basis avoids falsely triggering compaction.

What Can't Yet Be Verified

Two things currently lack empirical data. First, how accuracy and token usage change at the medium and low levels—all public results are at high, with no lower-level data to reference. Second, whether long decode works end to end via AIHubMix's Gemini endpoint. AIHubMix's docs document background interactions, but Argon's long decode on that route hasn't been tested.

Argon's AIHubMix model page lists input, capabilities, and current pricing as a configuration reference.

Benchmark level consistency is the most easily overlooked source of bias when comparing models. Public leaderboards usually run at each model's "top tier": Argon at high, Astra at max, Sol at max. high and max are not the same tier, so "Argon (high) ties Astra (max)" only means their respective ceilings are close; it doesn't represent actual performance at the default medium. For engineering selection, rely on your own task's measured level, not leaderboard scores applied directly.

Key Takeaways

  • There's no option to turn thinking off, the default is medium, and all public benchmarks were collected at high
  • max_output_tokens caps both thinking and answer; Google recommends at least 32,768 application-side
  • Beyond 65,536 tokens you must use long decode (background=True plus a ceiling above 65,536), billed per hop
  • temperature, top_p, and top_k are completely ignored; set the client timeout to at least 15 minutes
  • Public data is missing medium/low accuracy, and long decode's end-to-end behavior on AIHubMix remains unverified
#Gemini 4 Argon#thinking_level#long decode#max_output_tokens#AIHubMix
Share:

Related articles