Claude Platform Docs
  • 消息
  • 托管智能体
  • 管理

Search...
⌘K
模型
模型概览模型 ID 与版本控制选择模型Claude Fable 5 和 Claude Mythos 5 介绍Claude Opus 4.8 新功能Claude Sonnet 5 新功能在模型版本之间升级模型弃用模型卡片系统提示定价

Log in
Claude Sonnet 5 新功能
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Claude Platform Docs

Solutions

  • AI agents
  • Code modernization
  • Coding
  • Customer support
  • Education
  • Financial services
  • Government
  • Life sciences

Partners

  • Claude on AWS
  • Claude on Google Cloud

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Company

  • Anthropic
  • Careers
  • Economic Futures
  • Research
  • News
  • Responsible Scaling Policy
  • Security and compliance
  • Transparency

Learn

  • Blog
  • Courses
  • Use cases
  • Connectors
  • Customer stories
  • Engineering at Anthropic
  • Events
  • Powered by Claude
  • Service partners
  • Startups program

Help and security

  • Availability
  • Status
  • Support
  • Discord

Terms and policies

  • Privacy policy
  • Responsible disclosure policy
  • Terms of service: Commercial
  • Terms of service: Consumer
  • Usage policy
模型与定价/模型

Claude Sonnet 5 的新特性

Claude Sonnet 5 中新功能和行为变更的概述。

Claude Sonnet 5 是 Anthropic Sonnet 模型系列的新一代产品。它是 Claude Sonnet 4.6 的直接升级替代版本,包含三项行为变更:adaptive thinking(自适应思考)默认开启;手动扩展思考现在会返回 400 错误(该功能在 Claude Sonnet 4.6 中已被弃用);将采样参数(temperature、top_p、top_k)设置为非默认值会返回 400 错误。本页面总结了发布时的所有新内容,包括新的分词器。

新模型

模型API 模型 ID描述
Claude Sonnet 5claude-sonnet-5速度与智能的最佳结合

Claude Sonnet 5 默认支持 100 万令牌上下文窗口(100 万令牌既是默认值也是最大值;没有更小的上下文变体)、128k 最大输出令牌、自适应思考,以及与 Claude Sonnet 4.6 相同的工具集和平台功能,但 Priority Tier(优先级层级)除外,该功能在 Claude Sonnet 5 上不可用。

有关完整的定价和规格信息,请参阅模型概述。

行为变更

自适应思考默认开启

在 Claude Sonnet 4.6 上,不带 thinking 字段的请求会在不启用思考的情况下运行。在 Claude Sonnet 5 上,相同的请求会以自适应思考模式运行。要关闭思考功能,请传递 thinking: {type: "disabled"}。由于 max_tokens 是总输出(思考内容加响应文本)的硬性限制,对于在 Claude Sonnet 4.6 上未启用思考运行的工作负载,请重新审视该参数。

不接受采样参数

将 temperature、top_p 或 top_k 设置为非默认值会返回 400 错误。迁移时请移除这些参数;使用默认值(或省略该参数)是可以接受的。请使用系统提示指令来引导模型行为。这对于 Sonnet 级别的模型是新变化;相同的限制此前已在 Claude Opus 4.7 上引入。

手动扩展思考已移除

手动扩展思考(thinking: {type: "enabled", budget_tokens: N})在 Claude Sonnet 4.6 中已被弃用;在 Claude Sonnet 5 上该功能已被移除并会返回 400 错误,与 Claude Opus 4.8 和 Claude Opus 4.7 上的行为相同。请改用带有 effort 参数的自适应思考。

Python
# Claude Sonnet 5 不支持此参数(返回 400)
thinking = {"type": "enabled", "budget_tokens": 32000}

# 请改用此参数
thinking = {"type": "adaptive"}

新的分词器

Claude Sonnet 5 使用新的 "tokenizer"(分词器)。相同的输入文本产生的令牌数量比 Claude Sonnet 4.6 多约 30%。这不是 API 变更:请求、响应和流式传输事件保持相同的结构,无需更改代码。

此变更会影响您以令牌为单位衡量或预算的所有内容:

  • 令牌计数: 对于相同的文本,usage 字段和令牌计数结果会高于 Claude Sonnet 4.6。不要重复使用针对早期模型测量的计数;请针对 Claude Sonnet 5 重新计数。
  • 以文本量衡量的上下文窗口容量: 上下文窗口为 100 万令牌,但平均每个令牌覆盖的文本更少,因此相同的窗口容纳的文本比 Claude Sonnet 4.6 少。
  • max_tokens 预算: 针对 Claude Sonnet 4.6 调优的输出限制可能会在 Claude Sonnet 5 上截断等效的输出。请重新审视那些设置得接近预期输出长度的限制。
  • 单次请求成本: 每令牌定价保持不变(请参阅定价),但由于相同的文本会产生更多令牌,等效请求的成本可能与 Claude Sonnet 4.6 不同。

