> ## Documentation Index
> Fetch the complete documentation index at: https://ppio.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 思考模式（Thinking Mode）

## 概述

思考模式（Thinking Mode，也称推理 / Reasoning）让模型在给出最终回答前先输出一段推理过程，通常能提升复杂任务（如数学、代码、多步工具调用）的准确率，但会增加延迟和 token 消耗。不同模型厂商对思考模式的默认状态、开关参数和字段命名并不统一，本页按模型厂商汇总当前已在 PPIO 平台上线、且明确支持思考模式配置的开源模型，说明如何在 OpenAI Chat Completions、OpenAI Responses、Anthropic Messages 三种协议下开启、关闭或调整思考强度。

<Tip>
  如果您调用的模型不在下表中，可参考[创建聊天对话请求](/docs/models/reference-llm-create-chat-completion)中的 `enable_thinking` 参数说明，该参数适用于早期一批模型的思考开关。

  本页讲的是如何开关思考、调整思考强度；如果您需要的是在多次工具调用之间保持推理连贯、透明展示多步推理过程，请参考 [Interleaved Thinking 支持](/docs/model/llm-interleaved-thinking)。
</Tip>

## 模型选择总览

<Note>
  下表按每个厂商在 PPIO 的上线时间排序（"最新/次新"指发布时间先后），**不代表模型能力强弱或推荐优先级**。本页只覆盖各厂商主力文本对话模型；名称带 `-exp`（实验版，如 `deepseek-v4-flash-vision-exp`）以及专门的视觉/多模态模型（如智谱 GLM-5v-turbo、GLM-4.6v 系列）不在本页范围内，即使它们同样带 `reasoning` 能力。表中 GLM-5.3-Flash 虽然输入支持图像/视频，但它是主力对话模型的多模态能力扩展，不是专门的视觉模型，故仍纳入。
</Note>

| 厂商              | 最新模型            | model ID                        | 次新模型                          | model ID                                                  |
| :-------------- | :-------------- | :------------------------------ | :---------------------------- | :-------------------------------------------------------- |
| Zhipu / 智谱      | GLM-5.3-Flash   | `zai-org/glm-5.3-flash`         | GLM-5.3                       | `zai-org/glm-5.3`                                         |
| MiniMax         | MiniMax-M3      | `minimax/minimax-m3`            | MiniMax-M2.7-highspeed / M2.7 | `minimax/minimax-m2.7-highspeed` / `minimax/minimax-m2.7` |
| DeepSeek / 深度求索 | DeepSeek V4 Pro | `deepseek/deepseek-v4-pro-0813` | DeepSeek V4 Flash             | `deepseek/deepseek-v4-flash-0731`                         |
| Moonshot / Kimi | Kimi K3         | `moonshotai/kimi-k3`            | —                             | —                                                         |

***

## Zhipu / 智谱

### GLM-5.3 / GLM-5.3-Flash

#### 协议与 endpoint

| 协议                      | endpoint                                          |
| :---------------------- | :------------------------------------------------ |
| OpenAI Chat Completions | `https://api.ppio.com/openai/v1/chat/completions` |
| OpenAI Responses        | `https://api.ppio.com/openai/v1/responses`        |
| Anthropic Messages      | `https://api.ppio.com/anthropic/v1/messages`      |

<Note>
  本页示例仅覆盖 OpenAI Chat Completions 下已核实的思考参数行为。OpenAI Responses / Anthropic Messages 下控制该模型思考强度的具体字段尚未逐一核实，暂不提供对应示例。
</Note>

#### 思考模式说明

* **默认状态**：思考始终开启。在 OpenAI Chat Completions 下，官方文档证实两个模型均**不支持关闭思考**——传入 `thinking.type: "disabled"` 会导致请求报错。Anthropic Messages / OpenAI Responses 下官方未提供该模型的参数文档，是否同样不可关闭未核实，不代表这两个协议下可以关闭。
* **推理强度（OpenAI Chat Completions）**：`reasoning_effort` 支持 `low`、`high`、`max`，**默认 `max`**；复杂任务（如编程）官方同样推荐使用 `max`。Anthropic Messages endpoint 是否接受同名字段尚未核实，暂不提供该协议下的示例。

<Warning>
  GLM-5.3 与 GLM-5.3-Flash 通过 OpenAI Chat Completions 调用时强制开启思考，迁移时按旧代码实际传的字段分两种处理：

  * 若旧代码传的是 GLM-4.5 的 `enable_thinking: false`：该字段在 GLM-5.3 系列上不存在，直接删除即可，不需要替换成别的参数。
  * 若旧代码传的是 `thinking.type: "disabled"`：GLM-5.3 系列会**拒绝**这个值并报错，必须改成 `thinking.type: "enabled"` 且设置 `reasoning_effort: "low"` 来降低思考强度（而非关闭思考）。
