跳转到内容
中文

Claude Opus 5.5 API

POST Base URL: https://api.hiapi.ai /v1/chat/completions

该模型使用兼容 OpenAI 的 Chat Completions 接口。同一个 HiAPI API Key 可调用账户分组内已开放模型;切换到图片、视频或音频模型时,需要改用 /v1/tasks 及对应请求结构。

模型概览

模型名称Claude Opus 5.5
提供方Anthropic
上下文 / 最大输出1M / 128K tokens
接口POST /v1/chat/completions
思考模式始终开启 · 默认 medium
价格HiAPI 实时 Token 价格

Anthropic Claude Opus 5.5 通过 HiAPI Chat Completions 提供长时 Agent 编程与知识工作能力,始终开启 adaptive thinking,并通过 effort 控制思考强度。

生产建议

请求契约
  • 使用 model=claude-opus-5-5 调用 POST /v1/chat/completions。媒体模型使用不同请求结构的 POST /v1/tasks。
  • 不要发送 thinking.type=disabled 或手动 thinking budget;省略 thinking,并使用 output_config.effort。
  • effort 可选 low、medium、high、xhigh、max,提供方默认 medium。
  • 工具选择使用 tool_choice=auto;any 和指定名称的强制工具选择会被上游拒绝。

适用场景

长时 Agent 工作

适合复杂编程、知识工作和多步工具循环,可通过 effort 平衡成本与思考深度。

messagesoutput_config.efforttools

请求参数

model string 必填

固定填写这个公共模型 ID。

示例 claude-opus-5-5 可选值: claude-opus-5-5
messages array 必填

按顺序传入 system、user、assistant 和 tool 消息。工具续轮需原样保留返回的 reasoning_details。

stream boolean 可选

设为 true 返回 SSE。

默认 false
output_config.effort enum 可选

唯一公开的思考深度控制;思考始终开启。

默认 medium 可选值: lowmediumhighxhighmax
max_tokens integer 可选

思考 Token 与可见输出共同使用的硬上限。

system content cache_control object 可选

可选的 5 分钟提示词缓存写入。首期 HiAPI 契约不开放 1 小时缓存写入。

tools array 可选

OpenAI 兼容的函数定义。

tool_choice enum 可选

该模型会拒绝 any 或指定名称的强制工具选择。

默认 auto 可选值: auto

API 接入示例

调用示例

流式响应

读取内容与思考增量直到 [DONE]。

请求体
{
  "model": "claude-opus-5-5",
  "messages": [
    {
      "role": "user",
      "content": "分析单体架构和微服务的取舍。"
    }
  ],
  "stream": true,
  "output_config": {
    "effort": "medium"
  },
  "max_tokens": 4096
}
函数工具

使用 tool_choice=auto 让模型选择函数,再带回工具结果及原始 reasoning 元数据。

请求体
{
  "model": "claude-opus-5-5",
  "messages": [
    {
      "role": "user",
      "content": "Check task demo-123."
    }
  ],
  "stream": false,
  "output_config": {
    "effort": "low"
  },
  "max_tokens": 4096,
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "get_task_status",
        "description": "Look up a task by ID.",
        "parameters": {
          "type": "object",
          "properties": {
            "task_id": {
              "type": "string"
            }
          },
          "required": [
            "task_id"
          ],
          "additionalProperties": false
        }
      }
    }
  ],
  "tool_choice": "auto"
}
5 分钟提示词缓存

在稳定的 system 文本块上添加 cache_control,并从 usage 核对写入或命中。

请求体
{
  "model": "claude-opus-5-5",
  "messages": [
    {
      "role": "system",
      "content": [
        {
          "type": "text",
          "text": "以简洁的架构评审者身份回答。",
          "cache_control": {
            "type": "ephemeral",
            "ttl": "5m"
          }
        }
      ]
    },
    {
      "role": "user",
      "content": "评审这个迁移方案。"
    }
  ],
  "stream": false,
  "output_config": {
    "effort": "medium"
  },
  "max_tokens": 4096
}

响应结构

从 choices[0].message.content 读取可见文本;如返回 reasoning_content,可读取其中的可见思考。工具续轮需原样保留 reasoning_details。计费以 usage 为准。

{
  "id": "chatcmpl_example",
  "object": "chat.completion",
  "model": "claude-opus-5-5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "建议先建立可回滚的迁移边界。",
        "reasoning_content": "先比较部署与数据风险。"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 32,
    "completion_tokens": 48,
    "total_tokens": 80
  }
}
  1. 从 choices[0].message.content 读取可见文本。
  2. 流式调用拼接内容与思考增量,直到 [DONE]。
  3. 读取输入、输出与缓存用量;思考计入输出。

常见问题

Claude Opus 5.5 是什么模型?

这是 Anthropic 面向长时 Agent 编程和知识工作的模型,提供 1M 上下文与 128K 最大输出规格。

应该使用哪个端点和模型 ID?

使用 POST /v1/chat/completions,并将 model 设置为 claude-opus-5-5。

可以关闭思考吗?

不可以。思考始终开启。发送 disabled 或手动预算会被拒绝,请改用 output_config.effort。

支持哪些 effort 档位?

支持 low、medium、high、xhigh 和 max,默认 medium。

工具调用如何使用?

声明 OpenAI 兼容 tools,并使用 tool_choice=auto。带回工具结果时,需原样保留 reasoning_details 和 assistant 工具调用。

Token 如何计费?

输入、输出、5 分钟缓存写入和缓存读取按模型页与价格页实时费率计费;思考 Token 计入输出。 查看实时价格。

下一步