Build
Reasoning models
In short: Reasoning models are billed for thinking tokens as output; reasoning_effort or Claude's thinking sets how much they think, and the reasoning text can be read.
On this page
A reasoning model is one that thinks before it answers: it writes internal reasoning tokens, then the reply. That makes them better at maths, planning, debugging and multi-step tool use, and slower and more expensive per request. You decide how hard they think.
Which models have reasoning?
The table below lists the models with reasoning.
| Model id | Input / 1M | Output / 1M |
|---|---|---|
| stepaudio-3-chat-preview:free | Free | Free |
| step-5:free | Free | Free |
How do I set the effort (OpenAI format)?
On chat completions, reasoning_effort sets how much the model thinks. Common values are low, medium and high; some models also accept minimal, none or xhigh. Lower effort answers faster and uses fewer tokens.
curl https://api.oneaiapikey.com/v1/chat/completions \
-H "Authorization: Bearer $ONEAIAPIKEY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6-luna:free",
"reasoning_effort": "low",
"max_completion_tokens": 4000,
"messages": [{"role": "user", "content": "A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much is the ball?"}]
}'import os
from openai import OpenAI
client = OpenAI(base_url="https://api.oneaiapikey.com/v1", api_key=os.environ["ONEAIAPIKEY_API_KEY"])
reply = client.chat.completions.create(
model="gpt-6-luna:free",
reasoning_effort="low",
max_completion_tokens=4000,
messages=[{"role": "user", "content": "A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much is the ball?"}],
)
print(reply.choices[0].message.content)
print(reply.usage.completion_tokens_details.reasoning_tokens, "reasoning tokens")import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.oneaiapikey.com/v1", apiKey: process.env.ONEAIAPIKEY_API_KEY });
const reply = await client.chat.completions.create({
model: "gpt-6-luna:free",
reasoning_effort: "low",
max_completion_tokens: 4000,
messages: [{ role: "user", content: "A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much is the ball?" }],
});
console.log(reply.choices[0].message.content);
console.log(reply.usage.completion_tokens_details?.reasoning_tokens, "reasoning tokens");- Set
max_completion_tokens(ormax_tokens) with room for the thinking and the answer. If the limit is reached while the model is still thinking, you getfinish_reason: "length"and little or no text. - Many reasoning models accept only the default
temperatureandtop_p. Leave them unset. - The OpenRouter-style
reasoningobject ({"effort": "high"}or{"max_tokens": 4000}) is accepted as well. - In the Responses API, use
reasoning: {"effort": "low"}.
How do Claude models handle reasoning?
Claude models do reasoning as extended thinking, which you can turn on in either format.
OpenAI format. Send reasoning_effort to a Claude model and the gateway turns it into Claude’s thinking settings. The thinking text comes back in message.reasoning_content (and delta.reasoning_content when streaming), separate from content.
reply = client.chat.completions.create(
model="qwen-qwen3.8-27b:free",
reasoning_effort="medium", # turns on Claude's extended thinking
max_tokens=8000,
messages=[{"role": "user", "content": "Plan a zero-downtime migration from MySQL 5.7 to 8.0."}],
)
msg = reply.choices[0].message
print(getattr(msg, "reasoning_content", None)) # Claude's thinking, when returned
print(msg.content) # the answerAnthropic format. On /v1/messages, pass Anthropic’s thinking parameter. The reply contains thinking blocks before the text block.
import anthropic, os
client = anthropic.Anthropic(base_url="https://api.oneaiapikey.com", api_key=os.environ["ONEAIAPIKEY_API_KEY"])
message = client.messages.create(
model="qwen-qwen3.8-27b:free",
max_tokens=16000,
thinking={"type": "enabled", "budget_tokens": 8000}, # budget must be below max_tokens
messages=[{"role": "user", "content": "Plan a zero-downtime migration from MySQL 5.7 to 8.0."}],
)
for block in message.content:
if block.type == "thinking":
print("THINKING:", block.thinking[:200], "...")
elif block.type == "text":
print(block.text)In multi-turn conversations with tools, send the assistant’s thinking blocks back unchanged, as Anthropic requires. The Anthropic SDKs do this when you append message.content as it is.
What if an older client breaks on reasoning fields?
If an older client breaks on reasoning fields, point it at the legacy base URL. Some older OpenAI SDKs, chat apps and parsers fail on, or print, fields they do not know, such as reasoning_content. Point them at the legacy base URL instead of the normal one:
OPENAI_BASE_URL=https://api.oneaiapikey.com/v1legacyIt is the same API with the same keys, models, prices and limits, but replies to chat completions have reasoning_content, reasoning and reasoning_details removed from message and from every streamed delta. The answer text, tool calls and usage stay as they are. The model still thinks, and those tokens are still billed. Other formats (/messages, the Responses API) pass through unchanged.
What you are billed for
- Reasoning tokens are output tokens, billed at the model’s output rate, even when the reasoning text is not shown to you.
usage.completion_tokensalready includes them;usage.completion_tokens_details.reasoning_tokensshows how many there were, when the provider reports it.- A hard question at
higheffort can use many times more tokens than the visible answer. Start atlowand raise it only where answers get better.
Related
- Cost control: set limits per key.
- Models: output prices per model.