Temperature is gone: what replaced sampling knobs on the models agents use
Claude, GPT-6.2 and Gemini 4 now reject or ignore temperature, top_p and top_k, and OpenAI's newest models drop logprobs too. Here's what each API does with those fields today and what to use in your agent instead.
Some links are affiliate links; we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases. Disclosure
For years the first line of every agent config was temperature: 0. You set it, you felt responsible, and you moved on. On the frontier models of late 2026 that line does one of three things. It returns a 400 error, it gets silently ignored, or it still works only because you picked a cheap model with reasoning switched off. Which one you get depends on the provider, the model and, on Claude, the API version header you send.
Agents feel this a lot more than chat apps do. An agent fires dozens of requests per task, often across two or three providers with a fallback path. One stale sampling field in a shared request builder can break every turn on one model while doing nothing at all on another. Here's where each API stands in November 2026, and what to lean on now that the knob is gone.
Claude: a hard 400, and soon on every model
Anthropic went furthest. The extended thinking docs list the models where non-default temperature, top_p or top_k values return a 400 error on every request, whether thinking is on or not. That list covers everything current: Claude Fable 5.2, Fable 5.1, Fable 5, Opus 5.5, Opus 5, Opus 4.8, Opus 4.7, Sonnet 5.5, Sonnet 5 and Haiku 5.5, plus the Mythos models.
There's a trap hiding in the same paragraph. On those models the top_p default is 0.99, not 1. So a request with top_p: 1, which plenty of codebases send to mean "leave it alone," gets rejected. A request that includes both temperature and top_p also fails, even when both are set to their defaults.
Then the API version header closes the door completely. Per the 2026-10-21 migration notes, a request on that version that sends temperature, top_p or top_k returns a 400 even at the parameter's default value, and that applies to Message Batch requests too. The thinking docs spell out that this goes for every model on that version. Older models on older API versions keep the old rule: the restriction only kicks in while thinking is on, temperature and top_k don't mix with thinking, and top_p is allowed between 0.95 and 1.
The migration guides don't give you a replacement knob. The Claude Haiku 5.5 guide just says to omit the three fields and "use prompting to guide the model's behavior instead." The Sonnet 5.5 guide shows a sample request that deliberately leaves out five settings that 400 on that model: thinking budgets, sampling parameters, assistant prefill, forced tool choice and thinking: {"type": "disabled"}. If your agent used prefill to force JSON, that's gone on Haiku 5.5 too, even with thinking off. The Haiku guide points you to structured outputs or tools with enum fields for classification.
OpenAI: gone on reasoning, alive on the cheap tier
OpenAI's Responses API reference still documents temperature (0 to 2, default 1) and top_p (default 1), with the old advice to change one or the other but not both. The model guides tell you when you can't send them at all.
For the newest family, the GPT-6.2 guide says to omit temperature, top_p and top_logprobs on Responses requests to GPT-6.2 Astra and GPT-6.2 Sol, and to drop message.output_text.logprobs from include. On Chat Completions you also lose logprobs. The same guide says that if you currently run reasoning effort none or minimal, you should use low instead. So there's no effort setting on these two where the sampling fields come back.
The GPT-6 guide is the one with an escape hatch. The rule there is to remove temperature, top_p and top_logprobs "when reasoning effort is not none." GPT-6 Astra and GPT-6.1 Sol don't support none. GPT-6.1 Terra, GPT-6 Sol and GPT-6 Luna do. If some step in your agent really needs sampling control or token logprobs, say a classifier that thresholds on log probability, your options are basically Terra at $1/$5 per million input/output tokens or Luna at $0.10/$0.50, running with reasoning off. Those are the list prices on our model list. That's a perfectly fine home for a cheap routing or tagging step. It's a bad reason to keep your planner on an older model.
Gemini: silently ignored, which is the sneaky one
Google took the quiet route, and it's honestly the one most likely to bite you. Starting with Gemini 3.6 Flash and 3.5 Flash-Lite, the Gemini 3.6 migration page says temperature, top_p and top_k are deprecated and ignored, and that "future model generations" will return a 400. candidate_count is unsupported in Gemini 3 and later, and a request whose last turn is a prefilled model turn gets a 400. Google's advice for determinism is a system instruction with explicit rules for your use case.
Gemini 4 is that next generation, sort of. The Gemini 4 Neon migration notes say to remove all three fields. In-range values are ignored, and out-of-range values return a 400 validation error. The Gemini 3.8 Flash notes carry the same removal item forward.
Here's why the silent version is worse than a 400. Say you wrote an eval suite last year against a Gemini 2.x model with temperature: 0 and treated flaky results as a bug. Run that suite on Gemini 4 Neon ($3/$15 per million) and the temperature line is still sitting in the config, still looking like it does something. It doesn't. Run-to-run variation is just how the model behaves now, and your config file is lying to whoever reads it next.
What actually gives you consistency now
Honestly, that dial was always weaker than people treated it. Low temperature never made a model right. It made it repeat itself. What an agent actually needs is output your code can parse and tool calls that hold up on a rerun, and the current APIs have better ways to get both.
Shape comes from schemas. All three providers have structured outputs, and Gemini 4 Neon's notes go further. They tell you not to prompt the model to write raw-text JSON tool calls with no tools declared, because that can come back as MALFORMED_FUNCTION_CALL. Declare tools natively or use structured output. If you haven't moved your parsing onto schemas yet, our structured outputs guide covers how each API handles it. For classification, an enum field in a tool schema replaces the old "temperature 0 and pray it says YES" trick, and it's what the Haiku 5.5 guide recommends anyway.
The knobs you do have left are effort and the prompt. Reasoning effort on OpenAI, effort on Claude and thinking_level on Gemini are the dials the providers actually want you to turn, and they move quality and cost a lot more than temperature ever did. We went through the tradeoffs in reasoning models in agent loops. For behavior, write the rules down. "Reply with one of these four labels" in the system prompt or developer message does more than any sampling value.
Evals need to stop assuming determinism. If a test only passes when the model gives the same answer twice, it was always fragile, and now there's no setting to hide that. Run each case a few times and score the pass rate, and check structure and tool arguments rather than exact strings. The tool-call evaluation post has a setup for that. If you need a deeper grounding in why sampled outputs vary and how to evaluate them anyway, AI Engineering by Chip Huyen covers sampling and evaluation in a way that still holds up.
Clean up the request builder this week
The practical fix is boring and takes an afternoon. Find every place your agent builds a model request and move sampling fields into a per-model capability table instead of a shared default. For Claude models on the lists above, and for anything on API version 2026-10-21, send none of the three. For GPT-6.2 Astra and Sol, drop temperature, top_p, top_logprobs and the logprobs include. For GPT-6.1 Terra, GPT-6 Sol and GPT-6 Luna, only send them alongside reasoning effort none. For Gemini 3.6 and later, strip them even though the API won't complain yet, because Google has already said a later generation will.
Do the same audit for prefill, since Claude Haiku 5.5, Sonnet 5.5 and recent Gemini models reject a trailing assistant or model turn. Then add one test that sends your real request payload to each model you route to and fails on a 400. When you bump a model ID, which we covered in model IDs, aliases and deprecations, that test catches the field that used to be harmless and now isn't. Better to hear it from a test than from your fallback path in the middle of the night.