</Warning>

#### 示例：OpenAI Chat Completions

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.ppio.com/openai",
      api_key="<Your API Key>",
  )

  response = client.chat.completions.create(
      model="zai-org/glm-5.3",
      messages=[{"role": "user", "content": "请设计一个模型 API 回归测试清单。"}],
      extra_body={
          "thinking": {"type": "enabled"},
          "reasoning_effort": "high",
      },
  )
  print(response.choices[0].message.content)
  ```

  ```bash cURL theme={null}
  curl "https://api.ppio.com/openai/v1/chat/completions" \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "zai-org/glm-5.3",
      "messages": [{"role": "user", "content": "请设计一个模型 API 回归测试清单。"}],
      "thinking": {"type": "enabled"},
      "reasoning_effort": "high"
    }'
  ```
</CodeGroup>

***

## MiniMax

### MiniMax-M3

#### 协议与 endpoint

| 协议                      | endpoint                                          |
| :---------------------- | :------------------------------------------------ |
| OpenAI Chat Completions | `https://api.ppio.com/openai/v1/chat/completions` |
| Anthropic Messages      | `https://api.ppio.com/anthropic/v1/messages`      |

#### 思考模式说明

* **默认状态因协议而异**：省略 `thinking` 参数时，OpenAI 兼容接口默认**开启**思考；Anthropic 兼容接口默认**关闭**思考。M3 没有 `reasoning_effort` 一类的强度分档，`thinking.type` 只有开 / 关两态，不存在"默认强度"的概念。建议调用时显式指定 `thinking`，不要依赖默认值。
* **开启方式**：`thinking: {"type": "adaptive"}`（`adaptive` 对 M3 等价于开启思考）。
* **关闭方式**：`thinking: {"type": "disabled"}`。
* **`reasoning_split`（仅 OpenAI Chat Completions 支持，Anthropic Messages 无此字段；仅影响返回格式，不控制思考开关）**：设为 `true` 时思考内容拆分到 `reasoning_content` 与 `reasoning_details` 两个字段；省略或设为 `false` 时思考内容以 `<think>...</think>` 标签内嵌在 `content` 字段中。

#### 示例：OpenAI Chat Completions

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.ppio.com/openai",
      api_key="<Your API Key>",
  )

  response = client.chat.completions.create(
      model="minimax/minimax-m3",
      messages=[{"role": "user", "content": "请分析这个工具调用方案的风险。"}],
      extra_body={
          "thinking": {"type": "adaptive"},
          "reasoning_split": True,
      },
  )
  print(response.choices[0].message.content)
  ```

  ```bash cURL theme={null}
  curl "https://api.ppio.com/openai/v1/chat/completions" \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "minimax/minimax-m3",
      "messages": [{"role": "user", "content": "请分析这个工具调用方案的风险。"}],
      "thinking": {"type": "adaptive"},
      "reasoning_split": true
    }'
  ```
</CodeGroup>

#### 示例：关闭思考（Chat Completions）

```bash cURL theme={null}
curl "https://api.ppio.com/openai/v1/chat/completions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax/minimax-m3",
    "messages": [{"role": "user", "content": "只输出一句话总结。"}],
    "thinking": {"type": "disabled"}
  }'
```

### MiniMax-M2.7 / MiniMax-M2.7-highspeed

#### 协议与 endpoint

| 协议                      | endpoint                                          |
| :---------------------- | :------------------------------------------------ |
| OpenAI Chat Completions | `https://api.ppio.com/openai/v1/chat/completions` |
| Anthropic Messages      | `https://api.ppio.com/anthropic/v1/messages`      |

#### 思考模式说明

* **默认状态**：思考始终开启，**不支持关闭**。即使传入 `thinking: {"type": "disabled"}`，请求仍会成功，但思考仍保持开启。
* **MiniMax-M2.7-highspeed** 是 MiniMax-M2.7 的高速版本，模型能力与 M2.7 一致，推理速度更快；调用时把 `model` 换成 `minimax/minimax-m2.7-highspeed` 即可，**代码逻辑无需其他改动**。

<Warning>
  MiniMax-M2.7-highspeed 在 PPIO 的输入、输出单价均为 MiniMax-M2.7 的 **2 倍**（截至本文撰写时）。换成 highspeed 版本只是把 `model` 字段的值改掉，不涉及请求体结构或参数改动，但会直接影响调用成本，请按实际吞吐 / 延迟需求权衡，不要在未评估成本的情况下默认切换。
