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

# Claude Opus 4.7 新参数指南

> Claude Opus 4.7 推理控制实操指南：新增 xhigh 档位、思考内容默认隐藏，附 AIHubMix 原生 API 与 Chat 统一接口的完整调用示例。

<Frame>
  <img src="https://mintcdn.com/aihubmix/KfVPdfHEI_4FVLQw/images/blogs/claude-opus-4-7.webp?fit=max&auto=format&n=KfVPdfHEI_4FVLQw&q=85&s=23c179250179504b2716e6b6f5d8c21e" alt="Claude Opus 4.7 新参数指南：推理控制与 xhigh 档位" width="2400" height="1260" data-path="images/blogs/claude-opus-4-7.webp" />
</Frame>

> 本文介绍 [Claude Opus 4.7](https://aihubmix.com/model/claude-opus-4-7) 在推理控制上的两项关键变化，并给出 **AIHubmix** 原生 API 与 **Chat** 统一接口两种用法的完整说明。延伸阅读：[Anthropic 官方公告](https://www.anthropic.com/news/claude-opus-4-7) 与 [模型更新日志](https://platform.claude.com/docs/en/about-claude/models/whats-new-claude-4-7)。

## 1. Opus 4.7 新增了哪些推理控制能力？

### ✦ 新增 `xhigh` 推理强度档位

新增的 `xhigh` 档位介于 `high` 与 `max` 之间，专为**编码与 Agent 类任务**设计，在能力与效率之间取得了更好的平衡。

```text theme={null}
low  ──  medium  ──  high  ──  xhigh ★NEW  ──  max
```

### ✦ 思考内容默认隐藏

在流式响应中，思考过程**默认不再展示**。若需获取推理摘要，请在请求中显式传入 `display` 字段：

| **display 取值** | **Opus 4.7** | **Opus 4.6** | **行为**   |
| :------------- | :----------- | :----------- | :------- |
| "omitted"      | **默认**       | 非默认          | 思考块内容为空  |
| "summarized"   | 需手动设置        | **默认**       | 返回思考摘要文本 |

```text theme={null}
"reasoning": {
  "effort": "xhigh",
  "display": "summarized"
}
```

> **图**：Opus 4.7 新增 xhigh 档位 —— Agent 编码性能对比（来源：Anthropic 官方）

<Frame>
  <img src="https://mintcdn.com/aihubmix/PtidhH0HocFUhyEX/images/image-26.png?fit=max&auto=format&n=PtidhH0HocFUhyEX&q=85&s=deb456cee70b63e56a5d825a9e08392b" alt="Claude Opus 4.7 xhigh 档位 Agent 编码性能对比" width="3840" height="2160" data-path="images/image-26.png" />
</Frame>

***

## 2. Claude 原生 API 参考

### Anthropic 原生 API 的 `effort` 取值与官方规范保持一致：

| **effort 取值** | **支持的模型**      | **说明**                        |      **推荐场景**      |
| :------------ | :------------- | :---------------------------- | :----------------: |
| low           | 所有支持的模型        | 显著节省 token，能力适度折中             | 简单任务、高并发请求、子 Agent |
| medium        | 所有支持的模型        | 均衡模式，适度节省 token               |     通用 Agent 任务    |
| high          | 所有支持的模型        | 默认值；高能力表现                     |  复杂推理、编码、Agent 任务  |
| **xhigh（新增）** | **仅 Opus 4.7** | 介于 high 与 max 之间的增强能力；擅长长周期任务 |  编码与 Agent 任务的推荐起点 |
| max           | Opus 系列        | 最高能力                          |       前沿研究类难题      |

### **AIHubmix Claude 原生 API —— Opus 4.7 示例**

```text theme={null}
from anthropic import Anthropic

client = Anthropic(
    api_key="<AIHUBMIX_API_KEY>",
    base_url="https://aihubmix.com"
)

response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=16000,
    thinking={"type": "adaptive"},
    output_config={"effort": "xhigh"},  # 可选：low / medium / high / xhigh / max
    messages=[
        {
            "role": "user",
            "content": "A snail is at the bottom of a 10-meter well. Each day it climbs 3 meters, but each night it slides back 2 meters. How many days does it take to reach the top?"
        }
    ]
)

print(response.content[-1].text)
```

***

## 3. AIHubmix Chat 统一接口对推理强度的支持

AIHubMix Chat 统一接口对齐 OpenAI 规范，通过 `reasoning.effort` 控制推理强度。**不同的 Claude 模型会自动映射到对应的 effort 档位：**

### Claude 模型的 `reasoning_effort`（推理强度控制）

| **effort 取值** | **Opus >=4.7（新增）** | **Opus 4.6 / 4.5** | **Sonnet 4.6** |
| :------------ | :----------------: | :----------------: | :------------: |
| minimal       |         low        |         low        |       low      |
| medium        |       medium       |       medium       |     medium     |
| high          |        high        |        high        |      high      |
| xhigh         |        xhigh       |         max        |      high      |
| max           |         max        |         max        |      high      |

**说明**：`xhigh` 仅 Opus 4.7 原生支持。其他 Opus 模型会自动回退到 `max`，Sonnet 系列回退到 `high`。

### **Chat 统一接口 —— Opus 4.7 示例**

```text theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="https://aihubmix.com/v1",
    api_key="<AIHUBMIX_API_KEY>",
)

completion = client.chat.completions.create(
    model="claude-opus-4-7",
    # max_tokens=10000,  # 默认 4096；需要更长输出时开启
    messages=[
        {
            "role": "user",
            "content": "A snail is at the bottom of a 10-meter well. Each day it climbs 3 meters, but each night it slides back 2 meters. How many days does it take to reach the top?"
        }
    ],
    extra_body={
        "reasoning": {"effort": "xhigh"}
    }
)

print(completion.choices[0].message.content)
```

***

## 4. 如何在 Chat 统一接口中控制思考内容？

在 OpenAI 兼容接口中，`reasoning` 支持 `display` 字段，用于控制是否返回思考摘要。

**Claude Opus 4.7 默认不返回思考内容。设置** `"display": "summarized"` **即可开启。**

| 字段        | 取值             | 说明          |
| :-------- | :------------- | :---------- |
| `display` | *（省略）*         | 不返回思考内容（默认） |
| `display` | `"summarized"` | 返回思考摘要      |

### **Opus 4.7 —— 思考摘要示例**

```text theme={null}
from openai import OpenAI

client = OpenAI(
    base_url="https://aihubmix.com/v1",
    api_key="<AIHUBMIX_API_KEY>",
)

completion = client.chat.completions.create(
    model="claude-opus-4-7",
    messages=[
        {
            "role": "user",
            "content": "A snail is at the bottom of a 10-meter well. Each day it climbs 3 meters, but each night it slides back 2 meters. How many days does it take to reach the top?"
        }
    ],
    extra_body={
        "reasoning": {"effort": "xhigh", "display": "summarized"}
    }
)

print(completion.choices[0].message.content)
```

***

## *更多细节请参阅 [AIHubmix 文档](https://docs.aihubmix.com/cn) 或 [Anthropic 官方文档](https://docs.anthropic.com/)。*

更新时间：2026-06-26
