Skip to content

Ollama Docs, Revised

Thinking

Task page. 6 changes, 1 question for the owner. Audit: improved. Original source at commit 318ee28.

Revised

Thinking-capable models emit a thinking field that separates their reasoning trace from the final answer.

Use this capability to audit model steps, animate the model thinking in a UI, or hide the trace entirely when you only need the final response.

See the full list of thinking models.

Discover a model's thinking controls

Thinking controls vary by model. Use /api/show to discover the values a model supports and the value Ollama uses by default:

curl http://localhost:11434/api/show -d '{
  "model": "gpt-oss"
}'

The response includes a top-level thinking object:

{
  "thinking": {
    "values": ["low", "medium", "high"],
    "default": "medium"
  }
}

These fields work as follows:1

  • values can contain booleans (true or false) for on/off controls. It can also contain model-defined strings for named levels.
  • default is used when think isn't2 set.
  • values: [false] means the model doesn't3 support thinking.
  • If thinking is omitted, the model has no thinking metadata. The model might conduct thinking based on its existing behavior.?1

Turn on thinking in API calls4

Set the think field on a chat or generate request:

  • true: request thinking output.
  • false: request no thinking output. Models that can't turn off5 thinking use their lowest supported level instead.
  • null: use the model default.
  • A string: select a supported level from thinking.values. Use the exact value from /api/show. Numbers aren't6 supported.

If the model resolves named levels from /api/show metadata, Ollama applies supported names exactly. Unsupported names use the model default.

The reasoning output and answer use separate fields. Chat returns message.thinking and message.content. Generate returns thinking and response.

cURL

curl http://localhost:11434/api/chat -d '{
  "model": "qwen3",
  "messages": [{
    "role": "user",
    "content": "How many letter r are in strawberry?"
  }],
  "think": true,
  "stream": false
}'

Python

from ollama import chat

response = chat(
  model='qwen3',
  messages=[{'role': 'user', 'content': 'How many letter r are in strawberry?'}],
  think=True,
  stream=False,
)

print('Thinking:\n', response.message.thinking)
print('Answer:\n', response.message.content)

JavaScript

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,
  stream: false,
})

console.log('Thinking:\n', response.message.thinking)
console.log('Answer:\n', response.message.content)

Stream the reasoning trace

Thinking streams interleave reasoning tokens before answer tokens. Detect the first thinking chunk to render a "thinking" section, then switch to the final reply once message.content arrives.

Python

from ollama import chat

stream = chat(
  model='qwen3',
  messages=[{'role': 'user', 'content': 'What is 17 × 23?'}],
  think=True,
  stream=True,
)

in_thinking = False

for chunk in stream:
  if chunk.message.thinking and not in_thinking:
    in_thinking = True
    print('Thinking:\n', end='')

  if chunk.message.thinking:
    print(chunk.message.thinking, end='')
  elif chunk.message.content:
    if in_thinking:
      print('\n\nAnswer:\n', end='')
      in_thinking = False
    print(chunk.message.content, end='')

JavaScript

import ollama from 'ollama'

async function main() {
  const stream = await ollama.chat({
    model: 'qwen3',
    messages: [{ role: 'user', content: 'What is 17 × 23?' }],
    think: true,
    stream: true,
  })

  let inThinking = false

  for await (const chunk of stream) {
    if (chunk.message.thinking && !inThinking) {
      inThinking = true
      process.stdout.write('Thinking:\n')
    }

    if (chunk.message.thinking) {
      process.stdout.write(chunk.message.thinking)
    } else if (chunk.message.content) {
      if (inThinking) {
        process.stdout.write('\n\nAnswer:\n')
        inThinking = false
      }
      process.stdout.write(chunk.message.content)
    }
  }
}

main()

Notes on this page

  1. 1 Added Audit: improved Adds a lead-in sentence so the list under the JSON example starts with a complete sentence.

    list-lead-in

    Auditor: The sentence explains how the list relates to the /api/show fields.

  2. 2 Wording Audit: neutral Uses the contraction "isn't".

    Was: is not set

    Contractions

    Auditor: Changing “is not” to “isn't” preserves the meaning.

  3. 3 Wording Audit: neutral Uses the contraction "doesn't".

    Was: does not support

    Contractions

    Auditor: Changing “does not” to “doesn't” preserves the meaning.

  4. 4 Wording Audit: neutral Uses "turn on" instead of "enable".

    Was: ## Enable thinking in API calls

    TurnOn

    Auditor: “Turn on” and “enable” convey the same instruction here.

  5. 5 Wording Audit: neutral Uses "can't turn off" instead of "cannot disable".

    Was: cannot disable

    Contractions TurnOn

    Auditor: “Can't turn off” preserves the meaning of “cannot disable” here.

  6. 6 Wording Audit: neutral Uses the contraction "aren't".

    Was: are not supported

    Contractions

    Auditor: Changing “are not” to “aren't” preserves the meaning.

