Sub topic 3
What a reasoning model is
This chapter assumes you have called an LLM API from code, know what tokens, context windows and max output tokens are, and can read Python. It defines the term "reasoning model" and shows how to spot one in an API response.
The short definition
A reasoning model is a language model trained to produce a long internal chain of thought before it writes its final answer. A chain of thought is a sequence of intermediate steps, such as restating the problem, trying an approach, checking it and correcting mistakes. A standard chat model starts writing the answer immediately. A reasoning model first writes a block of working text, then writes the answer.
Two ideas explain why this helps:
- Step-by-step text improves accuracy. A model produces one token at a time, and each token can depend on the tokens before it. Intermediate steps give later tokens something to build on.
- Test-time compute. Compute spent while answering, as opposed to while training, can improve results. More thinking tokens means more computation applied to the question.
How it differs from a standard chat model
You can prompt a standard model with "think step by step" and get a visible chain of thought. A reasoning model differs in three ways.
- Training. It is trained, often with reinforcement learning, to produce useful reasoning on its own. The behavior is built in, not requested by your prompt.
- Length. Its reasoning can run to thousands of tokens, far more than a typical step-by-step answer.
- Packaging. The provider usually keeps the raw reasoning out of the visible reply. You may get a summary, a separate thinking block, or nothing.
Seeing it in an API response
The clearest sign of a reasoning model is the usage data. The response reports how many output tokens were spent on reasoning. This example uses the OpenAI Responses API.
from openai import OpenAI
client = OpenAI()
response = client.responses.create(
model="o4-mini",
reasoning={"effort": "low"},
input="A train leaves at 14:10 and arrives at 17:45. How long is the trip?",
)
print(response.output_text)
print("reasoning tokens:", response.usage.output_tokens_details.reasoning_tokens)
print("total output tokens:", response.usage.output_tokens)The final answer is only a few words, but the total output token count is higher. The difference is reasoning you never see in output_text. A standard chat model reports zero reasoning tokens.
The next chapter covers these tokens in detail, including how they are billed. For now, remember that they exist, they count as output, and the model writes them before the answer.
Common misconceptions
- "A reasoning model is just a bigger model." Size is not the defining trait. The defining trait is the trained habit of reasoning before answering.
- "I can read the full reasoning." Often you cannot. Providers may return only a summary, or the reasoning may be encrypted or withheld.
- "It is always better." Reasoning adds latency and cost. For simple lookups, rewrites or classification, a standard model is often as accurate and much faster.
- "The reasoning is free." It is billed as output tokens even when hidden.
Where reasoning models help
Reasoning pays off when the answer requires several dependent steps. Typical cases are multi-step math, code debugging, planning with constraints, and questions where you must weigh conflicting evidence. It pays off little for tasks where the answer is a direct recall or a surface transformation.
| Task | Likely benefit from reasoning |
|---|---|
| Translate a sentence | Low |
| Extract a date from an email | Low |
| Find the bug in a 40-line function | High |
| Schedule meetings under several constraints | High |
Exercise
You call a model and the response shows 40 output tokens in the visible answer, but the usage data reports 1,240 total output tokens. What is the most likely explanation, and what does it imply for a standard chat model?
Show answer
The model is a reasoning model, and about 1,200 of the output tokens were hidden reasoning tokens written before the answer. A standard chat model would not report reasoning tokens, so its total output tokens would roughly equal the visible answer length.