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

# Claude Sonnet 5.5

> Claude Sonnet 5.5 编程、知识工作和工具工作流，包含新版思考设置及迁移注意事项。

Claude Sonnet 5.5 兼顾响应速度与推理能力，面向编程、知识工作和多步骤工具工作流。使用完整 MixRoute ID `claude-sonnet-5-5`。

## 模型信息

| 字段 | 说明 |
| - | - |
| `model` | claude-sonnet-5-5 |
| `context` | 1M tokens |
| `max output` | 128K tokens |
| `input / output` | 输入文本和图像，输出文本及工具调用内容块。 |

以上为模型规格；实际限制、价格和托管工具可用性取决于账号及路由。Claude 专有配置优先使用原生 Messages API。

## Messages API

```bash theme={null}
curl --request POST "https://api.mixroute.ai/v1/messages" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "anthropic-version: 2023-06-01" \
  --data '{
  "model": "claude-sonnet-5-5",
  "max_tokens": 1024,
  "output_config": {
    "effort": "low"
  },
  "messages": [
    {
      "role": "user",
      "content": "Explain the tradeoffs of database indexes."
    }
  ]
}'
```

| 字段 | 说明 |
| - | - |
| `model` | 必填：claude-sonnet-5-5。 |
| `max_tokens` | 必填，输出预算包含思考和可见文本。 |
| `messages` | 必填，会话消息；系统指令使用顶层 system 字段。 |
| `output_config.effort` | low、medium、high、xhigh、max，默认 high。 |
| `thinking.type` | adaptive（默认）或 between\_tools，不支持旧版 enabled/disabled。 |
| `thinking.display` | adaptive 下默认为 omitted，summarized 返回可读摘要；between\_tools 不传此字段。 |
| `tools` | Claude 工具包含 name、description、input\_schema；strict 工具支持取决于上游平台。 |
| `tool_choice` | 使用 `{"type":"auto"}`，不支持强制选择 any 或 tool。 |
| `stream` | true 启用原生 Messages SSE 事件流。 |

## 思考设置

省略 `thinking` 会启用自适应思考。若要关闭首次回答前的思考，使用 `thinking: {"type":"between_tools"}`，并将 effort 设为 `low`、`medium` 或 `high`。工具调用之间的进度更新仍可能以 thinking 内容块返回，并不表示整个工具流程完全没有思考内容。

```json theme={null}
{
  "thinking": {
    "type": "between_tools"
  },
  "output_config": {
    "effort": "low"
  }
}
```

不要将 `between_tools` 与 `xhigh`/`max`、`display`、`budget_tokens` 或 `block_binding` 组合；最高两档 effort 使用 adaptive。移除非默认采样设置（`temperature`、`top_p`、`top_k`）和旧版手动思考预算。

## 工具调用与响应

```bash theme={null}
curl --request POST "https://api.mixroute.ai/v1/messages" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --header "anthropic-version: 2023-06-01" \
  --data '{
  "model": "claude-sonnet-5-5",
  "max_tokens": 1024,
  "output_config": {
    "effort": "low"
  },
  "messages": [
    {
      "role": "user",
      "content": "Call lookup_status for service demo, then report the returned status."
    }
  ],
  "tools": [
    {
      "name": "lookup_status",
      "description": "Return the status of a named service.",
      "input_schema": {
        "type": "object",
        "properties": {
          "service": {
            "type": "string"
          }
        },
        "required": [
          "service"
        ],
        "additionalProperties": false
      },
      "strict": true
    }
  ],
  "tool_choice": {
    "type": "auto"
  }
}'
```

auto 模式下，模型可以调用工具，也可以直接回答；在提示词中说明何时需要工具。若所选路由不支持 strict，省略 strict，并在应用中校验返回参数。

当 `stop_reason` 为 `tool_use` 时，处理所有 `tool_use` 块，再通过 user 消息中的 `tool_result` 和对应 `tool_use_id` 回传结果。将完整 assistant content 数组原样追加到会话，包括空 thinking 块及签名；不要将思考块移到其他模型或无关会话。

默认不返回思考正文，因此 content 数组可能在文本之前包含空 thinking 块。应按类型读取，而不是假设 content\[0] 一定是文本：

```python theme={null}
for block in response.json().get("content", []):
    if block.get("type") == "text":
        print(block["text"])
```

## OpenAI 兼容对话

```bash theme={null}
curl --request POST "https://api.mixroute.ai/v1/chat/completions" \
  --header "Authorization: Bearer $MIXROUTE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "claude-sonnet-5-5",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "Explain the tradeoffs of database indexes."
    }
  ]
}'
```

文本结果从 `choices[0].message.content` 读取；不要假设 Claude 专有思考设置与 Chat Completions 字段同名映射，需要这些控制时使用 Messages。

## 从 Sonnet 5 迁移

1. 使用不带日期后缀的 `claude-sonnet-5-5`。
2. 将 disabled 改为 between\_tools，并使用 high 或更低的 effort。
3. 将强制工具选择改为 auto，完整保留思考块与签名。
4. 移除 assistant 预填充、手动思考预算和非默认采样设置。
5. 重新评估输出预算与 effort；托管电脑操作、advisor 等工具还受各平台兼容性限制。

[Messages API](/cn/api-reference/endpoint/messages) | [Chat Completions API](/cn/api-reference/endpoint/chat-openai)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.