LLM temperature is a sampling setting that controls how random a language model's output is: low temperature makes the model pick the most likely next tokens, so answers are focused and consistent, while high temperature lets it choose less likely tokens, so answers are more varied and creative. As of October 2026, though, many of the newest models from Anthropic, Google and OpenAI no longer let you change it.
This guide explains how temperature works, what common values do, how it relates to top_p and top_k, and which models still accept it.
How does temperature work?
A language model writes one token at a time. At each step it scores every possible next token, and those scores become a probability distribution: one token might be very likely, a few plausible, thousands unlikely. The model then samples from that distribution. (New to tokens? Start with LLM tokens explained.)
Temperature reshapes the distribution before the pick:
- Lower temperature sharpens it, so the most likely tokens win even more often.
- Higher temperature flattens it, so less likely tokens get picked more often.
Anthropic's glossary describes the effect: "Higher temperatures lead to more creative and diverse outputs, allowing for multiple variations in phrasing and, in the case of fiction, variation in answers as well. Lower temperatures result in more conservative and deterministic outputs that stick to the most probable phrasing and answers."
OpenAI's Responses API reference gives concrete numbers: temperature runs "between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic."
What do different temperature values do?
Exact behavior varies by model, but the pattern is consistent across providers.
| Setting | Effect | Often used for (where supported) |
|---|---|---|
| Low (around 0 to 0.3) | Sticks to the most probable tokens | Code, data extraction, classification, factual Q&A |
| Default (often 1.0) | The model's standard balance | General chat, most agent work |
| High (above 1, where allowed) | Picks less likely tokens more often, so output varies more | Brainstorming, naming, varied fiction drafts |
Defaults differ. Anthropic's migration guide says requests without the parameter sample "including a temperature of 1.0." Google's Gemini API reference says "The default value varies by model" and that values "can range from [0.0, 2.0]," though newer Gemini models ignore the setting (see below).
Does temperature 0 make output deterministic?
No. This is a common misunderstanding about temperature. Anthropic's glossary is explicit: "Even with temperature set to 0, the results will not be fully deterministic, and identical inputs might produce different outputs across API calls. This applies both to Anthropic's first-party inference service and to inference through third-party cloud providers."
So if your system breaks when the model words something differently, temperature is the wrong fix. Validate the output instead: structured outputs or a schema, tests, or a parser that rejects bad responses.
What are top_p and top_k?
They are two other ways to limit which tokens the model can pick.
- top_p (nucleus sampling). OpenAI's reference calls it "An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered."
- top_k. Caps the number of candidate tokens. Google's reference explains: "Top-k sampling directly limits the maximum number of tokens to consider, while Nucleus sampling limits the number of tokens based on the cumulative probability."
OpenAI's advice for combining them: "We generally recommend altering this or top_p but not both."
Which models still let you set temperature?
This has changed recently. If you are reading an older tutorial that tells you to set temperature=0, check your model first.
| Provider | Current status (as of October 2026) |
|---|---|
| Anthropic (Claude) | Removed in API version 2026-10-21 for every model. On the older 2023-06-01 version, Claude 4.7 and later reject non-default values; older models such as Claude Sonnet 4.6 still accept them |
| Google (Gemini) | "Gemini 4 and Gemini 3.6+ models ignore custom values for temperature, top_p, and top_k and return deprecation warning headers" |
| OpenAI | Range 0 to 2 in the Responses API. For its GPT-6 models, "When reasoning effort is not none, remove temperature, top_p, and top_logprobs" |
The sources: Anthropic's API versions page states that in 2026-10-21 "The temperature, top_p, and top_k request parameters are removed. A request that sends any of them returns a 400 error on every model." Its model deprecations page gives the recommended replacement: "Omit and use prompting to guide model behavior." Google's note is on the Gemini text generation page, which adds: "Remove these sampling parameters from your requests." Google's API reference words it differently, saying each of these fields "is no longer supported and is silently ignored on Gemini 3.6 Flash and newer models." OpenAI's guidance is in its Using GPT-6 guide, which also notes that GPT-6 Astra and GPT-6.1 Sol do not support none, so on those two models the sampling parameters always have to go.
Anthropic's migration guide is candid about the trade-off for older models: on a model like Claude Sonnet 4.6, "a request that lowered temperature for more consistent output loses that effect. No other setting replaces it." You can keep such a request on the older API version if it truly depends on a non-default value.
How do you get consistent output without temperature?
When temperature is fixed, consistency comes from the prompt and from checks around the model:
- Write precise instructions. Say exactly what format you want and what to do in edge cases. A clear system prompt does more for consistency than a sampling knob.
- Show examples. Anthropic's prompting guide calls examples "one of the most reliable ways to steer Claude's output format, tone, and structure."
- Constrain the format. Use structured outputs or strict tool schemas when you need machine-readable results.
- Ground the answer. For factual questions, give the model the source text instead of hoping it remembers. See what is RAG.
- Verify. Run tests, linters or validators on what the model produces, especially for code.
What about temperature in coding agents?
When you use a coding agent, the controls you get are the model, your instructions and, on reasoning models, an effort level. Effort is not a temperature replacement: Anthropic's Claude Code model docs say effort levels "control adaptive reasoning, which lets the model decide whether and how much to think on each step based on task complexity."
- In Claude Code, run
/effortor launch with--effort. Our Claude Code models guide covers the levels. - In Codex, set
model_reasoning_effortinconfig.toml; see Codex config. - For consistent behavior across sessions, put your conventions in CLAUDE.md or AGENTS.md.
Where do tuned prompts go once they work?
With temperature off the table on many models, the prompt is the main lever, and a prompt that reliably produces the output you want is worth keeping. Kipt stores prompts and Agent Skills as Markdown in a private GitHub repo you own, with {{name:default}} blanks for the parts that change, so the tested version is the one you reuse. For starting points, browse our system prompt examples.
What should you read next?
Temperature acts on tokens, so LLM tokens explained is the natural companion. For the instructions that now do most of the steering, read what is a system prompt. And for a wider view of what shapes model output, see context engineering.