</Warning>

<Note>
  M2.7 系列没有可用于关闭思考的参数，如需降低延迟或成本，请考虑改用支持关闭思考的模型，或缩短输入 / 输出长度。
</Note>

#### 示例：调用并拆分 reasoning

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.ppio.com/openai",
      api_key="<Your API Key>",
  )

  response = client.chat.completions.create(
      model="minimax/minimax-m2.7",
      messages=[{"role": "user", "content": "请用 Python 实现一个 LRU Cache。"}],
      extra_body={"reasoning_split": True},
  )
  print(response.choices[0].message.content)
  ```

  ```bash cURL theme={null}
  curl "https://api.ppio.com/openai/v1/chat/completions" \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "minimax/minimax-m2.7",
      "messages": [{"role": "user", "content": "请用 Python 实现一个 LRU Cache。"}],
      "reasoning_split": true
    }'
  ```
</CodeGroup>

***

## DeepSeek / 深度求索

### DeepSeek V4 Pro / V4 Flash

#### 协议与 endpoint

| 协议                      | endpoint                                          |
| :---------------------- | :------------------------------------------------ |
| OpenAI Chat Completions | `https://api.ppio.com/openai/v1/chat/completions` |
| OpenAI Responses        | `https://api.ppio.com/openai/v1/responses`        |
| Anthropic Messages      | `https://api.ppio.com/anthropic/v1/messages`      |

<Note>
  三种协议均已验证支持思考模式配置的模型 ID 为 `deepseek/deepseek-v4-pro-0813` 与 `deepseek/deepseek-v4-flash-0731`。以下示例均使用这两个 ID。
</Note>

#### 思考模式说明

* **默认状态**：思考默认开启，默认推理强度为 `high`。
* **OpenAI Chat Completions**：开关用 `thinking: {"type": "enabled"/"disabled"}`（需通过 `extra_body` 传递）；强度用顶层字段 `reasoning_effort`，支持 `low`、`high`、`max`。
* **Anthropic Messages**：`thinking` 字段控制开关（`budget_tokens` 子字段会被忽略）；强度用 `output_config: {"effort": "low"/"high"/"max"}`。
* **OpenAI Responses**：开关与强度合并为一个字段 `reasoning: {"effort": "none"/"low"/"high"/"max"}`，其中 `none` 表示关闭思考。
* **强度档位映射**（用户设置的 effort → 模型实际生效的 effort，对 V4 Pro 与 V4 Flash 一致）：

| 请求 effort | 实际生效 effort |
| :-------- | :---------- |
| low       | low         |
| medium    | high        |
| high      | high        |
| xhigh     | high        |
| max       | max         |

<Note>
  `medium`、`xhigh` 也是被接受的输入值，会按上表静默归一化为 `high`，不会单独产生介于 `high` 与 `max` 之间的效果。
</Note>

<Warning>
  思考模式开启时，`temperature`、`top_p`、`presence_penalty`、`frequency_penalty` 参数不生效。为兼容现有代码，传入这些参数不会报错，但不会产生任何效果。
</Warning>

#### 示例：OpenAI Chat Completions

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.ppio.com/openai",
      api_key="<Your API Key>",
  )

  response = client.chat.completions.create(
      model="deepseek/deepseek-v4-pro-0813",
      messages=[{"role": "user", "content": "请审查这个 API 设计。"}],
      extra_body={
          "thinking": {"type": "enabled"},
          "reasoning_effort": "high",
      },
  )
  print(response.choices[0].message.content)
  ```

  ```bash cURL theme={null}
  curl "https://api.ppio.com/openai/v1/chat/completions" \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "deepseek/deepseek-v4-pro-0813",
      "messages": [{"role": "user", "content": "请审查这个 API 设计。"}],
      "thinking": {"type": "enabled"},
      "reasoning_effort": "high"
    }'
  ```
</CodeGroup>

#### 示例：关闭思考（Chat Completions）

```bash cURL theme={null}
curl "https://api.ppio.com/openai/v1/chat/completions" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4-pro-0813",
    "messages": [{"role": "user", "content": "把这句话翻译成英文：今天天气很好。"}],
    "thinking": {"type": "disabled"}
  }'
