Skip to content

Docs / Reasoning

Reasoning

Turn a model's reasoning on or off with reasoning, reasoning_effort or thinking. How reasoning text is returned and billed.

Get an API key

Every model in the catalogue has a reasoning switch: on, off, or the model’s default. You can use the parameter your SDK already sends; we read each spelling as on or off.

It is a switch, not a dial. Effort levels (low, medium, high) and thinking budgets (budget_tokens) all mean “on”. They do not change how much the model reasons.

Turning it on or off

Format Parameter On Off
Chat Completions reasoning true, "on", "enabled", "auto", "low", "medium", "high", {"enabled": true}, {"effort": "high"} false, "off", "none", "disabled", {"enabled": false}, {"type": "disabled"}
Chat Completions reasoning_effort (read when reasoning is absent) "low", "medium", "high" "none"
Messages thinking {"type": "enabled", "budget_tokens": N} {"type": "disabled"}
Responses reasoning.effort "low", "medium", "high" "none", "minimal"

Leave the parameter out to use the model’s default.

Examples

curl https://api.yunshurouter.com/v1/chat/completions \
  -H "Authorization: Bearer $YUNSHU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "glm-5.3",
    "reasoning": true,
    "messages": [{"role": "user", "content": "Is 221 a prime number?"}]
  }'
from openai import OpenAI

client = OpenAI(base_url="https://api.yunshurouter.com/v1", api_key="tq-...")

completion = client.chat.completions.create(
    model="glm-5.3",
    reasoning_effort="high",  # any effort level turns reasoning on
    messages=[{"role": "user", "content": "Is 221 a prime number?"}],
)
message = completion.choices[0].message
print(getattr(message, "reasoning_content", None))  # the reasoning text, when returned
print(message.content)                              # the answer
print(completion.usage.completion_tokens_details)   # reasoning_tokens, when reported
import anthropic

client = anthropic.Anthropic(base_url="https://api.yunshurouter.com", api_key="tq-...")

message = client.messages.create(
    model="glm-5.3",
    max_tokens=4096,
    thinking={"type": "enabled", "budget_tokens": 2048},  # budget is not applied; this means "on"
    messages=[{"role": "user", "content": "Is 221 a prime number?"}],
)
for block in message.content:
    print(block.type, getattr(block, "thinking", None) or getattr(block, "text", ""))
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.yunshurouter.com/v1", apiKey: "tq-..." });

const completion = await client.chat.completions.create({
  model: "glm-5.3",
  reasoning_effort: "high",
  messages: [{ role: "user", content: "Is 221 a prime number?" }],
});
console.log(completion.choices[0].message.content);

How reasoning comes back

Format Where the reasoning text is
Chat Completions message.reasoning_content (or delta.reasoning_content when streaming), when the model returns it
Messages thinking content blocks
Responses A reasoning output item

If a model puts its whole answer in the reasoning field and leaves the answer empty, we copy that text into content (Chat Completions) or a text block (Messages), so clients that read only the answer still see one. We do not do this when the reply contains tool calls: then the tool call is the answer.

Cost

Reasoning tokens are output tokens and are billed at the model’s output price. They are counted in usage.completion_tokens_details.reasoning_tokens (Chat Completions), output_tokens_details.reasoning_tokens (Responses), and in tokens.reasoning from GET /v1/generation, when the model reports them.

Reasoning can multiply the output of a request. Set max_tokens (or max_output_tokens) high enough for the reasoning plus the answer, or the answer may be cut off.

Which models reason

GET /v1/models shows capabilities.reasoning: true for models with the switch. Every published model has it.

If you turn reasoning on for a model without the switch, the request is not refused. It runs with reasoning off.