跳转到主要内容
POST

Claude 消息接口

Claude Messages 接口保留 Anthropic 原生请求结构,适合已有 Claude SDK 或原生提示词结构的业务迁移。路由会进入 Claude relay 格式,并根据渠道分发到对应上游。

认证

也可以使用 Claude 原生请求头:

请求体

model
string
必填
Claude 模型名称。
messages
array<object>
必填
对话消息数组。Claude 原生格式中消息角色通常为 userassistant
system
string | array<object>
系统提示词。Claude 不使用 system 角色消息,而是通过该字段传递系统指令。
max_tokens
integer
最大输出 token 数。多数 Claude 请求都应显式传入。
stream
boolean
是否启用 SSE 流式输出。
temperature
number
采样温度。
top_p
number
核采样参数。
top_k
integer
Top-K 采样参数。
stop_sequences
array<string>
停止序列。
tools
array<object>
Claude 工具列表,通常包含 namedescriptioninput_schema
tool_choice
object
控制工具选择策略,例如 { "type": "tool", "name": "get_weather" }
thinking
object
扩展思考配置,例如 { "type": "enabled", "budget_tokens": 10000 }
metadata
object
业务侧元数据,例如 user_id

请求示例

多模态输入

工具调用

响应示例

相关接口