NEAR AI Cloud: Reasoning Models
Learn how to enable and disable reasoning capabilities for supported models
Some models in NEAR AI Cloud support advanced reasoning capabilities that allow them to "think" through problems before providing a final answer. This feature can improve the quality of responses for complex tasks that require step-by-step reasoning.
Overview
Reasoning models can process information in two stages:
- Thinking stage: Internal reasoning process, returned in the
reasoning_contentfield of the response message - Response stage: The final answer, returned in the
contentfield
For most TEE-hosted models you can control whether the model uses reasoning by configuring the chat_template_kwargs parameter in your API requests. Reasoning output is billed as completion tokens. The number of tokens spent thinking is reported in usage.completion_tokens_details.reasoning_tokens, the same location OpenAI uses, and is a subset of completion_tokens. The top-level usage.reasoning_tokens field is kept as a deprecated alias.
[!TIP]
Which models support reasoning?
Check the
supported_featuresarray in the/v1/modelsresponse — reasoning-capable models list"reasoning".Known gap:
Qwen/Qwen3.5-122B-A10B(cloud-api#703),moonshotai/kimi-k2.5, andmoonshotai/kimi-k2.6currently reason by default even though their metadata does not yet list the"reasoning"flag.
GLM-5.3 Flash
GLM-5.3 Flash (z-ai/glm-5.3-flash) reasons by default. The reasoning is returned in reasoning_content.
Cap the reasoning with thinking_token_budget
thinking_token_budget sets the maximum number of reasoning tokens. When you omit it, the budget is 8192 tokens. Send null to remove the cap. This is the most precise control for this model:
curl https://cloud-api.near.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"model": "z-ai/glm-5.3-flash",
"messages": [
{"role": "user", "content": "How many prime numbers are there between 1 and 200?"}
],
"thinking_token_budget": 512
}'
reasoning_effort is close to on/off
GLM-5.3 Flash accepts reasoning_effort, but the levels are not a gradual dial:
reasoning_effort |
Reasoning |
|---|---|
omitted, "medium" or "max" |
Full reasoning (up to the budget) |
"low" or "high" |
Minimal reasoning, usually under 20 tokens |
To shorten the reasoning without removing it, use thinking_token_budget instead.
[!WARNING]
enable_thinking: falsedoes not make GLM-5.3 Flash fasterWith
"chat_template_kwargs": {"enable_thinking": false}, the response has noreasoning_contentandreasoning_tokensis 0, but the model writes its reasoning intocontentinstead. Responses are not shorter or faster. Use a smallthinking_token_budgetor"reasoning_effort": "low"for minimal reasoning.
GLM-5.1
GLM-5.1 supports reasoning through the enable_thinking parameter in chat_template_kwargs. Reasoning is enabled by default for GLM-5.1.
Default Behavior (Reasoning Enabled)
GLM-5.1 uses reasoning by default. You can explicitly enable it by setting "enable_thinking": true, or simply omit the parameter:
curl https://cloud-api.near.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"model": "zai-org/GLM-5.1-FP8",
"messages": [
{"role": "user", "content": "How much is 2+2?"}
],
"temperature": 0.4,
"chat_template_kwargs": {
"enable_thinking": true
},
"stream": true
}'
Disable Reasoning
To disable reasoning for GLM-5.1, you must explicitly set "enable_thinking": false in the chat_template_kwargs:
curl https://cloud-api.near.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"model": "zai-org/GLM-5.1-FP8",
"messages": [
{"role": "user", "content": "How much is 2+2?"}
],
"temperature": 0.4,
"chat_template_kwargs": {
"enable_thinking": false
},
"stream": true
}'
Qwen3.5-122B and Qwen3.6-35B
Qwen3.5-122B (Qwen/Qwen3.5-122B-A10B) and Qwen3.6-35B (Qwen/Qwen3.6-35B-A3B-FP8) have reasoning enabled by default. The model will include reasoning_content in responses automatically. To disable reasoning, set "enable_thinking": false in the chat_template_kwargs:
curl https://cloud-api.near.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"model": "Qwen/Qwen3.5-122B-A10B",
"messages": [
{"role": "user", "content": "What is sqrt of 17?"}
],
"chat_template_kwargs": {
"enable_thinking": false
},
"stream": true
}'
GPT-OSS-120B
GPT-OSS-120B (openai/gpt-oss-120b) always reasons before answering — its reasoning cannot be disabled. Instead, you control how much it thinks with the standard OpenAI reasoning_effort parameter (low, medium, or high; defaults to medium):
curl https://cloud-api.near.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"model": "openai/gpt-oss-120b",
"messages": [
{"role": "user", "content": "How much is 2+2?"}
],
"reasoning_effort": "low",
"stream": true
}'
Kimi K2.5 and Kimi K2.6
Kimi K2.5 (moonshotai/kimi-k2.5) and Kimi K2.6 (moonshotai/kimi-k2.6) have reasoning enabled by default and include reasoning_content in responses automatically. To disable reasoning, set "thinking": false in the chat_template_kwargs (note the parameter name — thinking, not enable_thinking):
curl https://cloud-api.near.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKEN" \
-d '{
"model": "moonshotai/kimi-k2.6",
"messages": [
{"role": "user", "content": "How much is 2+2?"}
],
"chat_template_kwargs": {
"thinking": false
},
"stream": true
}'
With "thinking": false the response contains no reasoning trace and usage.completion_tokens_details.reasoning_tokens drops to 0.
[!WARNING]
reasoning_effortis not supported on KimiThe Kimi models ignore
reasoning_effort(and OpenRouter-stylereasoningrequest objects): requests that include them succeed, but the model reasons exactly as it would without them. Reasoning on Kimi K2.5 and K2.6 is on/off only — there are no effort levels or thinking budgets. Usechat_template_kwargs.thinkinginstead.
Model-Specific Parameters
Different models use different parameter names for controlling reasoning:
| Model | Model ID | Parameter | Default |
|---|---|---|---|
| GLM-5.3 Flash | z-ai/glm-5.3-flash |
thinking_token_budget (integer or null); reasoning_effort (low/high = minimal) |
on, budget 8192 |
| GLM-5.1 | zai-org/GLM-5.1-FP8 |
chat_template_kwargs.enable_thinking |
true |
| Qwen3.5-122B | Qwen/Qwen3.5-122B-A10B |
chat_template_kwargs.enable_thinking |
true |
| Qwen3.6-35B | Qwen/Qwen3.6-35B-A3B-FP8 |
chat_template_kwargs.enable_thinking |
true |
| GPT-OSS-120B | openai/gpt-oss-120b |
reasoning_effort (low/medium/high) |
medium, always on |
| Kimi K2.5 | moonshotai/kimi-k2.5 |
chat_template_kwargs.thinking |
true |
| Kimi K2.6 | moonshotai/kimi-k2.6 |
chat_template_kwargs.thinking |
true |
[!TIP]
Always check the model documentation or use the model's specific parameter name. Using the wrong parameter name will not enable reasoning.
Third-party models served through the gateway (OpenAI o-series and GPT-5.x, Anthropic Claude, Gemini Pro, ...) use their provider's standard reasoning controls, such as reasoning_effort. The Kimi models are the exception: they do not respond to reasoning_effort — use chat_template_kwargs.thinking as described above.
Reading Reasoning Output
When reasoning is active, responses contain the reasoning trace alongside the answer:
{
"choices": [{
"message": {
"role": "assistant",
"content": "2 + 2 = 4",
"reasoning_content": "The user asks a simple arithmetic question..."
}
}],
"usage": {
"prompt_tokens": 13,
"completion_tokens": 81,
"completion_tokens_details": {
"reasoning_tokens": 73
},
"reasoning_tokens": 73,
"total_tokens": 94
}
}
reasoning_content— the model's internal thinking (streamed asdelta.reasoning_contentchunks whenstream: true)usage.completion_tokens_details.reasoning_tokens— how many of the completion tokens were spent thinking. It is present in non-streaming responses and in the final usage chunk of a stream when you setstream_options: {"include_usage": true}. The top-levelusage.reasoning_tokenscarries the same number and is deprecated.
When to Use Reasoning
Reasoning is particularly useful for:
- Complex mathematical problems: Multi-step calculations and problem-solving
- Logical reasoning: Tasks requiring step-by-step analysis
- Code generation: Complex programming problems that need careful planning
- Scientific questions: Problems requiring structured thinking
Reasoning may not be necessary for:
- Simple queries: Straightforward questions with direct answers
- Fast responses: When latency is critical and the problem is simple
- Cost optimization: Reasoning can increase token usage and costs
Best Practices
- Test with and without reasoning: Compare results to determine if reasoning improves output quality for your use case
- Monitor token usage: Reasoning can increase the number of tokens used, affecting costs — watch
usage.reasoning_tokens - Use appropriate models: Not all models support reasoning - check model capabilities before enabling
- Stream responses: When using reasoning, streaming can provide better user experience for longer responses