> For the complete documentation index, see [llms.txt](https://docs.tensorx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tensorx.ai/api-reference/reasoning.md).

# Reasoning

Several models expose a separate reasoning (thinking) step. When it runs, the response carries the reasoning in `reasoning_content` on the message and a `reasoning_tokens` count under `usage`, alongside the normal `content`.

The control differs by model family, so the table below is the quick reference. The sections that follow show each family in full.

| Model family             | Reasoning by default | How to turn on / off                                      | Depth control                                              |
| ------------------------ | -------------------- | --------------------------------------------------------- | ---------------------------------------------------------- |
| GLM 5.2                  | On                   | `chat_template_kwargs: {"enable_thinking": true / false}` | `reasoning_effort: "high"` or `"max"`                      |
| GLM 5.1, GLM 5-Turbo     | On                   | `chat_template_kwargs: {"enable_thinking": true / false}` | No effort levels                                           |
| DeepSeek V4 (Flash, Pro) | Off                  | `chat_template_kwargs: {"thinking": true}`                | `reasoning_effort: "high"` or `"max"`                      |
| MiniMax M3               | On (adaptive)        | `chat_template_kwargs: {"thinking_mode": "disabled"}`     | Modes only, no effort levels                               |
| Kimi K2.6, K2.7          | On (always)          | Not toggleable                                            | None                                                       |
| Qwen 3.8                 | On (always)          | Not toggleable                                            | `reasoning_effort: "xhigh"` (default), `"medium"`, `"low"` |

DeepSeek V4 ships with reasoning **off by default on TensorX** so the standard request is fast and cheap. Turn it on per request with `chat_template_kwargs: {"thinking": true}`.

{% hint style="info" %}
The key name is per family: GLM uses `enable_thinking`, DeepSeek V4 uses `thinking`, and MiniMax M3 uses `thinking_mode`. Sending the wrong key is silently ignored, which looks like the parameter "does nothing".
{% endhint %}

## GLM (5.2, 5.1, 5-Turbo)

GLM models think **by default**. Turn thinking off with `enable_thinking: false` inside `chat_template_kwargs`:

```python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.tensorx.ai/v1"
)

# Thinking off (direct answer, no reasoning_content)
response = client.chat.completions.create(
    model="z-ai/glm-5.2",
    messages=[{"role": "user", "content": "What is 15% of 240?"}],
    extra_body={"chat_template_kwargs": {"enable_thinking": False}}
)
```

On **GLM 5.2**, `reasoning_effort` has two effective levels, `"high"` and `"max"`. It is passed at the top level (OpenAI-standard):

```python
response = client.chat.completions.create(
    model="z-ai/glm-5.2",
    messages=[{"role": "user", "content": "Prove that the square root of 2 is irrational."}],
    reasoning_effort="high"
)
```

`"high"` gives shorter reasoning, `"max"` gives the deepest. `"low"` and `"medium"` are accepted but map to `"high"`. To skip reasoning entirely, use `reasoning_effort: "none"` or `enable_thinking: false`. GLM 5.1 and GLM 5-Turbo support on/off but not effort levels.

## DeepSeek V4 (Flash, Pro)

DeepSeek V4 models default to **non-thinking** mode. Enable reasoning with `thinking: true` inside `chat_template_kwargs`:

{% hint style="warning" %}
**Moving from DeepSeek V4 to Qwen 3.8?** The `chat_template_kwargs: {"thinking": false}` key shown here is **accepted but ignored** on Qwen 3.8. The request returns 200, reasoning still runs, and you are still billed for it. Qwen 3.8 cannot have reasoning disabled.
{% endhint %}

```python
response = client.chat.completions.create(
    model="deepseek/deepseek-v4-pro",
    messages=[{"role": "user", "content": "Prove that the square root of 2 is irrational."}],
    extra_body={"chat_template_kwargs": {"thinking": True}}
)

print(response.choices[0].message.reasoning_content)
print(response.choices[0].message.content)
```

Once thinking is on, control the depth with `reasoning_effort`, passed at the top level. There are two effective levels, `"high"` and `"max"`:

```python
response = client.chat.completions.create(
    model="deepseek/deepseek-v4-pro",
    messages=[{"role": "user", "content": "Prove that the square root of 2 is irrational."}],
    extra_body={"chat_template_kwargs": {"thinking": True}},
    reasoning_effort="max"
)
```

`"high"` is the standard depth, `"max"` reasons the longest. `"low"` and `"medium"` are accepted but map to `"high"`. `reasoning_effort` has no effect unless `thinking: true` is also set.

## MiniMax M3

MiniMax M3 has three reasoning modes, set with `thinking_mode` inside `chat_template_kwargs`:

* `"enabled"`: always reason.
* `"adaptive"`: the model decides when to reason. This is the default.
* `"disabled"`: no reasoning, direct answer.

```python
# Reasoning off
response = client.chat.completions.create(
    model="minimax/minimax-m3",
    messages=[{"role": "user", "content": "What is 15% of 240?"}],
    extra_body={"chat_template_kwargs": {"thinking_mode": "disabled"}}
)
```

M3 uses `thinking_mode`, not `thinking` or `enable_thinking`, and the value is one of the three modes above. It does not take graded `reasoning_effort` levels, so use the modes to control reasoning.

## Kimi (K2.6, K2.7)

Kimi models reason **by default and cannot be toggled off**. There is no `enable_thinking` or `thinking` flag to set. `reasoning_content` is always populated.

## Qwen 3.8

Qwen 3.8 thinks on **every** request. Unlike the other families, reasoning **cannot be switched off**. The model rejects any attempt:

* `chat_template_kwargs: {"enable_thinking": false}` returns `400 Disabling thinking is not supported.`
* `reasoning_effort: "none"` returns the same error.

Depth is controlled with the standard top-level `reasoning_effort`, but the accepted values differ from other models on the platform:

| Value      | Effect                                                                                                        |
| ---------- | ------------------------------------------------------------------------------------------------------------- |
| `"xhigh"`  | **Default.** Asks the model to validate assumptions and weigh alternatives. Most thorough, most output tokens |
| `"medium"` | No steering. The model's natural reasoning, and the cheapest of the three                                     |
| `"low"`    | Asks the model to keep thinking brief and reach the conclusion directly                                       |

{% hint style="warning" %}
**`reasoning_effort: "high"` returns a 400 on Qwen 3.8.** Use `"xhigh"`. `"high"` is the OpenAI-standard value and works on GLM 5.2, so ported code often sends it by default.
{% endhint %}

```python
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.tensorx.ai/v1"
)

response = client.chat.completions.create(
    model="qwen/qwen3.8-2.4t-a95b",
    messages=[{"role": "user", "content": "A bat and ball cost 1.10 in total. The bat costs 1.00 more than the ball. How much is the ball?"}],
    reasoning_effort="low"
)

print(response.choices[0].message.reasoning_content)  # the thinking
print(response.choices[0].message.content)            # the answer
print(response.usage.reasoning_tokens)                # billed as output
```

Reasoning arrives in `reasoning_content`, with no `<think>` tags left in `content`. When streaming, reasoning arrives as `delta.reasoning_content` deltas **before** the content deltas begin.

**Reasoning tokens are billed as output tokens.** They are counted inside `completion_tokens` and reported separately as `usage.reasoning_tokens`, so you can always see how much of a response was thinking.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tensorx.ai/api-reference/reasoning.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
