> 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.completion_tokens_details`, 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                                  |

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`:

```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.


---

# 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.
