DEV Community

Cover image for Gemini 4 Neon migration: default high thinking, 400 errors and the 65K cap
AIHubMix
AIHubMix

Posted on Edited on

Gemini 4 Neon migration: default high thinking, 400 errors and the 65K cap

Pointing an existing Gemini integration at gemini-4-neon is a one-line change. Google names Gemini 4 Neon as the upgrade target for Gemini 3.1 Pro, for general coding work on Gemini 4 Argon, and for complex coding or science work on Gemini 3.8 Flash. The work starts after the swap: fields older code still sends now return HTTP 400, the default thinking level moved up without an error, some parameters are accepted and ignored, and on AIHubMix one response tops out at 65,536 output tokens.

The edits most integrations need:

  1. Delete thinking_budget, replace MINIMAL with LOW, remove frequency_penalty and presence_penalty, and keep candidates at 1. Each of these is a documented 400, and so are broken thought signatures in tool calls.
  2. Set the thinking level yourself. Neon defaults to high, where Argon and 3.8 Flash defaulted to medium. For 3.8 Flash users that means higher bills; for Argon users the cost per task still falls.
  3. Remove temperature, top_p and top_k, which Neon ignores, along with explicit context caching and prefilled assistant turns, which it doesn't support. Google doesn't say how those last two fail.
  4. Keep output at or below 65,536 tokens per request and drop low caps left from older models: a low cap can stop the model while it's still thinking. Raise client timeouts to at least 15 minutes. Google's 1M-token long decode isn't available through AIHubMix's OpenAI-compatible endpoint, and its native path wasn't tested for this post.

Coming from Gemini 4 Carbon is simpler: Google says the request schema doesn't change, and the main difference is the default level. The Neon vs Carbon post in this series covers that move.

Where you're migrating from

Change From 3.1 Pro From Argon From 3.8 Flash
Default thinking level now high medium to high medium to high
xhigh level new new new
Token limits unified 1M already unified unified 1M
Explicit caching removed already gone removed
Price, input / output $2 / $12 to $3 / $15 $2 / $10 to $3 / $15 $0.75 / $3.75 to $3 / $15

Google's official prices, USD per million tokens. Gemini 3.1 Pro's $2/$12 applies to prompts up to 200K tokens ($4/$18 above that); Neon has one rate across the 1M window. Argon's $2/$10 is an introductory price that becomes $4/$20 on December 1, 2026; 3.8 Flash's $0.75/$3.75 runs to December 31, 2026. Google says 3.1 Pro and Argon both cap at high; it doesn't list 3.1 Pro's default.

The rules below come from Google's Neon developer guide on Google Cloud and the migration checklist in AI Studio, unless marked otherwise.

One detail on the starting points: Google's AI Studio upgrade table sends 3.8 Flash users to Gemini 4 Hydrogen, and it's the Google Cloud guide that points complex coding and science work on 3.8 Flash at Neon. Google has announced no shutdown date for 3.1 Pro Preview, 3.8 Flash or any Gemini 4 model.

A request that follows Neon's rules

The setup is the AIHubMix quick start: base URL https://aihubmix.com/v1, key in AIHUBMIX_API_KEY. This Chat Completions request sets the level explicitly and stays within the gateway's output cap:

curl -s https://aihubmix.com/v1/chat/completions \
  -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-4-neon",
    "reasoning_effort": "medium",
    "max_completion_tokens": 65536,
    "messages": [{"role": "user", "content": "Reply with OK."}]
  }'
Enter fullscreen mode Exit fullscreen mode

Like every request in this post, it's a request shape, not a recorded response.

The field that sets the level depends on the protocol:

Protocol Field Values for Neon
Native Gemini thinkingConfig.thinkingLevel LOW to XHIGH
Chat Completions reasoning_effort low to xhigh
Responses reasoning.effort low to xhigh
Anthropic Messages output_config.effort low to xhigh

The native values are uppercase in GenerateContent. The other three protocols' values come from AIHubMix's parameter schema for gemini-4-neon, which lists high as the default on every protocol.

Google's OpenAI compatibility layer maps reasoning_effort onto the thinking level, with minimal folded into low. It also says the two "overlap functionality, so they can't be used at the same time": send one or the other.

The 400 errors, by symptom

Each of these is documented by Google for Neon. AIHubMix's own error notes say that 400s are parameter errors and "most are passed through from the upstream provider". No live test was run for this post, so the exact text you get through the gateway may differ.