Questions for the owner

  • ?1 What does it mean that a model with no thinking metadata "might conduct thinking based on its existing behavior"; can the page say how a reader tells whether such a model thinks?

    About: “The model might conduct thinking based on its existing behavior.”

Original

Thinking-capable models emit a thinking field that separates their reasoning trace from the final answer.

Use this capability to audit model steps, animate the model thinking in a UI, or hide the trace entirely when you only need the final response.

See the full list of thinking models.

Discover a model's thinking controls

Thinking controls vary by model. Use /api/show to discover the values a model supports and the value Ollama uses by default:

curl http://localhost:11434/api/show -d '{
  "model": "gpt-oss"
}'

The response includes a top-level thinking object:

{
  "thinking": {
    "values": ["low", "medium", "high"],
    "default": "medium"
  }
}
  • values can contain booleans (true or false) for on/off controls. It can also contain model-defined strings for named levels.
  • default is used when think is not set.
  • values: [false] means the model does not support thinking.
  • If thinking is omitted, the model has no thinking metadata. The model might conduct thinking based on its existing behavior.

Enable thinking in API calls

Set the think field on a chat or generate request:

  • true: request thinking output.
  • false: request no thinking output. Models that cannot disable thinking use their lowest supported level instead.
  • null: use the model default.
  • A string: select a supported level from thinking.values. Use the exact value from /api/show. Numbers are not supported.

If the model resolves named levels from /api/show metadata, Ollama applies supported names exactly. Unsupported names use the model default.

The reasoning output and answer use separate fields. Chat returns message.thinking and message.content. Generate returns thinking and response.

cURL

curl http://localhost:11434/api/chat -d '{
  "model": "qwen3",
  "messages": [{
    "role": "user",
    "content": "How many letter r are in strawberry?"
  }],
  "think": true,
  "stream": false
}'

Python

from ollama import chat

response = chat(
  model='qwen3',
  messages=[{'role': 'user', 'content': 'How many letter r are in strawberry?'}],
  think=True,
  stream=False,
)

print('Thinking:\n', response.message.thinking)
print('Answer:\n', response.message.content)

JavaScript

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,
  stream: false,
})

console.log('Thinking:\n', response.message.thinking)
console.log('Answer:\n', response.message.content)

Stream the reasoning trace

Thinking streams interleave reasoning tokens before answer tokens. Detect the first thinking chunk to render a "thinking" section, then switch to the final reply once message.content arrives.

Python

from ollama import chat

stream = chat(
  model='qwen3',
  messages=[{'role': 'user', 'content': 'What is 17 × 23?'}],
  think=True,
  stream=True,
)

in_thinking = False

for chunk in stream:
  if chunk.message.thinking and not in_thinking:
    in_thinking = True
    print('Thinking:\n', end='')

  if chunk.message.thinking:
    print(chunk.message.thinking, end='')
  elif chunk.message.content:
    if in_thinking:
      print('\n\nAnswer:\n', end='')
      in_thinking = False
    print(chunk.message.content, end='')

JavaScript

import ollama from 'ollama'

async function main() {
  const stream = await ollama.chat({
    model: 'qwen3',
    messages: [{ role: 'user', content: 'What is 17 × 23?' }],
    think: true,
    stream: true,
  })

  let inThinking = false

  for await (const chunk of stream) {
    if (chunk.message.thinking && !inThinking) {
      inThinking = true
      process.stdout.write('Thinking:\n')
    }

    if (chunk.message.thinking) {
      process.stdout.write(chunk.message.thinking)
    } else if (chunk.message.content) {
      if (inThinking) {
        process.stdout.write('\n\nAnswer:\n')
        inThinking = false
      }
      process.stdout.write(chunk.message.content)
    }
  }
}

main()

What Changed

Applied the wording checks (contractions, "turn on" and "turn off" in place of "enable" and "disable") and added a lead-in sentence before the list that explains the /api/show fields. The structure and every code example are unchanged. One question asks the owner about a sentence that doesn't say what "conduct thinking" means for a model without metadata.

Content type: task. The page tells a developer how to find a model's thinking controls, turn thinking on, and read the reasoning trace, which is one job done in steps.

Automated check, original: 0 errors, 2 warnings, 4 suggestions. Revised: 0 errors, 0 warnings, 0 suggestions.

Independent audit (GPT-6): improved. The revision adds a useful lead-in to the list and keeps the examples and link target intact. The wording substitutions are mostly neutral, with no clear change in meaning.

Wording (5)

  • 2 Uses the contraction "isn't". neutral
  • 3 Uses the contraction "doesn't". neutral
  • 4 Uses "turn on" instead of "enable". neutral
  • 5 Uses "can't turn off" instead of "cannot disable". neutral
  • 6 Uses the contraction "aren't". neutral

Added (1)

  • 1 Adds a lead-in sentence so the list under the JSON example starts with a complete sentence. improved