Get Started
Examples
Concepts
Resources
Projects
Integrations
API Reference
Reasoning
copy markdown
Reasoning allows the model to think deeply using more compute and thinking tokens to solve more complex problems like in math, science, etc.
Reasoning is turned off by default as most use cases don't require it for deterministic responses like OCR, Translation, etc. but can be turned on by setting the reasoning_effort to high.
How to use reasoning
Interfaze SDK
Vercel AI SDK
LangChain SDK
const response = await interfaze.chat.completions.create({
messages: [
{
role: "user",
content: "Explain why renewable energy is important for combating climate change. Consider economic, environmental, and social factors."
}
],
reasoning_effort: "high",
});
console.log(response.reasoning);
console.log(response.choices[0]?.message.content);Reasoning in streaming mode
When using streaming mode with reasoning enabled, the reasoning process is delivered as it happens, wrapped between <think> and </think> tags. The Interfaze SDK's textDeltas() strips those tags for you and hands back the reasoning text on the final completion instead, and the native Vercel AI SDK and LangChain integrations strip them out of the streamed content the same way.
Interfaze SDK
Vercel AI SDK
LangChain SDK
const stream = interfaze.chat.completions.stream({
messages: [
{
role: "user",
content: "Explain why renewable energy is important for combating climate change. Consider economic, environmental, and social factors."
}
],
reasoning_effort: "high",
});
for await (const text of stream.textDeltas()) {
process.stdout.write(text);
}
// reasoning comes back structured on the final completion
const final = await stream.finalChatCompletion();
console.log(final.reasoning);The reasoning chunks stream chunk by chunk, allowing you to display the thought process in real-time before the final answer arrives.
<think>
Reasoning chunk 1...
Reasoning chunk 2...
Reasoning chunk 3...
</think>
Final answer begins here...