Requests that worked on Gemini 3 now return 400

Neon only accepts the four named levels. Google's model page: "Setting thinking_budget or thinking_level="MINIMAL" returns an HTTP 400 validation error." Its own code diff flags the old field: thinking_budget=16384, # Returns HTTP 400 instead of mapping silently.

This native request, with the old thinkingBudget field, is one Google documents as a 400. The path follows the pattern AIHubMix documents for other Gemini models; Neon's own listing shows only the Chat Completions example.

curl -s "https://aihubmix.com/gemini/v1beta/models/gemini-4-neon:generateContent" \
  -H "x-goog-api-key: $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"role": "user", "parts": [{"text": "Reply with OK."}]}],
    "generationConfig": {"thinkingConfig": {"thinkingBudget": 16384}}
  }'
Enter fullscreen mode Exit fullscreen mode

Fix: delete thinking_budget and replace MINIMAL with LOW. On the OpenAI-compatible path, Google maps reasoning_effort="minimal" to low, but sending low yourself removes the question.

A penalty or a second candidate returns 400

Google: "Passing frequency_penalty, presence_penalty, or candidate_count greater than 1 (candidateCount is fixed at 1) returns an HTTP 400 error." This request is documented to fail for that reason:

curl -s https://aihubmix.com/v1/chat/completions \
  -H "Authorization: Bearer $AIHUBMIX_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-4-neon",
    "frequency_penalty": 0.5,
    "messages": [{"role": "user", "content": "Reply with OK."}]
  }'
Enter fullscreen mode Exit fullscreen mode

Fix: remove both penalties, and leave candidate_count at 1 or omit it. On Chat Completions, don't send n above 1 either: Google doesn't state what the compatibility layer does with it, and AIHubMix's schema marks it as a field not to send.

A later step of a tool-calling turn returns 400

Neon validates the thought signature attached to function calls in the current turn. "Omitting thought_signature from the first functionCall part in the active turn returns an HTTP 400 error. Duplicating the signature onto sibling functionCall parts or interleaving turns also returns an HTTP 400 error."

Google's thought-signatures guide shows the message form for Gemini 3 models: "Function call <Function Call> in the <index of contents array> content block is missing a thought_signature." Neon's guide states the 400 but not its wording.

Fix: send the model's turns back exactly as you received them. With parallel calls, only the first call carries a signature. Keep all the calls in one model turn and all the results in one user turn, in the same order. In Google's example, when the model returns "FC1 + signature, FC2", the expected next request contains "FC1 + signature, FC2, FR1, FR2". Interleaving them as "FC1 + signature, FR1, FC2, FR2" returns a 400.

A temperature or top_p outside its range returns 400

Google ignores in-range values but still validates them: "Out-of-range values return a 400 validation error." Fix: remove the sampling parameters altogether, since in-range values do nothing either.

max_output_tokens above 1,048,576 returns 400

Input and output share one 1,048,576-token window, so a larger output budget is invalid. On AIHubMix, send at most 65,536; the 1,048,576 ceiling matters only for long decode on Google's own API.

The silent change: high is the default

Google is direct about it: "The default thinking_level is HIGH (changed from MEDIUM on gemini-4-argon and gemini-3.8-flash), and XHIGH is supported for deep reasoning tasks …" The fix is just as direct: "If your workload relied on MEDIUM as the default on gemini-4-argon or gemini-3.8-flash, explicitly set thinking_level="MEDIUM" to keep equivalent reasoning latency."

What the extra level costs, from Artificial Analysis's measurements of Google's API (re-checked 2026-11-19, 13:27 UTC; third-party, and they change as AA re-runs models):

Neon setting AA Index $/task Min/task First answer (s)
Medium 54.9 1.90 8.3 20.1
High (default) 59.6 3.74 14.8 40.6
Xhigh 61.4 6.44 21.5 56.5

AA's averages per Intelligence Index task, at Neon's $3/$15. "First answer" is the time to the first answer token.

Leaving the default in place buys 4.8 points on the index over medium, for almost twice the cost per task, 1.8 times the time per task and twice the wait for the first answer token. xhigh adds 1.8 points for another 72% in cost: a good trade for hard multi-step work and a bad one for a chat reply.

