Reasoning models such as Qwen3, DeepSeek-R1 and gpt-oss “think” before they answer. That helps with maths, logic and code. It is a waste of time when all you need is a quick label or a short reply.
Ollama lets you control this with one setting, think. You can turn thinking on or off, pick a level like low or high on models that support levels, hide the reasoning in the terminal, or stream it into your own UI.
This guide covers every way to do it: the CLI, the REST API, Python, JavaScript and the OpenAI-compatible endpoint. It also explains how to check what a model supports and how to fix the common problems.
- CLI:
ollama run qwen3 --think=falseturns thinking off,--think=highpicks a level,--hidethinkinghides the trace. Inside a chat use/set thinkor/set nothink. - API: add
"think": true,falseor a level such as"low"to/api/chator/api/generate. - Output: the reasoning arrives in
message.thinkingand the answer inmessage.content(thinkingandresponseon generate). - Check support:
ollama show gpt-ossor/api/showlists the allowed values and the default. - gpt-oss cannot switch thinking off. It uses its lowest level (
low) instead.
New to Ollama? My Ollama guide covers install, models, commands and fixes in one place.
What Thinking Mode Is
A thinking model writes out its reasoning first and then gives the final answer. Older setups mixed both into one block of text, often wrapped in <think> tags that you had to strip out yourself.
Ollama now separates them. The reasoning goes into a thinking field and the answer into the normal content field. That gives you three easy options:
- Show it to debug or audit how the model reached an answer.
- Animate it in a chat UI, like the “Thinking…” panels in ChatGPT or Claude.
- Hide or skip it when you only care about the final reply.
Thinking costs time. Every reasoning token is generated just like an answer token, so a model that thinks for 600 tokens before a two-line answer is much slower than the same model with thinking off.
Which Models Support Thinking
Ollama keeps a list under the thinking tag on ollama.com. The common families are:
| Model | Thinking control | Notes |
|---|---|---|
| Qwen3 family | On / off | Used in Ollama’s own examples. Good all-rounder for local reasoning. |
| DeepSeek-R1 | On / off | Classic reasoning model; distilled sizes run on normal GPUs. |
| gpt-oss | Levels: low, medium, high | Default is medium. It cannot fully turn thinking off. See my gpt-oss local guide. |
| Other tagged models | Varies | Always check with ollama show, as shown below. |
Not sure which reasoning model fits your card? See best Ollama models and my VRAM guide.
Check What a Model Supports
Thinking controls differ from model to model. Some only take on/off, others take named levels. Ask Ollama instead of guessing.
In the terminal:
ollama show gpt-oss
Under Capabilities you will see thinking, and for models with metadata two extra lines: levels (for example low, medium, high) and default.
Through the API:
curl http://localhost:11434/api/show -d '{"model": "gpt-oss"}'
The response has a top-level thinking object:
{
"thinking": {
"values": ["low", "medium", "high"],
"default": "medium"
}
}
How to read it:
valuescan hold booleans (true/false) for on/off models, or named levels.defaultis what Ollama uses when you do not setthink.values: [false]means the model does not support thinking.- No
thinkingobject at all means the model has no thinking metadata. It may still reason on its own, based on how it was trained.
Thinking in the CLI
ollama run has two flags for this:
# Thinking on (shows "Thinking..." then "...done thinking.")
ollama run qwen3 --think
# Thinking off
ollama run qwen3 --think=false
# Pick a level on models that support levels
ollama run gpt-oss --think=high
# Keep thinking on but do not print the trace
ollama run qwen3 --hidethinking
If you pass no flag and the model supports thinking, the CLI turns thinking on for you. So when a Qwen3 chat feels slow, --think=false is usually the first fix.
You can also switch mid-conversation in the interactive prompt:
>>> /set think
Set 'think' mode.
>>> /set think low
Set 'think' mode to 'low'.
>>> /set nothink
Set 'nothink' mode.
If the model does not support thinking, Ollama prints a warning such as model “llama3.2” does not support thinking output.
Thinking in the REST API
Add a think field to /api/chat or /api/generate. It accepts:
true: request thinking output.false: request no thinking. Models that cannot disable thinking use their lowest level instead.null(or leaving it out): use the model’s default.- A string such as
"low","medium"or"high": pick a level. Use the exact value from/api/show. Numbers are not supported, and an unsupported name falls back to the model default.
curl http://localhost:11434/api/chat -d '{
"model": "qwen3",
"messages": [{"role": "user", "content": "How many letter r are in strawberry?"}],
"think": true,
"stream": false
}'
The reply keeps the two parts apart, something like this:
"message": {
"role": "assistant",
"thinking": "The word is s-t-r-a-w-b-e-r-r-y. Counting r: position 3, 8 and 9...",
"content": "There are 3 letter r's in \"strawberry\"."
}
On /api/generate the fields are called thinking and response. More on both endpoints in my Ollama API guide.
Python
Install or update the official library with pip install -U ollama, then pass think to chat():
from ollama import chat
response = chat(
model="qwen3",
messages=[{"role": "user", "content": "How many letter r are in strawberry?"}],
think=True,
)
print("Thinking:\n", response.message.thinking)
print("Answer:\n", response.message.content)
For gpt-oss, pass a level instead:
response = chat(
model="gpt-oss",
messages=[{"role": "user", "content": "Plan a 3-step migration from SQLite to Postgres."}],
think="low",
)
To turn it off for a fast job, use think=False. The rest of the library (streaming, async, custom hosts) is covered in my Ollama Python library guide.
JavaScript
The ollama npm package works the same way:
import ollama from 'ollama'
const response = await ollama.chat({
model: 'deepseek-r1',
messages: [{ role: 'user', content: 'How many letter r are in strawberry?' }],
think: true,
})
console.log('Thinking:\n', response.message.thinking)
console.log('Answer:\n', response.message.content)
Install it with npm i ollama.
Stream the Reasoning Into a UI
With streaming, the thinking tokens come first and the answer tokens follow. Watch for the first thinking chunk to open a “Thinking” section, then switch over when content starts:
from ollama import chat
stream = chat(
model="qwen3",
messages=[{"role": "user", "content": "What is 17 x 23?"}],
think=True,
stream=True,
)
in_thinking = False
thinking, content = "", ""
for chunk in stream:
if chunk.message.thinking:
if not in_thinking:
in_thinking = True
print("Thinking:\n", end="")
print(chunk.message.thinking, end="", flush=True)
thinking += chunk.message.thinking
elif chunk.message.content:
if in_thinking:
in_thinking = False
print("\n\nAnswer:\n", end="")
print(chunk.message.content, end="", flush=True)
content += chunk.message.content
# Keep both parts for the next turn
history_entry = {"role": "assistant", "thinking": thinking, "content": content}
Collect the pieces as you go. Ollama’s docs point out this matters most with tools: the thinking, the tool call and the tool result all need to go back to the model in the next request. Tool use is covered in my Ollama tool calling guide.
OpenAI-Compatible reasoning_effort
If your code uses the OpenAI SDK against http://localhost:11434/v1, use reasoning_effort (or reasoning.effort on the Responses API):
from openai import OpenAI
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
r = client.chat.completions.create(
model="gpt-oss",
messages=[{"role": "user", "content": "Is 221 a prime number?"}],
reasoning_effort="high",
)
print(r.choices[0].message.content)
How Ollama maps the values:
- Models with level metadata get the exact level you name. Unknown names fall back to the default.
- On/off models map normal effort values to “on”, and
"none"turns thinking off. - gpt-oss:
"minimal"becomeslow,"xhigh"or"ultra"becomehigh, and"none"becomeslow, because gpt-oss cannot disable thinking.
The Responses API (/v1/responses) also accepts Ollama’s own think field.
When to Turn Thinking On or Off
| Task | Setting | Why |
|---|---|---|
| Maths, logic puzzles, tricky code | On / high | Reasoning catches mistakes before the answer. |
| Planning, multi-step agents | On / medium | Better tool choices; keep context large enough. |
| Classification, extraction, JSON | Off / low | Faster and cheaper on tokens. Pair with structured outputs. |
| Casual chat, summaries | Off | Thinking adds wait time with little gain. |
| Debugging a wrong answer | On, shown | The trace shows where the model went wrong. |
Thinking also fills the context window fast. For long reasoning sessions, raise num_ctx, as explained in my context length guide.
Troubleshooting
“does not support thinking” error
The model has no thinking capability. Run ollama show <model> and look for thinking under Capabilities. If it is missing, use a thinking model, or run ollama pull <model> to get a newer copy with an updated template.
“invalid think value”
You passed a level the model does not know, or a number. Use the exact strings from /api/show, or plain true/false.
I set think to false but gpt-oss still thinks
That is expected. gpt-oss cannot switch thinking off, so Ollama uses its lowest level (low). Use --hidethinking in the CLI, or just ignore message.thinking in code.
<think> tags show up in the content
Your Ollama or your copy of the model is out of date. Update Ollama (see how to update Ollama), then pull the model again so it gets the current template.
Answers are slow or cut off
Long reasoning eats both time and context. Lower the level, turn thinking off for simple jobs, raise num_ctx, and make sure the model fits fully on the GPU (ollama ps should show 100% GPU). If it does not, see Ollama not using GPU.
Thinking text is empty
Some models skip reasoning on easy questions, and models without thinking metadata may never fill the field. Check /api/show first, then try a harder prompt with think set to true.
FAQ
What is the default if I do not set think?
In the API, the model’s own default from /api/show is used. In the CLI, thinking is turned on for any model that supports it unless you pass --think=false.
Does hidethinking make the model faster?
No. --hidethinking only hides the trace on screen. The model still generates it. To save time, use --think=false or a lower level.
Can I use thinking with tools and structured outputs?
Yes. With tools, the thinking arrives in message.thinking and the calls in tool_calls. With structured outputs, the JSON stays in content and the reasoning goes to the separate field. For pure extraction jobs, thinking off is usually faster.
Should I send the thinking back in the chat history?
Ollama’s streaming docs show adding it back as a thinking field on the assistant message. It is most important during tool-calling loops.
Does LM Studio have a similar switch?
LM Studio handles reasoning models in its own app and server. For a side-by-side look, see LM Studio vs Ollama.
Sources
- Ollama docs: Thinking (think values, /api/show thinking object, Python/JS/streaming examples)
- Ollama docs: Streaming (collecting thinking and content for history)
- Ollama docs: OpenAI compatibility (reasoning_effort mapping, gpt-oss rules)
- Ollama source: cmd.go and interactive.go (–think, –hidethinking, /set think, /set nothink)



