Claude Platform Docs
  • 消息
  • 托管智能体
  • 管理

Search...
⌘K

Log in
Beta 标头
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
API 参考/使用 API

Beta 标头

关于在 Claude API 中使用 Beta 标头的文档

Beta 标头允许您在实验性功能和新模型能力成为标准 API 的一部分之前访问它们。

这些功能可能会发生变化,并可能在未来版本中被修改或移除。



Beta 标头通常与每个客户端 SDK 所公开的 beta 命名空间结合使用。

如何使用 Beta 标头

要访问 Beta 功能,请在您的 API 请求中包含 anthropic-beta 标头:

POST /v1/messages
Content-Type: application/json
X-API-Key: YOUR_API_KEY
anthropic-beta: BETA_FEATURE_NAME

使用 SDK 时,您可以在请求选项中指定 Beta 标头:

client = Anthropic()

response = client.beta.messages.create(
    model="claude-opus-4-8",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello, Claude"}],
    betas=["files-api-2025-04-14"],
)


Beta 功能是实验性的,可能会:

  • 在通知后发生破坏性变更
  • 被弃用或移除
  • 具有不同的速率限制或定价
  • 并非在所有地区都可用

多个 Beta 功能

要在单个请求中使用多个 Beta 功能,请在标头中包含所有功能名称,并以逗号分隔:

anthropic-beta: feature1,feature2,feature3

特定端点的标头

某些 Beta 功能的作用范围是特定端点而非单个请求参数,并且要求在每个请求中包含特定于该功能的 Beta 标头:

端点Beta 标头
/v1/agents、/v1/sessions、/v1/environmentsmanaged-agents-2026-04-01

详情请参阅托管代理概述。

版本命名约定

Beta 功能名称通常遵循以下模式:feature-name-YYYY-MM-DD,其中日期表示该 Beta 版本的发布时间。请始终使用文档中记录的确切 Beta 功能名称。

错误处理

如果您使用了无效或不可用的 Beta 标头,您将收到错误响应:

Output
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "Unsupported beta header: invalid-beta-name"
  }
}

获取帮助

如有关于 Beta 功能的问题:

  1. 查看特定功能的文档
  2. 查阅 API 更新日志以获取更新信息
  3. 联系支持团队以获取生产环境使用方面的帮助

请注意,Beta 功能按"原样"提供,可能不具备与稳定 API 功能相同的 SLA 保证。

Was this page helpful?

  • 如何使用 Beta 标头
  • 多个 Beta 功能
  • 特定端点的标头
  • 版本命名约定
  • 错误处理
  • 获取帮助