From Argon, the same data is good news. Neon Medium scores 54.9 against 47.6 for Argon's default Medium, at $1.90 per task against $4.31, in 8.3 minutes against 28.9. That raises quality and lowers cost per task even before Argon's price doubles. Even Neon's default High ($3.74, 14.8 minutes) costs less per task than Argon Medium on AA's tasks. What you give up by not setting a level is the cheaper Medium option.

Thinking also counts against your output cap. Google: "Reasoning tokens generated at HIGH (default) and XHIGH count toward max_output_tokens and accumulate in multi-turn context when you preserve thought signatures across turns." In multi-turn coding agents those thinking tokens build up and fill the context faster. Google warns against "overly low context-compaction thresholds" and suggests medium on latency-sensitive tool turns.

Accepted, ignored or unsupported

temperature 0 no longer makes output repeatable

Google fixes Neon's sampling at temperature 1.0, topP 0.95 and topK 64, and ignores custom values, with no error to tell you so. Google's advice: "Control reasoning depth with thinking_level, and output format with response_schema." Use structured output where you need a fixed format.

Explicit cache code has no equivalent

cachedContents, caches.create and cached_content aren't supported. Google doesn't say whether a request that still sends them fails or is ignored, so remove them rather than finding out. Caching on Neon is implicit only. It applies automatically to a shared prompt prefix of at least 4,096 tokens (3.8 Flash needed 6,144), and cached input costs $0.15 per million tokens instead of $3.00. Put the static part of the prompt first: system instructions, tool definitions, reference documents.

The response ends before the answer starts

An app tuned for an older model often sends max_tokens of 8,192 or less. On Neon, thinking and the answer share that budget, so a low cap can end the response before the answer starts. Google's guidance is to "remove hardcoded low caps (such as 8,192) or raise max_output_tokens to 65,536. To use fewer tokens, lower the thinking level instead."

The client times out

Google: "Hard prompts can take several minutes. Use background execution, or set HTTP client timeouts to at least 15 minutes." On AA's averages, Neon High waits 40.6 seconds for its first answer token, and Xhigh 56.5. Some requests will take far longer than the average.

Prefilled assistant turns aren't supported

Neon's history rules: "History payloads can't end with a model role turn." "Prefilled model turns aren't supported." Code that seeds the assistant's reply to steer the format, a common trick with Anthropic's API, has to stop doing that. Google lists these under chat validation without stating the response, and AIHubMix's schema notes that a final model turn returns an error. Test it if your code relies on prefill.

Tool calls written as text can return MALFORMED_FUNCTION_CALL

If the system prompt asks the model to write JSON tool calls as plain text, with no tools declared, Google says Neon "can return MALFORMED_FUNCTION_CALL". Declare tools natively, or use structured output.

Output is 65,536 tokens per request on AIHubMix

On Google's own API, Neon's single response is capped at 65,536 output tokens, streaming or not. Longer answers use long decode: generation continues in 64K segments up to 1,048,576 tokens minus the input, through the Interactions API or GenerateContent v1beta1. Google's SDKs can handle the continuation tokens automatically from Python google-genai 2.34.0 and JavaScript @google/genai 2.32.0 for the Interactions API. Google also says that "earlier SDK versions and the OpenAI compatibility layer can't retrieve long completions using continuation tokens."

AIHubMix's parameter schema for gemini-4-neon caps output at 65,536 tokens on every protocol it serves: Chat Completions, Responses, Anthropic Messages and native Gemini. The schema also lists Google's continuationToken field on the native Gemini protocol, and AIHubMix documents Google's native SDK and the Interactions API in general. Long decode for Neon through that path wasn't tested for this post. Until you've confirmed it works, design for one response of at most 65,536 tokens including thinking. If you need more, split the task yourself, for example one file or one section per request.

Billing rules that change the number

Neon's $15 per million output tokens includes thinking tokens, and at high most of a hard request's output can be thinking. Watch completion_tokens in usage: it counts thinking as well as the visible answer.

Grounding bills twice. Google counts "internal tool system instructions and function declarations when using grounding" as billable tokens, and charges each search query separately. Google's own quota is 5,000 free searches a month, shared across Gemini 3 and newer, then $14 per 1,000. AIHubMix bills web search per request; its Neon model page lists the rate.

The 95% cache discount only applies to a stable prefix of at least 4,096 tokens. A timestamp or user name at the top of the system prompt breaks it on every request.

