Kipt

LLM temperature: what it does and why newer models drop it

LLM temperature explained: how it changes randomness in output, temperature 0 vs 1, top_p and top_k, and why newer Claude, Gemini and OpenAI models drop it.

By the Kipt team · Updated 24 October 2026

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:

  1. 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.
  2. Show examples. Anthropic's prompting guide calls examples "one of the most reliable ways to steer Claude's output format, tone, and structure."
  3. Constrain the format. Use structured outputs or strict tool schemas when you need machine-readable results.
  4. Ground the answer. For factual questions, give the model the source text instead of hoping it remembers. See what is RAG.
  5. 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."

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.

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.

Questions

What is temperature in an LLM?

Temperature is a sampling setting that controls how random a model's word choices are. Lower values make the model stick to the most likely tokens, giving more focused and repeatable output. Higher values let it pick less likely tokens, giving more varied and surprising output.

What does temperature 0 mean?

Temperature 0 tells the model to favor the most probable tokens as strongly as possible. It makes output more consistent, but not fully deterministic. Anthropic's glossary says that even with temperature set to 0, identical inputs might produce different outputs across API calls.

What is a good temperature for coding?

On models that still accept the setting, lower values are a common choice for code, extraction and classification, where you want the most likely answer. OpenAI's reference gives 0.2 as an example of a value that makes output more focused and deterministic. On many newer models you cannot change it at all, so the question moves to prompting and effort settings.

Can I still set temperature on Claude?

Mostly no. Anthropic's API version 2026-10-21 removed temperature, top_p and top_k, and sending them returns a 400 error on every model. On the older 2023-06-01 version, Claude 4.7 and later models reject non-default values, while older models such as Claude Sonnet 4.6 still accept them.

What is the difference between temperature and top_p?

Both shape how the next token is picked. Temperature changes how spread out the probabilities are. Top_p, also called nucleus sampling, only considers the smallest set of tokens whose combined probability reaches the value you set. OpenAI recommends changing one or the other, not both.

Do coding agents let you change temperature?

The controls coding agents expose are the model, your instructions and, on reasoning models, an effort level. In Claude Code you change effort with /effort, and in Codex with model_reasoning_effort in config.toml. Effort controls how much the model reasons, not how random its word choice is.

More in Learn

All guides

Keep your prompts and skills in one place, in your own GitHub. Install every skill with one command.

Get started

Kipt is an independent product, not affiliated with or endorsed by Anthropic, OpenAI, Cursor or GitHub. Claude, ChatGPT, Codex, Cursor and GitHub are trademarks of their owners.