← back to blog

Extended Thinking Through MonoRouter: What to Expect

Claude's extended thinking feature works through MonoRouter, but long reasoning chains need patience. Here's what to know.

Extended thinking lets Claude reason through complex problems step by step before responding. It's one of Opus's most powerful features, and it works through MonoRouter — with a few things worth knowing.

How Extended Thinking Works

When you enable extended thinking, Claude spends time reasoning internally before generating its visible response. This reasoning can take anywhere from a few seconds to a couple of minutes, depending on the complexity of the problem.

During this time, your SDK connection is open but receiving no tokens. The thinking happens server-side, and only the final response streams back.

Basic Example (Python)

Here's how to make an extended thinking request through MonoRouter:

import anthropic

client = anthropic.Anthropic(
    api_key="mr_sk_your_monorouter_key",
    base_url="https://api.monorouter.dev/v1",
    timeout=300.0,  # Extended thinking needs a generous timeout
)

response = client.messages.create(
    model="claude-opus-4-20250514",
    max_tokens=16000,
    thinking={
        "type": "enabled",
        "budget_tokens": 10000,  # Max tokens for internal reasoning
    },
    messages=[{
        "role": "user",
        "content": "Analyze this database schema and suggest an optimal indexing strategy for a read-heavy workload with these query patterns: ..."
    }],
)

# The response contains both thinking and text blocks
for block in response.content:
    if block.type == "thinking":
        print(f"[Thinking] ({len(block.thinking)} chars)")
        print(block.thinking[:200] + "...")
    elif block.type == "text":
        print(f"\n[Response]\n{block.text}")

# Token usage includes thinking tokens
print(f"\nInput: {response.usage.input_tokens}")
print(f"Output: {response.usage.output_tokens}")

TypeScript Example

The same flow in TypeScript:

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: "mr_sk_your_monorouter_key",
  baseURL: "https://api.monorouter.dev/v1",
  timeout: 300_000, // 5 minutes in milliseconds
});

const response = await client.messages.create({
  model: "claude-opus-4-20250514",
  max_tokens: 16000,
  thinking: {
    type: "enabled",
    budget_tokens: 10000,
  },
  messages: [{
    role: "user",
    content: "Review this pull request for security vulnerabilities...",
  }],
});

for (const block of response.content) {
  if (block.type === "thinking") {
    console.log(`[Thinking] ${block.thinking.length} chars of reasoning`);
  } else if (block.type === "text") {
    console.log(`[Response]\n${block.text}`);
  }
}

Streaming Extended Thinking

For long thinking sessions, streaming gives you visibility into progress:

with client.messages.stream(
    model="claude-opus-4-20250514",
    max_tokens=16000,
    thinking={"type": "enabled", "budget_tokens": 10000},
    messages=[{"role": "user", "content": "..."}],
) as stream:
    current_type = None
    for event in stream:
        if hasattr(event, 'type'):
            if event.type == 'content_block_start':
                block_type = event.content_block.type
                if block_type == 'thinking':
                    print("\n--- Thinking ---")
                    current_type = 'thinking'
                elif block_type == 'text':
                    print("\n--- Response ---")
                    current_type = 'text'
            elif event.type == 'content_block_delta':
                if hasattr(event.delta, 'thinking'):
                    print(event.delta.thinking, end='', flush=True)
                elif hasattr(event.delta, 'text'):
                    print(event.delta.text, end='', flush=True)

MonoRouter Considerations

Extended thinking requests tie up a session for longer than normal requests. A typical Sonnet request might take 5-10 seconds. An extended thinking Opus request can take 60-120 seconds. During that time, the session is occupied and can't serve other requests.

For teams with multiple sessions in the pool, this is usually fine — other sessions pick up the slack. For single-session setups, extended thinking requests can cause queuing.

Timeout Configuration

The default timeout in most SDKs is 60 seconds, which isn't enough for extended thinking. Set your timeout based on the budget:

Budget TokensTypical DurationRecommended Timeout
5,00015–45 seconds120s
10,00030–90 seconds180s
25,00060–180 seconds300s
50,000+2–5 minutes600s

MonoRouter doesn't impose its own timeout on extended thinking — it keeps the connection open as long as Claude is thinking.

When to Use It

Extended thinking shines for complex architectural decisions, tricky debugging, and multi-step reasoning. Through MonoRouter, it's effectively free — no per-token charges for the thinking tokens. This makes it practical to use liberally, which you might hesitate to do with API pricing where thinking tokens count toward your bill.

A good rule of thumb: if you'd spend more than 5 minutes thinking about a problem yourself, give Claude thinking time too. The cost through MonoRouter is zero, and the quality improvement is significant.