Build

Thinking and reasoning

Choose reasoning effort or a thinking budget, and understand the token and cost impact.

Set your key

Create an API key, save its recovery link, and add credits. Replace the placeholder below and run it in your terminal before running the examples on this page.

Set your key
export MINIROUTER_KEY='paste-your-api-key-here'

Examples use paid models. For free requests, follow the Auto Free guide.

Choose a reasoning level

This Chat Completions example requests high reasoning effort. Run it after setting your key.

Choose a reasoning level
curl https://api.minirouter.sh/v1/chat/completions \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "openai/gpt-6-astra",
  "messages": [
    {
      "role": "user",
      "content": "What is the smallest positive integer divisible by every integer from 1 through 10? Explain briefly."
    }
  ],
  "max_completion_tokens": 4096,
  "reasoning": {
    "effort": "high"
  }
}'

The final answer is in choices[0].message.content. Reasoning text, when returned, is separate from the answer and varies by model.

Supported controls

Check the model's reasoning_options in the public catalog. It describes an effort list, a token budget, or a toggle. Use the model's listed values and limits.

ControlChat Completions field
Effort levelreasoning: {"effort":"high"} using one of the model's listed levels
Alternative effort syntaxreasoning_effort: "high"; do not also send reasoning
Reasoning token budgetreasoning: {"max_tokens":2048} for a budget-based model
Disable reasoningreasoning: {"effort":"none"} only when the model supports disabling it
Hide returned reasoningreasoning: {"effort":"high","exclude":true} where supported; this does not disable reasoning or its cost
Model defaultOmit the reasoning fields

Effort names can include none, minimal, low, medium, high, xhigh, and max. Each model supports its own subset. More effort can increase latency and cost; it does not guarantee a better answer.

Thinking with the Messages API

Messages uses thinking, with output_config.effort for models that support adaptive thinking. Include the Messages version header.

Thinking with the Messages API
curl https://api.minirouter.sh/v1/messages \
  -H "Authorization: Bearer $MINIROUTER_KEY" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
  "model": "anthropic/claude-opus-5",
  "max_tokens": 4096,
  "thinking": {
    "type": "adaptive"
  },
  "output_config": {
    "effort": "high"
  },
  "messages": [
    {
      "role": "user",
      "content": "Compare two approaches to caching API responses."
    }
  ]
}'

For a model with a fixed thinking budget, use thinking: {"type":"enabled","budget_tokens":2048} instead of adaptive thinking. The budget must be below max_tokens and within the model's supported range. Use thinking: {"type":"disabled"} only where the model allows it. For Responses, use reasoning: {"effort":"high"} with input and max_output_tokens; do not send the Chat Completions or Messages field names.

Read streamed reasoning

On Chat Completions streams, a model may return delta.reasoning_content, delta.reasoning, or delta.reasoning_details separately from delta.content. Messages streams can include thinking blocks and thinking_delta events. Not every model exposes its reasoning.

Preserve provider-issued thinking blocks and signatures when continuing a Messages conversation. Do not replace them with a reconstruction of the text. See streaming for event handling and cost.

Tokens and cost

Reasoning tokens can count toward billed output even when hidden. Allow room for both reasoning and the visible answer. Reasoning requests may require a larger temporary balance hold than a request without reasoning; reducing the visible output limit alone may not reduce that hold. Check the final cost in usage.cost or Activity.