LLM temperature: what it does and why the newest models ignore it
ExplainerBy Lucas Matías García TorresUpdated Data checked 4 min read
Reviewed by Lucas Matías García Torres on . How we work.

Short answer
LLM temperature controls how random a model is when it picks each next token. On October 23, 2026 OpenAI accepts values from 0 to 2 but asks you to remove it on GPT-6 models when reasoning, Anthropic's API version 2026-10-21 rejects temperature, top_p and top_k with a 400 error, and Google recommends keeping Gemini 3 at 1.0. Ollama defaults to 0.8. Temperature 0 never guaranteed identical outputs; use structured outputs, prompting or a fixed seed instead.
Prices and limits change often: check the vendor's page before you pay. How we make money.
LLM temperature is the setting that controls how random a language model is when it picks each next token: lower values make it stick to the most likely words, higher values make it more varied. For years it was the first knob developers turned. On October 23, 2026 that has changed: OpenAI's newest models reject it while they reason, Anthropic's API version of October 21, 2026 returns an error if you send it, and Google strongly recommends leaving Gemini 3 at the default. This guide explains what temperature does, what top_p and top_k add, which APIs still accept it and what to use instead, based on each vendor's documentation read on October 23, 2026.
How temperature works
A language model writes one token at a time. At each step it gives every possible next token a probability, and a sampling step picks one. Temperature reshapes those probabilities before the pick. Google's documentation puts it simply: lower temperatures suit prompts that need a more deterministic, less open-ended answer, higher temperatures can give more diverse or creative results, and a temperature of 0 always selects the highest-probability token. OpenAI's API reference gives the same picture with numbers: values like 0.8 make the output more random, values like 0.2 make it more focused.
Two related settings filter the candidates before temperature does its work:
- top_k keeps only the k most likely tokens. A top_k of 1 always picks the single most likely token, which Google calls greedy decoding.
- top_p keeps the most likely tokens until their probabilities add up to p. Google's example: if tokens A, B and C have probabilities 0.3, 0.2 and 0.1 and top_p is 0.5, the model chooses between A and B and never C. Gemini's default top_p is 0.95.
OpenAI recommends changing temperature or top_p, but not both.
Which APIs still accept it
Table: temperature by API (official documentation, checked October 23, 2026)
| API | What the documentation says |
|---|---|
| OpenAI | between 0 and 2; with GPT-6 models, remove temperature and top_p when reasoning effort is not none |
| Anthropic (Claude) | removed in API version 2026-10-21: sending temperature, top_p or top_k returns a 400 error; Claude 4.7 and later already accepted only the defaults |
| Google (Gemini 3) | keep the default of 1.0; lowering it may cause looping or worse results on complex tasks |
| Ollama (local) | default 0.8, set with PARAMETER temperature or per request; a fixed seed repeats the same text for the same prompt |
The pattern is clear. Temperature still works in local tools and on models that answer without reasoning, but the vendors have moved away from it on their newest reasoning models, where the model spends tokens thinking before it answers. Google's Gemini 3 guide warns specifically that setting temperature below 1.0 can lead to looping or degraded performance in math and reasoning tasks, and recommends removing the parameter from code that sets it low.
Temperature 0 was never a guarantee
Many developers set temperature to 0 to get the same answer every time. Anthropic's migration guide for Claude Opus 5.5 is blunt about it: temperature 0 never guaranteed identical outputs, even on earlier models. A low temperature makes outputs more consistent, not identical.
If you need repeatable results, use the tool built for it. Locally, Ollama's seed parameter makes the model generate the same text for the same prompt. In the cloud, if what you need is a consistent format rather than identical wording, structured outputs force the answer to follow a schema regardless of temperature.
What to use instead
With temperature gone or fixed on the newest models, the vendors point to other levers:
- Prompting. Anthropic's guidance after removing sampling parameters is to use prompting to guide the model. Say how creative or how literal you want the answer to be, give an example of the tone and set limits on length. Our prompt engineering basics show how.
- Reasoning effort. OpenAI's reasoning effort and Anthropic's effort parameter control how much the model thinks before answering, which changes quality, speed and cost.
- Several candidates. For brainstorming, ask for five different options in one answer instead of raising the temperature.
- Validation. For extraction and classification, check the answer in your code. A lower temperature never stopped a model from hallucinating a confident wrong value.
Practical settings where you still can
On models and tools that still accept it, our rule of thumb is:
- 0 to 0.3 for extraction, classification and code that must follow rules.
- 0.7 to 1 for general chat and writing, close to most defaults.
- Above 1 only for brainstorming, and check the output, because it drifts quickly.
Change one setting at a time and test it on the same set of prompts. And before you tune temperature on a new model, check its documentation: on the newest models from OpenAI, Anthropic and Google, the best setting is usually the default.
What we checked
- Gemini prompting strategies: temperature controls the randomness of token selection; lower temperatures suit deterministic, less open-ended responses and higher ones give more diverse or creative results; temperature 0 always selects the highest-probability response; topK of 1 is greedy decoding; topP example with A 0.3, B 0.2, C 0.1 and topP 0.5 selecting A or B; default topP 0.95; keep temperature, top_p and top_k at defaults for Gemini 3.x models. (Google (Gemini API docs), )
- Gemini 3 developer guide: strongly recommends keeping temperature at the default 1.0 for all Gemini 3 models; setting it below 1.0 may cause looping or degraded performance in complex math or reasoning tasks; recommends removing explicit low temperature settings when migrating. (Google (Gemini API docs), )
- OpenAI Responses API reference: temperature between 0 and 2; values like 0.8 make output more random and values like 0.2 more focused and deterministic; top_p is nucleus sampling; OpenAI generally recommends altering temperature or top_p but not both. (OpenAI, )
- OpenAI Using GPT-6 guide: when reasoning effort is not none, remove temperature, top_p and top_logprobs. (OpenAI, )
- Anthropic Migrating to API version 2026-10-21: a request that sends temperature, top_p or top_k returns a 400 error even at the default value; without them requests sample with defaults including temperature 1.0; Claude 4.7 and later models already accepted only the defaults; on models such as Claude Sonnet 4.6 a lowered temperature loses its effect and no other setting replaces it. (Anthropic, )
- Claude Opus 5.5 migration guide: omit temperature, top_p and top_k; prompting is the recommended way to guide behavior; temperature 0 never guaranteed identical outputs on prior models. (Anthropic, )
- Ollama Modelfile: temperature default 0.8, higher answers more creatively; seed sets the random number seed so the same prompt generates the same text. (Ollama, )
What may change
- Which sampling parameters each API accepts is changing fast as vendors move to reasoning models. This page is reviewed quarterly.
- The temperature ranges in the last section are our own rule of thumb, not vendor recommendations.
Frequently asked questions
What does temperature do in an LLM?
It reshapes the probabilities of the possible next tokens before the model picks one. Low values make it choose the most likely tokens, so answers are more focused; high values make less likely tokens more common, so answers are more varied. A temperature of 0 always picks the most probable token.
What is the difference between temperature and top_p?
top_p first limits the candidates to the most likely tokens whose probabilities add up to p, and temperature then changes how the model chooses among them. OpenAI recommends changing one or the other, not both. Gemini's default top_p is 0.95.
Does temperature 0 make a model deterministic?
Not reliably. Anthropic says temperature 0 never guaranteed identical outputs, even on earlier models. It makes answers more consistent, not identical. For repeatable local results, Ollama's seed parameter repeats the same text for the same prompt.
Can I still set temperature on Claude?
Not on the latest API version. In version 2026-10-21, a request that sends temperature, top_p or top_k returns a 400 error, even at the default value, and Claude 4.7 and later models already accepted only the defaults. Anthropic recommends prompting instead.
What temperature should I use?
On the newest models from OpenAI, Anthropic and Google, use the default. On models that still accept it, our rule of thumb is 0 to 0.3 for extraction and classification, 0.7 to 1 for general writing and above 1 only for brainstorming.
Sources
- Prompt design strategies (Gemini API): temperature, topK, topP and stop sequences, Google (Gemini API docs). Accessed October 23, 2026.
- Gemini 3 developer guide: thinking level, temperature and migration notes, Google (Gemini API docs). Accessed October 23, 2026.
- Create a model response (OpenAI API reference): temperature and top_p, OpenAI. Accessed October 23, 2026.
- Using GPT-6 (OpenAI API guide): migration notes and unsupported parameters, OpenAI. Accessed October 23, 2026.
- Migrating to API version 2026-10-21: sampling parameters are removed, Anthropic. Accessed October 23, 2026.
- Claude Opus 5.5 migration guide: sampling parameters, prefill and thinking, Anthropic. Accessed October 23, 2026.
- Ollama Modelfile reference: PARAMETER values, temperature and seed defaults, Ollama. Accessed October 23, 2026.
Spotted an error or an outdated price? Tell us and we will fix it.
Change history
- : First published. Checked on October 23, 2026 against Google's Gemini prompting strategies and Gemini 3 guide, OpenAI's Responses API reference and GPT-6 guide, Anthropic's API version 2026-10-21 migration page and Claude Opus 5.5 migration guide, and Ollama's Modelfile reference.
Next review: .
Part of our Language Models Explained guide.
Keep reading
- What is a token in a language model?
What a token is in a language model, how many words it equals, why Spanish and French need more tokens than English (we measured it) and how they are billed.
- Reasoning models: what thinking tokens are and what they cost
What a reasoning model is: how thinking works in OpenAI, Claude, Gemini and DeepSeek, why you pay for reasoning you never see and how to control its depth.
- Structured outputs: getting valid JSON from a language model
How structured outputs force a model to return JSON that matches your schema in OpenAI, Claude, Gemini and Ollama, what JSON Schema they accept and the limits.
- Prompt engineering basics: nine techniques from OpenAI's and Anthropic's documentation
Prompt engineering basics from OpenAI's and Anthropic's docs: be clear, give context and roles, use examples, structure long prompts and test what you write.
- Model hallucinations: why they happen and how to reduce them
What model hallucinations are, why language models make things up (training and grading reward guessing), and the techniques Anthropic documents to reduce them.
- What is an LLM? How large language models work, in plain English
What is an LLM: how a large language model predicts tokens, how it is trained, the Transformer, what parameters mean, its limits and how it relates to chatbots.
Other topics

Assistants & Chatbots
16 guides

LLM APIs & Costs
11 guides

Agents & Automation
8 guides

Local Models & Hardware
11 guides