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

# Claude Opus 5.5

> 通过 AnyFast 调用 Anthropic Claude Opus 5.5，处理长时间智能体编码、复杂知识工作、视觉理解和工具调用任务。

Claude Opus 5.5 是 Anthropic 面向长时间智能体编码和知识工作的 Opus 模型。通过 AnyFast 原生 Anthropic Messages API 的 `POST /v1/messages` 接口调用，模型 ID 为 `claude-opus-5-5`。

## 模型规格

| 规格        | 值                                   |
| --------- | ----------------------------------- |
| 模型 ID     | `claude-opus-5-5`                   |
| 上下文窗口     | 1M Token                            |
| 最大输出      | 128K Token                          |
| 输入 → 输出   | 文本和图片 → 文本                          |
| Thinking  | Adaptive，始终开启                       |
| 默认 effort | `medium`                            |
| effort 档位 | `low`、`medium`、`high`、`xhigh`、`max` |
| 可靠知识截止时间  | 2026 年 6 月                          |

## 相比 Opus 5 的接入变化

* **Thinking 始终开启** — 省略 `thinking`，或将其设为 `{"type":"adaptive"}`。`disabled` 和手动 `enabled` 模式都会返回 `400`。
* **默认 effort 变更** — 未填写 `output_config.effort` 时使用 `medium`，而 Opus 5 的默认值是 `high`。
* **不支持强制工具调用** — `tool_choice` 仅支持 `auto` 和 `none`。使用 `any` 或指定名称的 `tool` 会返回 `400`。
* **Thinking 块需要保留** — 工具调用和多轮对话中，应保持对话前缀不变，并原样回传之前返回的 Thinking 块。
* **需要检查拒绝结果** — 安全策略拒绝可能返回 HTTP `200`，同时将 `stop_reason` 设为 `"refusal"`，具体信息位于 `stop_details`。

## 快速示例

<CodeGroup>
  ```bash cURL theme={null}
  curl https://www.anyfast.ai/v1/messages \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "claude-opus-5-5",
      "max_tokens": 4096,
      "output_config": { "effort": "medium" },
      "messages": [
        {
          "role": "user",
          "content": "审查这份迁移计划，并指出风险最高的三个假设。"
        }
      ]
    }'
  ```

  ```python Python theme={null}
  import anthropic

  client = anthropic.Anthropic(
      api_key="YOUR_API_KEY",
      base_url="https://www.anyfast.ai"
  )

  message = client.messages.create(
      model="claude-opus-5-5",
      max_tokens=4096,
      output_config={"effort": "medium"},
      messages=[
          {
              "role": "user",
              "content": "审查这份迁移计划，并指出风险最高的三个假设。"
          }
      ]
  )

  for block in message.content:
      if block.type == "text":
          print(block.text)
  ```

  ```python 流式输出 theme={null}
  import anthropic

  client = anthropic.Anthropic(
      api_key="YOUR_API_KEY",
      base_url="https://www.anyfast.ai"
  )

  with client.messages.stream(
      model="claude-opus-5-5",
      max_tokens=4096,
      output_config={"effort": "medium"},
      messages=[
          {"role": "user", "content": "为这次数据库迁移制定分阶段上线计划。"}
      ],
  ) as stream:
      for text in stream.text_stream:
          print(text, end="")
  ```
</CodeGroup>

## 核心参数

| 参数                     | 类型      | 必填 | 说明                                                             |
| ---------------------- | ------- | -- | -------------------------------------------------------------- |
| `model`                | string  | 是  | 固定为 `claude-opus-5-5`。                                         |
| `messages`             | array   | 是  | 由 `user` 或 `assistant` 消息组成的对话，支持文本、图片和工具结果。                   |
| `max_tokens`           | integer | 是  | Thinking 与可见回答合计允许使用的最大输出 Token 数，范围为 1–128000。                |
| `output_config.effort` | string  | 否  | 控制推理深度，支持 `low`、`medium`、`high`、`xhigh` 和 `max`，默认值为 `medium`。 |
| `thinking.type`        | string  | 否  | 省略此字段或设为 `adaptive`，不能关闭 Thinking。                             |
| `tools`                | array   | 否  | 提供给模型的工具定义。                                                    |
| `tool_choice.type`     | string  | 否  | 支持 `auto` 和 `none`，不支持强制 `any` 或指定名称的 `tool`。                  |
| `stream`               | boolean | 否  | 是否开启 SSE 流式输出，默认值为 `false`。                                    |
| `stop_sequences`       | array   | 否  | 触发停止生成的自定义序列。                                                  |

<Note>
  Adaptive Thinking 始终开启。使用 `output_config.effort` 平衡推理深度、延迟和 Token 使用量。在 `xhigh` 或 `max` 档位下，应为 Thinking 和可见回答预留足够的 `max_tokens`。
</Note>

<Warning>
  不要发送 `thinking: {"type":"disabled"}`，也不要使用带 `budget_tokens` 的手动扩展 Thinking，这两种请求都会返回 `400`。`tool_choice` 应保持为 `auto` 或 `none`，强制 `any` 和指定名称的 `tool` 同样会被拒绝。
</Warning>

## 工具调用

将 `tool_choice` 保持为默认的 `auto`，或使用 `none` 禁止工具调用。准确描述工具用途与输入 Schema，并在提示词中说明何时应调用工具。在工具循环中，应根据内容块的 `type` 处理结果，不要假设第一个内容块一定是文本。

## 多轮对话

当 Assistant 消息包含 Thinking 块时，应原样回传完整消息。系统提示词、工具定义和更早的消息都应视为只追加内容。修改 Opus 5.5 Thinking 块之前的内容可能使该块失效并返回 `400`。

## 从 Opus 5 迁移

1. 将模型 ID 从 `claude-opus-5` 改为 `claude-opus-5-5`。
2. 删除 `thinking: {"type":"disabled"}` 和手动 `budget_tokens` 配置。
3. 如果需要跨模型保持相近行为，请显式设置 `output_config.effort`。
4. 将强制 `tool_choice` 模式替换为 `auto` 或 `none`。
5. 即使 HTTP 状态码是 `200`，也要检查 `stop_reason` 和 `stop_details`。

<Info>
  Anthropic 于 2026 年 9 月 22 日发布 Claude Opus 5.5。参考官方[模型概览](https://platform.claude.com/docs/en/models/opus-5-5/overview)、[版本变化](https://platform.claude.com/docs/en/models/opus-5-5/whats-new-opus-5-5)和[发布公告](https://www.anthropic.com/claude-opus-5-5)。
</Info>

<Card title="API 参考" icon="code" href="/zh/api-reference/model-api/anthropic/claude-opus-5-5">
  查看请求字段、响应内容块和交互式 API Playground。
</Card>

<script src="/public/feedback.js" />