```

#### 示例：Anthropic Messages（调整强度）

<CodeGroup>
  ```python Python theme={null}
  import anthropic

  client = anthropic.Anthropic(
      base_url="https://api.ppio.com/anthropic",
      api_key="<Your API Key>",
  )

  message = client.messages.create(
      model="deepseek/deepseek-v4-pro-0813",
      max_tokens=1000,
      system="You are a concise API reviewer.",
      messages=[{"role": "user", "content": [{"type": "text", "text": "列出这个接口迁移的三个风险。"}]}],
      extra_body={
          "thinking": {"type": "enabled"},
          "output_config": {"effort": "max"},
      },
  )
  print(message.content)
  ```

  ```bash cURL theme={null}
  curl "https://api.ppio.com/anthropic/v1/messages" \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -H "anthropic-version: 2023-06-01" \
    -d '{
      "model": "deepseek/deepseek-v4-pro-0813",
      "max_tokens": 1000,
      "system": "You are a concise API reviewer.",
      "messages": [{"role": "user", "content": [{"type": "text", "text": "列出这个接口迁移的三个风险。"}]}],
      "thinking": {"type": "enabled"},
      "output_config": {"effort": "max"}
    }'
  ```
</CodeGroup>

#### 示例：OpenAI Responses（关闭思考）

```bash cURL theme={null}
curl "https://api.ppio.com/openai/v1/responses" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek/deepseek-v4-pro-0813",
    "input": "只输出一句话。",
    "reasoning": {"effort": "none"}
  }'
```

***

## Moonshot / Kimi

### Kimi K3

#### 协议与 endpoint

| 协议                      | endpoint                                          |
| :---------------------- | :------------------------------------------------ |
| OpenAI Chat Completions | `https://api.ppio.com/openai/v1/chat/completions` |
| OpenAI Responses        | `https://api.ppio.com/openai/v1/responses`        |
| Anthropic Messages      | `https://api.ppio.com/anthropic/v1/messages`      |

#### 思考模式说明

* **默认状态**：始终开启思考，**不支持关闭**，也不支持 `thinking` 参数——如果您之前调用 Kimi K2.x 系列传入过 `thinking` 配置，迁移到 K3 时需要移除该参数，改用下面的顶层 `reasoning_effort`（或对应协议下的等价字段）控制推理强度。
* **推理强度**：不嵌套在 `thinking` 内，但三种协议下字段名不同：
  * **OpenAI Chat Completions**：顶层字段 `reasoning_effort`，支持 `low`、`high`、`max`，默认 `max`。官方专门写了使用指南并配有真实调用示例。
  * **Anthropic Messages**：`output_config: {"effort": "low"/"high"/"max"}`，默认 `max`。字段来自 Kimi 官方 API 参考页的请求 schema；该页说明切换档位会导致 prefix-cache 命中失效，建议在会话开始前就定好档位，不要在同一会话中切换。
  * **OpenAI Responses**：`reasoning: {"effort": "low"/"high"/"max"}`，默认 `max`。字段同样来自官方 API 参考页的请求 schema。

<Warning>
  多轮对话与工具调用场景下，必须把 API 返回的完整 assistant 消息（包括 `reasoning_content` 和 `tool_calls`）原样加入下一次请求的 `messages`，否则可能导致工具调用递归或重复、推理上下文丢失。
</Warning>

#### 示例：调整推理强度

<CodeGroup>
  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.ppio.com/openai",
      api_key="<Your API Key>",
  )

  response = client.chat.completions.create(
      model="moonshotai/kimi-k3",
      messages=[{"role": "user", "content": "证明根号 2 是无理数。"}],
      extra_body={"reasoning_effort": "max"},
  )
  print(response.choices[0].message.content)
  ```

  ```bash cURL theme={null}
  curl "https://api.ppio.com/openai/v1/chat/completions" \
    -H "Authorization: Bearer $API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "moonshotai/kimi-k3",
      "messages": [{"role": "user", "content": "证明根号 2 是无理数。"}],
      "reasoning_effort": "max"
    }'
  ```
</CodeGroup>

#### 示例：Anthropic Messages（调整推理强度）

```bash cURL theme={null}
curl "https://api.ppio.com/anthropic/v1/messages" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "moonshotai/kimi-k3",
    "max_tokens": 1000,
    "messages": [{"role": "user", "content": [{"type": "text", "text": "证明根号 2 是无理数。"}]}],
    "output_config": {"effort": "max"}
  }'
```

#### 示例：OpenAI Responses（调整推理强度）

```bash cURL theme={null}
curl "https://api.ppio.com/openai/v1/responses" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "moonshotai/kimi-k3",
    "input": "证明根号 2 是无理数。",
    "reasoning": {"effort": "max"}
  }'
```
