Anthropic(Claude) · claude-sonnet-5-5
Claude Sonnet 5.5 API 国内中转调用指南:价格、教程与代码(2026)
利益声明:作者运营 tryallapi.com。Claude Sonnet 5.5 的参数、价格与行为变更来自 Anthropic 官方文档;tryallapi.com 数据取自公开接口
/api/pricing,取数时间 2026-10-05(北京时间),最终以控制台为准。
入口速查:
| 渠道类型 | 访问网址 | 适用场景 |
|---|---|---|
| 全模型 API 聚合站 | https://tryallapi.com/ | 适合开发者调用、低延迟直连、多模型一站式接入 |
Claude Sonnet 5.5 于 2026-09-28 发布,是 Anthropic 当前「速度 + 智能」组合最好的 Sonnet 档。它和 Sonnet 5 同价、同 tokenizer,但有 5 项会让旧代码直接 400 的破坏性变更。本文先讲这些坑,再给国内经 tryallapi.com 调用的价格与代码。
Claude Sonnet 5.5 信息卡
| 项目 | 内容 | 来源 |
|---|---|---|
| 模型 ID | claude-sonnet-5-5(Bedrock:anthropic.claude-sonnet-5-5) |
官方模型页 |
| 发布 / 退役 | 2026-09-28 发布;退役不早于 2027-09-28 | 官方模型页 |
| 上下文 / 最大输出 | 1M tokens / 128K(Batch API 加 output-300k-2026-03-24 beta 头可到 300K) |
官方模型页 |
| 思考 | Adaptive thinking 默认开启,默认 effort=high |
官方模型页 |
| 输入 → 输出 | 文本 + 图片 → 文本 | 官方模型页 |
| 知识截止 | 2026 年 6 月 | 官方模型页 |
| 官方价(每百万 tokens) | 输入 $2;输出 $10;缓存读 $0.20;5 分钟缓存写 $2.50;1 小时缓存写 $4;Batch 五折 | 官方定价 |
| tryallapi.com | 已上架;端点 anthropic(/v1/messages)与 openai(/v1/chat/completions) |
/api/pricing 2026-10-05 |
| Base URL(聚合) | OpenAI 兼容:https://tryallapi.com/v1;Anthropic / Claude Code:https://tryallapi.com |
tryallapi.com |
三行结论
- 官方价 $2 / $10,比 Sonnet 4.6 的 $3 / $15 低三分之一,和 Sonnet 5 持平;1M 上下文按标准价计费,不另收长上下文溢价。
- 从 Sonnet 5 迁移不能只改模型名:
thinking: disabled、强制工具调用、非默认temperature都会返回 400。 - tryallapi.com 上 Sonnet 5.5 的标定基价与官方一致,实际扣费 ≈ 基价 × 分组倍率(2026-10-05 可见 0.17648~2.2),以控制台为准。
👉 前往 tryallapi.com 注册并生成 API Key
一、Claude Sonnet 5.5 的 5 项破坏性变更(迁移必读)
官方「What's new」列出的变更,几乎都和 Agent / 工具调用代码有关:
| 变更 | 旧写法会怎样 | 新写法 |
|---|---|---|
| 关闭前置思考 | thinking: {"type": "disabled"} → 400 invalid_request_error |
thinking: {"type": "between_tools"},仅在 effort 为 low / medium / high 时可用 |
| 强制工具调用 | tool_choice 为 any 或 {"type":"tool"} → 400 |
保留 auto,配合 strict tool use 或结构化输出;在提示词里写清何时调用工具 |
| 思考块绑定模型与对话 | 回放思考块前改动了 system / tools / 早先消息 → 400(2026-08-31 之后创建的账号默认强校验) | 对话保持「只追加」,用会话中途的 system message 改指令 |
| 计算机操作工具 | Claude API / Google Cloud 上声明 computer_20251124 → 400 |
改用 computer_toolset_20260801(Bedrock 仍接受旧工具) |
| Advisor 工具 | 以 Opus 4.8 / Opus 4.7 / Sonnet 5 作为 advisor → 400 | 换成 Sonnet 5.5 接受的 advisor(如 Opus 5、Opus 5.5) |
另外两条「不报错但行为变了」的细节:
- 工具调用之间的较长说明改为
thinking块返回。默认display: "omitted"时这些块文本为空,前端会在工具调用间「静默」;用between_tools,或在 adaptive 模式下设置display,文本才会回来。 temperature、top_p、top_k设为非默认值直接 400。很多 SDK 封装默认带temperature=0.7,迁移前务必删掉。
还有两点利好:最小可缓存 prompt 从 Sonnet 5 的 1,024 tokens 降到 512 tokens;effort 档位重新校准过,官方建议 Agent 编码从 medium 起步,难任务再升 high,不要直接沿用 Sonnet 5 的设置。
二、Sonnet 5.5、Sonnet 4.6 与 Opus 5.5 怎么选
| 维度 | Sonnet 5.5 | Sonnet 4.6 | Opus 5.5 |
|---|---|---|---|
| 官方价(输入 / 输出) | $2 / $10 | $3 / $15 | $4 / $20 |
| 上下文 / 输出 | 1M / 128K | 1M / 128K | 1M / 128K |
| 思考 | Adaptive,默认 high,可 between_tools |
Adaptive | Adaptive(始终开启),默认 medium |
| 延迟(官方相对值) | Fast | — | Moderate |
| 缓存读 | 基础输入价的 10% | 基础输入价的 10% | 基础输入价的 5% |
对国内团队的实际建议:
- 新项目默认 Sonnet 5.5:单价比 4.6 低,能力更新;要求「能关掉前置思考」的低延迟链路,用
between_tools。 - 仍在 4.6 上的生产流量:先在灰度环境跑一轮回归,重点检查
temperature、tool_choice、思考块回放三处,再切换。 - 最难的长程任务:Opus 5.5 单价翻倍,但思考始终开启;可以让 Sonnet 5.5 做主执行,难点交给 Opus 5.5。官方说明在 Claude API / Google Cloud 上 Opus 5.5 能读取 Sonnet 5.5 的思考块,而 Sonnet 5.5 读不了 Opus 5.5 的,所以中途换模型只适合「向上切换」。
三、Claude Sonnet 5.5 API 价格:官方 vs tryallapi.com
官方价(2026-10-05 核对)
| 计费项 | 每百万 tokens |
|---|---|
| 输入 | $2.00 |
| 输出 | $10.00 |
| 缓存读 | $0.20 |
| 5 分钟缓存写 | $2.50 |
| 1 小时缓存写 | $4.00 |
| Batch API | 输入、输出均五折($1 / $5) |
| 仅美国推理(inference_geo) | 输入、输出 1.1 倍 |
tryallapi.com 分组估算(≈ 基价 × 分组倍率)
claude-sonnet-5-5:model_ratio=1、completion_ratio=5、cache_ratio=0.1、5 分钟缓存写 1.25、1 小时缓存写 2,换算后标定基价与官方一致($2 / $10 / 缓存读 $0.20)。2026-10-05 可见分组:
| 分组 | 倍率 | 输入估算 | 输出估算 | 缓存读估算 |
|---|---|---|---|---|
| Kiro-Claude-1 | 0.17648 | ≈ $0.35 | ≈ $1.76 | ≈ $0.035 |
| Claude-Code-1 | 0.35294 | ≈ $0.71 | ≈ $3.53 | ≈ $0.071 |
| Claude-Code-2 | 0.58824 | ≈ $1.18 | ≈ $5.88 | ≈ $0.118 |
| AWS-Bedrock-2 | 1.17648 | ≈ $2.35 | ≈ $11.76 | ≈ $0.235 |
| AWS-Claude-2 | 1.76472 | ≈ $3.53 | ≈ $17.65 | ≈ $0.353 |
| AWS-Claude-3 | 2.2 | $4.40 | $22.00 | $0.44 |
表中金额是 tryallapi 的美元额度;/api/status 显示充值价 price=1(元 / 美元额度),实际以充值页为准。低倍率分组适合个人开发与 Claude Code,高倍率的 AWS 分组通常对应不同上游线路,按稳定性需求选择。以控制台为准。
四、Claude Sonnet 5.5 国内调用方法:快速接入
1. 环境变量
export TRYALLAPI_KEY="sk-xxxxxxxx"
2. Anthropic SDK(推荐,原生支持 thinking / effort)
# pip install -U anthropic
import os
import anthropic
client = anthropic.Anthropic(
api_key=os.environ["TRYALLAPI_KEY"],
base_url="https://tryallapi.com", # Anthropic 协议不带 /v1
)
msg = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=4096,
thinking={"type": "between_tools"}, # 关闭前置思考;不要再写 "disabled"
output_config={"effort": "medium"}, # between_tools 只接受 low / medium / high
messages=[{"role": "user", "content": "把这段 Python 改写成异步版本,并说明改动点"}],
)
for block in msg.content:
if block.type == "text":
print(block.text)
注意:不要传 temperature / top_p / top_k;需要 xhigh / max 时省略 thinking 字段(即 adaptive)。
3. OpenAI 兼容(Cursor、Dify、Cherry Studio 等)
# pip install -U openai
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["TRYALLAPI_KEY"], base_url="https://tryallapi.com/v1")
r = client.chat.completions.create(
model="claude-sonnet-5-5",
messages=[{"role": "user", "content": "列出这份需求文档中的验收标准"}],
)
print(r.choices[0].message.content)
4. cURL(Anthropic Messages)
curl https://tryallapi.com/v1/messages \
-H "x-api-key: $TRYALLAPI_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5-5","max_tokens":1024,"thinking":{"type":"between_tools"},"messages":[{"role":"user","content":"ping"}]}'
5. Claude Code
export ANTHROPIC_BASE_URL="https://tryallapi.com"
export ANTHROPIC_AUTH_TOKEN="$TRYALLAPI_KEY"
export ANTHROPIC_MODEL="claude-sonnet-5-5"
claude
五、常见报错与排查
| 报错 | 原因 | 处理 |
|---|---|---|
400:提示使用 between_tools |
仍在传 thinking: {"type": "disabled"} |
改成 between_tools |
400:tool_choice: type "tool" and "any" are not supported |
强制工具调用 | 改 auto + strict tool use |
| 400:temperature 相关 | SDK / 框架默认带了非默认采样参数 | 删掉 temperature / top_p / top_k |
400:between_tools + xhigh / max |
该组合不被接受 | 降到 high,或改用 adaptive |
| 400:回放思考块失败 | 改动了思考块之前的 system / tools / 历史消息 | 对话只追加;或去掉被编辑轮之后的思考块 |
| 401 | tryallapi Key 与 Anthropic 官方 Key 混用 | 检查 ANTHROPIC_AUTH_TOKEN / x-api-key |
| 404 | Base URL 写错(Anthropic 协议多加了 /v1) |
Claude Code 用 https://tryallapi.com |
六、Claude Sonnet 5.5 FAQ
Q1:Claude Sonnet 5.5 的模型 ID 是什么?
Claude API 与 tryallapi.com 都是 claude-sonnet-5-5;Amazon Bedrock 为 anthropic.claude-sonnet-5-5。
Q2:Claude Sonnet 5.5 官方价格是多少?
每百万 tokens 输入 $2、输出 $10、缓存读 $0.20、5 分钟缓存写 $2.50、1 小时缓存写 $4;Batch 五折。与 Sonnet 5 同价。
Q3:上下文和最大输出是多少?
1M tokens 上下文,同步接口最大输出 128K;Batch API 加 beta 头可到 300K。
Q4:怎么关闭思考?
不能再用 disabled。发送 thinking: {"type": "between_tools"} 关闭前置思考,effort 需为 low / medium / high。
Q5:为什么设置 temperature 会报 400?
Sonnet 5.5 不接受非默认的 temperature、top_p、top_k,删除这些参数即可。
Q6:国内怎么调用 Claude Sonnet 5.5?
在 tryallapi.com 生成 Key:Anthropic 协议 base_url=https://tryallapi.com,OpenAI 兼容 base_url=https://tryallapi.com/v1,模型 claude-sonnet-5-5。
Q7:tryallapi.com 上怎么计费?
标定基价与官方一致,实际 ≈ 基价 × 分组倍率;2026-10-05 可见 Kiro-Claude-1(0.17648)到 AWS-Claude-3(2.2)等分组,以控制台为准。
Q8:从 Sonnet 4.6 升级值得吗?
单价低三分之一、上下文同为 1M;但要按本文第一节处理 5 项破坏性变更,并重新调 effort。
相关阅读
- Claude Fable 5.1 API 国内中转调用指南与价格:Fable 5.1 缓存读降75%:价格、3项破坏性变更与国内调用代码
- Claude Sonnet 4.6 API 国内中转调用指南与价格:官方 $3/$15、缓存读 $0.30;Claude Code ANTHROPIC_BASE_URL 配置。
- Claude Opus 5.5 API 国内中转调用指南与价格:官方 $4/$20、缓存读 $0.20;Claude Code settings.json 与双协议接入。
- GPT-6 Sol API 国内中转调用指南与价格:gpt-6-sol 官方价 $2/$10、105万上下文,支持 none 推理,附国内中转调用代码
- Gemini 3.8 Flash API 国内中转调用指南与价格:gemini-3.8-flash限时价$0.75/$3.75,2027年翻倍;默认medium不支持minimal
- DeepSeek V4.1 API 国内中转调用指南与价格:高峰 ¥2/¥8、空闲半价;官方新模型名 deepseek-flash,1M 上下文、384K 输出。
- 全部 AI 大模型 API 国内调用指南与价格汇总
- 官方参考:Sonnet 5.5 模型页 · What's new in Sonnet 5.5 · Claude 定价
其他使用方式,按需选择:
| 渠道类型 | 访问网址 | 适用场景 |
|---|---|---|
| 全模型 API 聚合站 | https://tryallapi.com/ | 适合开发者调用、低延迟直连、多模型一站式接入 |
作者:MaynorAI,tryallapi.com 运营者,关注国内开发者接入海外大模型的实践问题。 首发:2026-10-05|最后更新:2026-10-05|更新日志:2026-10-05 首版(价格与倍率取自 Anthropic 官方文档与 tryallapi.com 公开接口,取数时间 2026-10-05,最终以控制台为准)。 免责声明:文中价格、倍率与政策可能随厂商及平台调整而变化,请以官方页面和 tryallapi.com 控制台为准。第三方中转服务不是模型厂商官方服务。