跳转到主要内容
POST
Anthropic
Anthropic Claude 模型覆盖编程、长周期 Agent、研究、视觉和知识工作。本页 Playground 使用 Anthropic Messages,所有 Claude 模型都支持该格式。

模型

  • claude-opus-5-5 — Claude Opus 5.5。
  • claude-sonnet-5-5 — Claude Sonnet 5.5。
  • claude-haiku-5-5 — Claude Haiku 5.5,适用于分类、信息抽取、摘要和子 Agent 的轻量模型,上下文 1M token。
  • claude-fable-5-1 — Claude Fable 5.1,适用于长周期编程、研究和视觉,上下文 1M,输出最多 128K。
  • claude-opus-5 — Claude Opus 5,适用于高级编程、计算机操作和深度研究。
  • claude-sonnet-5 — Claude Sonnet 5,适用于 Agent 编程以及浏览器或计算机操作,上下文 1M,输出最多 128K。
  • claude-opus-4-8 — Claude Opus 4.8,上下文 1M,输出最多 128K。
  • claude-opus-4-7 — Claude Opus 4.7,适用于编程、深度推理和高分辨率视觉。
  • claude-opus-4-6 — Claude Opus 4.6。
  • claude-sonnet-4-6 — Claude Sonnet 4.6。
  • claude-opus-4-5-20251101 — Claude Opus 4.5。
  • claude-sonnet-4-5-20250929 — Claude Sonnet 4.5。
  • claude-haiku-4-5-20251001 — Claude Haiku 4.5。
所有 Claude 模型都支持 Anthropic Messages 和 Chat Completions。

示例

  • 基础 Claude 消息 — 单条用户消息加 max_tokens。
流式输出、扩展思考和工具使用的示例见 Anthropic Messages。如需以 Chat Completions 格式调用模型,把相同的 model id 发送到 Chat Completions。

注意事项

  • 全部模型及其支持的格式见 LLM 模型。

授权

x-api-key
string
header
必填

API Key 认证。该接口也接受 Authorization: Bearer YOUR_API_KEY。

创建 API Key:登录 PoYo,进入 仪表盘 → API 密钥(poyo.ai/zh/dashboard/api-key),点击创建 Key。

在请求头中添加:

请求体

application/json
model
enum<string>
默认值:claude-sonnet-4-5-20250929
必填

Anthropic Claude 模型 ID。

可用选项:
claude-opus-5-5,
claude-sonnet-5-5,
claude-haiku-5-5,
claude-fable-5-1,
claude-opus-5,
claude-sonnet-5,
claude-opus-4-8,
claude-opus-4-7,
claude-opus-4-6,
claude-sonnet-4-6,
claude-opus-4-5-20251101,
claude-sonnet-4-5-20250929,
claude-haiku-4-5-20251001
messages
object[]
必填

按顺序排列的对话消息列表。每条消息包含 role 和 content。user 用于用户输入,assistant 用于多轮对话中模型之前的输出。示例:[{"role": "user", "content": "Summarize the purpose of feature canary releases in two sentences."}]。

max_tokens
integer

生成的最大 token 数。

必填范围: x >= 1
示例:

1024

system

助手的系统提示词。支持字符串或结构化文本块。

示例:

"You are a product announcement editor, keep it objective and concise."

cache_control
object

顶层缓存控制会自动为请求中最后一个可缓存块添加 cache_control 标记。

stream
boolean

是否使用流式输出。

示例:

false

stop_sequences
string[]

停止序列。模型遇到其中任一字符串时停止。

metadata
object

附加元数据,例如 user_id。

output_config
object

模型输出的配置选项,例如输出格式和投入程度(effort)。

thinking
object

Claude 扩展思考配置。支持扩展思考的 Claude 模型可用。思考 token 计入 max_tokens。

tools
object[]

模型可用的工具定义。

tool_choice

控制工具使用行为。示例:auto,或 {"type": "tool", "name": "get_weather"} 这样的对象。

示例:

"auto"

响应

消息已创建

id
string
示例:

"msg_013zva2CMHNLnXJNN3QKQ2EF"

type
string
示例:

"message"

role
string
示例:

"assistant"

content
object[]
model
string
示例:

"claude-sonnet-4-5-20250929"

stop_reason
string
示例:

"end_turn"

stop_sequence
string | null
usage
object