Thinking Mode

Extended reasoning for complex problem-solving.

Overview

Thinking mode (extended reasoning) lets models reason through problems before generating their final answer. The step-by-step reasoning chain improves accuracy on complex tasks like math, logic, and code analysis.

Usage

Thinking mode activates automatically with reasoning-capable models like deepseek-reasoner. Reasoning output appears in the reasoning_content field:

TypeScript
1const stream = await client.chat.completions.create({
2 model: 'deepseek-reasoner',
3 messages: [{ role: 'user', content: 'Prove that sqrt(2) is irrational' }],
4 stream: true,
5});
6
7for await (const chunk of stream) {
8 // Step-by-step reasoning
9 const thinking = chunk.choices[0]?.delta?.reasoning_content;
10 if (thinking) process.stderr.write(thinking);
11
12 // Final answer
13 const content = chunk.choices[0]?.delta?.content;
14 if (content) process.stdout.write(content);
15}

Reasoning models

Models that support extended reasoning include:

  • deepseek-reasoner — DeepSeek's dedicated reasoning model
  • claude-opus-4 — Anthropic Claude with reasoning capability
  • o1, o1-mini — OpenAI's reasoning models

Filter for reasoning models on the Models page.