> ## 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 Sonnet 5.5

> 通过 AnyFast 调用 Claude Sonnet 5.5，处理编码、智能体工作流、长上下文分析与自适应思维任务。

Claude Sonnet 5.5 兼顾 Sonnet 级速度与编码、智能体和长上下文处理能力。通过 AnyFast 的 Anthropic Messages API `POST /v1/messages` 调用，模型 ID 为 `claude-sonnet-5-5`。

## 核心能力

* **1M 上下文窗口** — 根据 Anthropic 模型规格，支持最多 1M 上下文 Token 和 128K 输出 Token
* **自适应思维** — 默认开启，可用 `output_config.effort` 控制深度
* **编码与智能体** — 适用于多步骤实现、工具调用和分析
* **文本与视觉** — 接收文本和图像输入，返回文本
* **模型 ID** — 请求中使用 `claude-sonnet-5-5`

## 快速示例

<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-sonnet-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-sonnet-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-sonnet-5-5",
      max_tokens=1024,
      messages=[{"role": "user", "content": "总结发布方案的风险。"}],
  ) as stream:
      for text in stream.text_stream:
          print(text, end="")
  ```
</CodeGroup>

## 参数说明

| 参数 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `model` | string | 是 | 固定为 `claude-sonnet-5-5`。 |
| `messages` | array | 是 | 用户与助手消息，可包含文本、图像或工具结果。 |
| `max_tokens` | integer | 是 | 思维和可见文本共用的最大输出 Token 数，最多 128,000。 |
| `output_config` | object | 否 | `effort` 可选 `low`、`medium`、`high`、`xhigh` 或 `max`；默认 `high`。 |
| `thinking` | object | 否 | 默认使用自适应思维；`between_tools` 只适用于不高于 `high` 的强度。 |
| `tools` | array | 否 | 供模型选择调用的工具定义。 |
| `tool_choice` | object | 否 | 使用 `auto` 或 `none`。 |
| `stream` | boolean | 否 | 开启 SSE 流式输出；默认 `false`。 |

<Note>
  在 `low`、`medium` 或 `high` 强度下，`thinking: {"type":"between_tools"}` 可跳过第一次工具调用前的思考，同时保留工具调用之间的思考。Sonnet 5.5 不支持 `thinking.type` 的 `disabled` 和手动 `enabled`，也不支持 `tool_choice` 的 `any` 和指定 `tool` 模式；AnyFast 实测 `any` 返回 `400`。请省略自定义 `temperature`、`top_p` 和 `top_k` 值；继续工具会话时原样传回思维块。
</Note>

<Note>
  AnyFast 实测文本响应将请求 ID `claude-sonnet-5-5` 返回为 `model: "claude-sonnet-5.5"`，并包含 `request_id`、字符串类型的 `billing.billed_cost_usd` 和 `usage.service_tier`。请求仍应使用连字符形式的 ID；请按 `type` 读取响应内容块。
</Note>

<Card title="API 参考" icon="code" href="/zh/api-reference/model-api/anthropic/claude-sonnet-5-5">
  查看 Claude Sonnet 5.5 的请求与响应字段。
</Card>

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


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