从 Claude Sonnet 4.6 继承的 API 约束



此约束与 Claude Sonnet 4.6 相比没有变化。除了三项行为变更(请参阅迁移指南)之外,已在 Claude Sonnet 4.6 上运行的代码无需其他更改。

不支持助手消息预填充

预填充助手消息会返回 400 错误,与 Claude Sonnet 4.6 相同。请改用结构化输出、系统提示指令或 output_config.format。

能力提升

Claude Sonnet 5 是 Claude Sonnet 4.6 在相同价格下的能力升级版本。对于需要比 Claude Sonnet 4.6 更强能力但又不想升级到 Opus 级别模型的工作负载,它也是一个可选方案。

相比 Claude Sonnet 4.6,最大的提升体现在编码和智能体任务方面。有关基准测试结果,请参阅 Anthropic 透明度中心。

网络安全防护措施

Claude Sonnet 5 是首个具备实时网络安全防护措施的 Sonnet 级别模型。涉及被禁止或高风险网络安全主题的请求可能会被拒绝。拒绝会以成功的 HTTP 200 响应返回,其中 stop_reason: "refusal",而不是错误。有关背景信息,请参阅防护措施、警告和申诉。

定价

Claude Sonnet 5 的定价为每百万输入令牌 3 美元、每百万输出令牌 15 美元,与 Claude Sonnet 4.6 相同。由于新的分词器对相同文本产生的令牌数量多约 30%,即使每令牌定价不变,等效请求的成本也可能与 Claude Sonnet 4.6 不同。

每百万输入/输出令牌 2 美元/10 美元的推介定价有效期至 2026 年 8 月 31 日,此后将恢复每百万输入/输出令牌 3 美元/15 美元的标准定价。

有关完整定价信息(包括批处理和提示缓存费率),请参阅定价。

可用性

发布时,Claude Sonnet 5 可在以下平台使用:

  • Claude API: 面向所有客户提供。
  • AWS: 通过 Amazon Bedrock 中的 Claude 和 AWS 上的 Claude Platform 提供。Claude Sonnet 5 在 Amazon Bedrock 上的 Claude(旧版)(即 InvokeModel 和 Converse API)上不可用。
  • Google Cloud: 通过 Google Cloud 上的 Claude 提供。
  • Microsoft Foundry(预览版): 通过 Microsoft Foundry 中的 Claude 提供。

对于签订了 ZDR 协议的组织,Claude Sonnet 5 支持零数据保留。

迁移指南

Claude Sonnet 5 是 Claude Sonnet 4.6 的直接替代版本。更新您的模型 ID:

model = "claude-sonnet-4-6"  # Before
model = "claude-sonnet-5"  # After

然后检查以下内容:

  1. 令牌预算和计数: 新的分词器对相同文本产生的令牌数量多约 30%。使用令牌计数重新计算提示的令牌数,并重新审视那些设置得接近预期输出长度的 max_tokens 限制。
  2. 扩展思考: 如果您仍在设置 budget_tokens,请迁移到自适应思考。手动扩展思考(thinking: {type: "enabled"})不受支持,会返回 400 错误。
  3. 采样参数: 将采样参数(temperature、top_p、top_k)设置为非默认值的请求会返回 400 错误;迁移时请移除这些参数。工具定义和响应结构保持不变,助手消息预填充在 Claude Sonnet 4.6 上已不受支持。

有关详细信息,请参阅迁移指南中的 Claude Sonnet 5 部分。

后续步骤


模型概述

所有当前 Claude 模型的完整规格和定价。

令牌计数

在迁移之前,使用新的分词器测量您的提示。

自适应思考

Claude Sonnet 5 上推荐的思考开启模式。

上下文窗口

100 万令牌上下文窗口的工作原理。

定价

完整定价信息,包括批处理和提示缓存费率。

Was this page helpful?

  • 新模型
  • 行为变更
  • 自适应思考默认开启
  • 不接受采样参数
  • 手动扩展思考已移除
  • 新的分词器
  • 从 Claude Sonnet 4.6 继承的 API 约束
  • 不支持助手消息预填充
  • 能力提升
  • 网络安全防护措施
  • 定价
  • 可用性
  • 迁移指南
  • 后续步骤