
Claude Sonnet 5 API
claude-sonnet-5Claude Sonnet 5 是 Claude Sonnet 5.5(Anthropic 最新的 Sonnet,2026 年 9 月 28 日发布)之前的一代 Sonnet,默认且最大都是 100 万 token 上下文窗口(没有更小的上下文变体)、最大 128K 输出 token、自适应思维,工具与平台功能与 Claude Sonnet 4.6 相同,唯一例外是不支持优先级(Priority Tier)。在 APIMODELS 上 $1.60 输入 / $8.00 输出(每百万 token,较官方 $2/$10 低 20%),并支持提示词缓存(缓存命中 $0.10/M、缓存写入 $1.40/M);计费的输出 token 含模型内部思考 token,与 Anthropic 官方口径一致。通过 Anthropic Messages API(/v1/messages)提供原生工具调用,Claude Code、Anthropic SDK 及 Cursor 等 Anthropic 兼容客户端可直接接入,请求参数与 Opus 4.8 一致。
API Documentation
View complete API reference with all parameters and examples.
Advanced Features
Streaming
Enable real-time streaming responses with Server-Sent Events.
{
"model": "claude-sonnet-5",
"stream": true,
"max_tokens": 1024,
"messages": [...]
}Function Calling (Tools)
Enable Claude to use tools and call functions.
{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"tools": [{
"name": "get_weather",
"description": "Get current weather for a location",
"input_schema": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}],
"tool_choice": {"type": "auto"},
"messages": [{"role": "user", "content": "What's the weather in Tokyo?"}]
}PDF Support
Analyze PDF documents by sending them as base64 encoded content.
{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"messages": [{
"role": "user",
"content": [{
"type": "document",
"source": {
"type": "base64",
"media_type": "application/pdf",
"data": "<base64_encoded_pdf>"
}
}, {
"type": "text",
"text": "Summarize this document."
}]
}]
}Structured Output (JSON Schema)
Get structured JSON responses that match your schema.
{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"output_format": {
"type": "json_schema",
"schema": {
"type": "object",
"properties": {
"name": {"type": "string"},
"age": {"type": "integer"}
},
"required": ["name", "age"]
}
},
"messages": [{"role": "user", "content": "Extract info: John is 30 years old"}]
}Web Search
Enable Claude to search the web for up-to-date information.
{
"model": "claude-sonnet-5",
"max_tokens": 1024,
"tools": [{
"type": "web_search_20250305",
"name": "web_search",
"max_uses": 5
}],
"messages": [{"role": "user", "content": "What's the latest news about AI?"}]
}API Parameters Reference
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model identifier (e.g., claude-sonnet-5) |
| messages | array | Yes | Array of message objects with role and content |
| max_tokens | integer | Yes | Maximum tokens in the response (1 - 128000) |
| system | string | No | System prompt to set context |
| stream | boolean | No | Enable streaming responses (SSE) |
| temperature | number | No | Sampling temperature (0.0 - 1.0) |
| top_p | number | No | Nucleus sampling threshold (0.0 - 1.0) |
| top_k | integer | No | Top-k sampling (0 - infinity) |
| stop_sequences | array | No | Sequences that stop generation |
| tools | array | No | Function calling tools definition |
| tool_choice | object | No | Tool selection strategy (auto/any/tool) |
| thinking | object | No | Enable extended thinking mode |
| output_format | object | No | Structured output with JSON schema |
Full API Documentation
View complete API reference with streaming, thinking, and more.
Pricing
Billing: Cost = (input_tokens * input_price + output_tokens * output_price) / 1,000,000
1M Token Context
Default and maximum — no smaller variant
Adaptive Thinking
Extended reasoning when the task needs it
128K Max Output
Long, complete responses in one call
Tools + Claude Code / Cursor
Native tool use via the Anthropic Messages API
关于 Claude Sonnet 5
Claude Sonnet 5 是由 Anthropic 提供的大语言模型 API。Claude Sonnet 5 是 Claude Sonnet 5.5(Anthropic 最新的 Sonnet,2026 年 9 月 28 日发布)之前的一代 Sonnet,默认且最大都是 100 万 token 上下文窗口(没有更小的上下文变体)、最大 128K 输出 token、自适应思维,工具与平台功能与 Claude Sonnet 4.6 相同,唯一例外是不支持优先级(Priority Tier)。在 APIMODELS 上 $1.60 输入 / $8.00 输出(每百万 token,较官方 $2/$10 低 20%),并支持提示词缓存(缓存命中 $0.10/M、缓存写入 $1.40/M);计费的输出 token 含模型内部思考 token,与 Anthropic 官方口径一致。通过 Anthropic Messages API(/v1/messages)提供原生工具调用,Claude Code、Anthropic SDK 及 Cursor 等 Anthropic 兼容客户端可直接接入,请求参数与 Opus 4.8 一致。 通过 APIMODELS 平台,您可以使用统一的 API 接口调用该模型,按量计费、价格透明。当前定价:Input: $1.60, Output: $8.00 per 1M tokens。
核心功能
- 1M Token Context -- Default and maximum — no smaller variant
- Adaptive Thinking -- Extended reasoning when the task needs it
- 128K Max Output -- Long, complete responses in one call
- Tools + Claude Code / Cursor -- Native tool use via the Anthropic Messages API
适用场景
聊天机器人与客服
构建智能对话系统,自动回答用户问题,提升客户服务效率。
内容生成
自动撰写文章、邮件、广告文案等文本内容,提高内容产出效率。
编程助手
辅助代码编写、调试和代码审查,加速软件开发流程。
数据分析
理解和分析非结构化数据,提取关键信息并生成报告摘要。
为什么选择 APIMODELS
- 统一 API 接口 -- 一个 API Key 调用所有模型,无需分别注册各平台账号
- 价格透明 -- 按量计费,每个模型页公开单次调用价格,适合小微开发者和初创团队
- 即开即用 -- 注册即可使用,支持支付宝、PayPal、银行卡和 USDT 充值
- 完整文档 -- 提供详细的 API 文档和代码示例(cURL、Python、Node.js)
常见问题
如何使用 Claude Sonnet 5 API?
在 APIMODELS 注册账号并获取 API Key,然后通过我们的统一 API 端点调用即可。我们提供详细的 API 文档和 cURL、Python、Node.js 代码示例。
APIMODELS 与 Anthropic 官方 API 有什么区别?
APIMODELS 通过聚合平台提供与官方相同的 Claude Sonnet 5 模型。我们提供统一的 API 接口,无需分别注册各平台账号,一个 API Key 即可调用所有模型。
Claude Sonnet 5 是什么、有什么特别?
Claude Sonnet 5 是 Claude Sonnet 5.5(Anthropic 最新的 Sonnet,2026 年 9 月 28 日发布)之前的一代 Sonnet 模型:默认且最大都是 100 万 token 上下文(没有更小的上下文变体)、最大 128K 输出 token、自适应思维,工具与平台功能与 Claude Sonnet 4.6 相同——唯一例外是不支持优先级(Priority Tier)。在 apimodels.app 上 $1.60 输入 / $8.00 输出(每 1M token,较官方价低 20%),兼顾能力与低价。
Sonnet 5 能在 Claude Code / Cursor 里用吗?支持工具/函数调用吗?
支持工具调用(function calling)。Sonnet 5 通过 Anthropic Messages API(/v1/messages)提供原生 tool_use——这正是 Claude Code 与 Anthropic SDK 的调用方式:把 ANTHROPIC_BASE_URL 指向 https://api.apimodels.app、模型设为 claude-sonnet-5、填入 apimodels API Key 即可(详见 /docs/claude-code)。Cursor 等支持 Anthropic API 的客户端,按"自定义 Anthropic 模型"接入同样可用。工具需用 Anthropic 格式({name, input_schema}),请求参数与 Claude Opus 4.8 完全一致。
Sonnet 5 的价格?有缓存优惠吗?
输入 $1.60 / 输出 $8.00(每 1M token)。支持提示词缓存:缓存命中(读取)按 $0.1/M 计费,比输入价便宜 16 倍;缓存写入按 $1.4/M。100 万 token 长上下文 + 缓存,特别适合长文档、长会话与 agentic 编码。
Sonnet 5、Sonnet 5.5、Sonnet 4.6、Opus 4.8 怎么选?
最新的 Sonnet 是 Sonnet 5.5(claude-sonnet-5-5):在我们这里 $1.20/$6.00,输入输出都比 Sonnet 5 的 $1.60/$8.00 低,Anthropic 称它比 Sonnet 5 快 30% 以上、单任务成本最多低 30%,新项目建议直接用它。Sonnet 5 仍可用,适合已经在上面调好提示词、暂不想迁移的项目,或缓存很重的负载(它的缓存读写价略低)。Sonnet 4.6 是更早一代;Opus 4.8($3/$13)用于最难的长程 agentic 推理。几者共用一个 API Key,可按任务随时切换。
Claude Sonnet 5 支持哪些能力?
Claude Sonnet 5 支持:1M Context、Adaptive Thinking、128K Output、Tool Calling。完整参数与调用方式见 APIMODELS 的 API 文档。
国内能直接调用 Claude Sonnet 5 API 吗?需要代理吗?
能直接调用,不需要代理。apimodels.app 和 api.apimodels.app 在中国大陆可以直接访问,注册后用一个 API Key 就能调用 Claude Sonnet 5;不用单独注册模型厂商的账号,也不需要海外信用卡,支付宝就能充值。
怎么充值?支持哪些付款方式?
支持支付宝、PayPal、银行卡(Visa、Mastercard 等,经 Stripe 支付),以及 USDT(TRON 链 TRC20 或 BNB Smart Chain 链 BEP20)。支付宝、PayPal 和银行卡付款后即时到账,USDT 在链上转账确认后到账;也可以开启自动充值。单次充 $50 送 $1,充 $100 送 $3。余额按美元计,按量扣费,没有月费。
相关模型
相关阅读
接入方式、地区可用性,以及和同类模型的横向对比。
- DeepSeek Harness 接入 Claude / GPT / Gemini —— 一段配置搞定
- 国内如何调用 Claude API(免翻墙、免认证)
- base_url 到底怎么填:OpenAI SDK 带 /v1、Anthropic SDK 用根域名、Gemini 原生走 /v1beta
- Claude API 价格对比(2026)—— Fable 5.2 / Opus 5.5 / Sonnet 5.5 / Haiku 5.5 实测
- Claude Opus 5.5 vs Sonnet 5.5(以及 Sonnet 5):跑分、价格与怎么选
- Claude Sonnet 5.5 价格:每百万 token $2 / $10、缓存价与单任务真实成本(2026)