Long decode re-bills input, on Google's API only: "Each continuation segment re-prefills the prompt plus previously decoded tokens," so input counts grow from segment to segment, and "Completed segments are billed at the end of each segment even if a later segment fails or is canceled." Through AIHubMix's 65,536-token cap this doesn't arise.

Google sells Neon Batch and Flex at $1.50/$7.50 and Priority at $5.40/$27. AIHubMix's schema accepts a service_tier of flex or priority for Neon but publishes no price for those tiers, and Batch isn't listed. Budget at the standard $3/$15.

To lower the bill, set reasoning_effort per call type (medium for interactive and tool turns, high for planning, xhigh only where your own evaluations show it pays), keep the static prompt prefix first and longer than 4,096 tokens, and use web search only on turns that need it.

Tool-calling agents with real permissions

Neon's tool-calling rules are strict, and they matter most where the agent can write files or run commands.

  • Match calls and results: "Each FunctionResponse must match the id, name, and order of the preceding FunctionCall."
  • Keep the full history, signatures included. Google: "Pass back every thought_signature inside its original Part across all previous turns …" Stripping old signatures, or using placeholders such as skip_thought_signature_validator, "drops reasoning context and can trigger MALFORMED_FUNCTION_CALL."
  • On Chat Completions, keep each assistant message, with its tool calls, exactly as the API returned it, and don't rebuild history from your own logs. Google documents thought-signature support on its OpenAI-compatible chat completions for Gemini 3 models; check that your client keeps them for Neon.
  • Treat an empty turn as a failure. A malformed function call ends the turn without a usable answer. Open-source proxies have reported this case reaching OpenAI-style clients as an ordinary stop or as a server error: LiteLLM pull request 52745 and Divyam issue 60 on GitHub, both opened in November 2026. If your agent sees an empty turn with no tool call, retry it instead of ending the task.

Google says Neon "reduces redundant file reads, handles context compaction reliably, and minimizes fabricated claims and task shortcuts", and that it cuts "agentic overreach and under-service". These are Google's claims, from its own evaluations. They lower the risk; they don't replace permission limits and review on writes.

Claude Code and Codex

AIHubMix's parameter schema lists four protocols for gemini-4-neon, including the two coding agents need: Anthropic Messages for Claude Code and the Responses API for Codex. Setup is the same as for any AIHubMix model; the Claude Code settings post and the Codex config.toml post cover it.

Setting Claude Code Codex
Protocol Anthropic Messages Responses API
Model ID gemini-4-neon gemini-4-neon
Effort values low to xhigh low to xhigh
Context window 1,048,576 1,048,576
Output per request 65,536 65,536

Effort values and limits are from AIHubMix's parameter schema; the default effort is high on both protocols.

For Claude Code, set ANTHROPIC_MODEL to gemini-4-neon and raise API_TIMEOUT_MS: its default is 10 minutes, and Google recommends at least 15 for hard prompts. Don't add assistant prefill to custom requests through the same endpoint; Neon doesn't support it.

For Codex, keep wire_api = "responses" and the AIHubMix base_url, set model = "gemini-4-neon", and pick model_reasoning_effort from Neon's levels. Start with medium; Codex runs many short tool turns, where high mostly adds waiting time.

Expect long first tokens at high and xhigh, responses that stop at the 65,536-token cap when thinking runs long, empty turns where a tool call failed, and a March 2026 knowledge cutoff, so library versions newer than that need to be in context.

A smoke test takes 10–15 minutes:

  1. Pick a small repository with one failing unit test and a test command that runs in under a minute.
  2. Point the tool at gemini-4-neon, set effort to medium and the client timeout to at least 15 minutes.
  3. Ask for the smallest change that makes the test pass. Then run the test and read the diff.
  4. Pass: a minimal diff, the test green, inside 15 minutes. Fail: note whether you got a 400, an empty turn, a timeout or a bad edit. Each has a fix above.
  5. Repeat at high. Keep the lower level unless high fixes something medium got wrong.

What this guide doesn't verify

None of the requests here was run for this post: the curl commands are request shapes, not recorded responses, and the error text through the gateway may differ from Google's. Google doesn't say how leftover explicit-cache fields or a prefilled final turn fail, or what the compatibility layer does with n above 1. Long decode through AIHubMix's native Gemini path is untested. The AA figures are a third-party snapshot from 2026-11-19 at 13:27 UTC, and Neon's behaviour in agent loops is described from Google's own evaluations.

Keep reading: the Gemini 4 Neon series

Sources

Top comments (0)