
For years, two small numbers controlled how wild or safe an LLM answer felt. Temperature set the randomness. Top-p trimmed the candidate pool. You set them once in your API call and forgot about them. That era is ending. Anthropic now rejects requests that include them. Google ignores them on its newest models. OpenAI still honors both, and local open-source stacks never stopped. If your code sends sampling parameters to more than one provider, the same payload now behaves three different ways.
Stop sending temperature, top-p, and top-k to Claude and Gemini. Anthropic returns a 400 error for any of the three at API version 2026-10-21, even at default values. Google ignores them on Gemini 3.6 and newer, and plans to return an error in future model generations. OpenAI still documents both knobs with defaults of 1, so code aimed at OpenAI keeps working as before. Local Hugging Face serving keeps the knobs fully alive, with temperature defaulting to 1.0 and top-k to 50. I verified each claim against the official docs before writing this, and the links sit in the sections below.
Do this now if you ship to more than one provider:
Temperature scales the logits before the model picks its next token. A low value sharpens the distribution, so the top token wins by a wide margin. A high value flattens it, so lower-ranked tokens get a real shot. At 0, the model picks the single most likely token at each step, which people call greedy decoding. At 1.0, the model samples from its training distribution. OpenAI allows values up to 2, where output turns loose and often incoherent.
Teams reach for temperature 0 when they want deterministic output. That instinct has a flaw. Greedy decoding is not reproducibility. Batching, hardware, and floating-point differences across runs can still shift tokens, and providers update the model behind the same name. Temperature 0 narrows the variance, it does not erase it. If your pipeline needs the same answer twice, record the exact model version and test the full path, not just the parameter.
Temperature also carries a cost in quality that is easy to miss. Push it past 1.2 on most models and the text drifts: facts blur, lists repeat, tone wobbles. Keep it near 0.7 for drafting and near 0.2 for extraction or classification, and you stay inside the range where the model behaves. I keep temperature at 1.0 when I compare providers, because 1.0 is the shared default and it shows what each model does with no thumb on the scale.
Top-p, also called nucleus sampling, works on the probability mass instead of the temperature curve. The model sorts tokens by probability, then keeps the smallest set whose combined probability reaches p. Set p to 0.1 and the model draws from tokens that cover the top 10 percent of probability mass. Set p to 0.9 and the pool widens to cover 90 percent. The cutoff moves with the shape of the distribution, which is the whole point: a confident step gets a tight pool, an uncertain step gets a wide one.
Top-k is the simpler cousin. It keeps a fixed count of the highest-probability tokens, whatever their mass. Hugging Face defaults to top-k 50. Top-p adapts to the distribution, top-k does not, and that difference decides which one fits a given task. Short factual answers want a tight pool either way. Open-ended drafting benefits from top-p, because the pool expands exactly where the model is unsure.
OpenAI documents a rule that trips up new users: change temperature or top-p, not both. The two knobs push on the same distribution from different angles, and stacking them makes the result hard to reason about. Pick one. If you already tune temperature for a task, leave top-p at its default of 1. If you tune top-p, leave temperature at 1.
Thinking and reasoning models changed the math. These models spend tokens on internal reasoning before they answer, and the provider controls that process end to end. A user-supplied temperature would fight the fixed decoding the reasoning pass needs, so providers moved the controls server-side. Anthropic states the shift plainly in its migration guide for API version 2026-10-21: a request that sends temperature, top_p, or top_k returns a 400 error, even at the parameter’s default value. Remove the three parameters from your requests and the request samples at their defaults, including a temperature of 1.0.
Watermarking adds a second pressure. Anthropic notes that non-default sampling can strip the watermark from model output, which breaks detection downstream. Providers that watermark output need control over the sampling path, and the cleanest way to keep it is to stop accepting user-supplied values. Google took the softer path first: Gemini 4 and Gemini 3.6 and newer models ignore custom values for temperature, top_p, and top_k and return deprecation warning headers, with an error promised in future model generations.
The pattern is consistent across providers even though the failure mode differs. Anthropic errors today. Google ignores today and errors later. OpenAI still accepts both. The direction of travel is clear: sampling control is becoming a provider decision, and client code that assumes otherwise will break at the next version bump. Pin your API version, read the migration guide before you upgrade, and treat any sampling parameter in your payload as a liability on Claude and Gemini.
The table below summarizes the current state. Treat it as a snapshot: providers change these rules with model releases, so check the linked docs before you ship.
| Provider and API | Temperature | Top-P | Top-K | If you send them |
|---|---|---|---|---|
| OpenAI Chat Completions | Default 1, range 0 to 2 | Default 1 | Not documented | Honored |
| OpenAI Responses API | Default 1, range 0 to 2 | Default 1 | Not documented | Honored |
| Anthropic, API before 2026-10-21 | Accepted | Accepted | Accepted | Honored on older models such as Claude Sonnet 4.6 |
| Anthropic, API 2026-10-21 and later | Removed | Removed | Removed | HTTP 400, even at default values |
| Google Gemini up to 3.5 | Accepted | Accepted | Accepted | Honored |
| Google Gemini 3.6 and 4 | Deprecated | Deprecated | Deprecated | Ignored, with deprecation warning headers; error in future generations |
| Hugging Face local serving | Default 1.0 | Available | Default 50 | Honored, full control stays with you |
Two details in the table deserve a second look. First, Anthropic’s newest Claude models use a top-p default of 0.99, so sending top_p of 1 alone returns a 400 error on those models, and sending both temperature and top_p together returns a 400 even at their defaults. Second, Google’s own pages describe the Gemini behavior in slightly different words: one page says the parameters are silently ignored, another says the API returns deprecation warning headers. I checked the release notes page and it confirms the warning headers, so treat the ignore as loud, not silent.
The knobs are leaving, but the jobs they did are not. Each task has a replacement that works better than a sampling tweak, and most of them sit on the provider side already.
Structured output is the replacement for low temperature in extraction work. When you need JSON that parses, enforce a schema instead of cooling the sampler. Schema enforcement gives you a guarantee where temperature 0 gives you a hope. Our comparison of schema enforcement instead of sampling across OpenAI, Anthropic, and Google shows how each provider implements it.
Creative drafting does not need a hotter sampler. It needs better inputs: a sharper prompt, a different model, or a second pass that revises the first draft. Vary the prompt and keep the model at its default, and the output changes in ways you can trace. Vary the temperature and the output changes in ways you cannot. If you run evals, freeze the prompt and the model version first, then change one input at a time. Our guide to evals that catch real failures covers the harness setup that makes this practical.
Cost control has a cleaner lever than sampling too. Prompt caching cuts the bill on repeated prefixes without touching output quality, and it works on all three providers. Pair it with versioning your prompts like code so a provider change shows up as a diff in your test results instead of a mystery in production. Add tracing your production AI requests and orphaned sampling parameters surface in your logs before they surface as 400 errors in your users’ faces.
Local and open-source serving is the exception that proves the rule. On a Hugging Face stack you own the generation config, so temperature 1.0 and top-k 50 stay yours to tune. Start there, change one knob at a time, and log the values with each eval run. That discipline matters more now, because the gap between local control and provider control keeps widening.
Temperature and top-p are not dead. They are leaving the client. OpenAI still honors them, Hugging Face still hands you the keys, and Claude and Gemini have taken them back. The split will widen with each model release, so code that sends the same payload to every provider is already living on borrowed time.
Audit your SDK payloads this week. Strip the three sampling parameters from Claude and Gemini calls, pin your API versions, and re-run evals after every provider upgrade. Then tell me in the comments: which provider broke your temperature setting first?