Claude Messages 基础接口
Claude Messages 原生入口。流式、工具调用、结构化输出、文档读取、部分模型的联网搜索和 thinking 参数,都按 Claude 的结构提交。
请求格式
使用 application/json。通常包含 model、max_tokens 和 messages。多模态输入放在 messages[].content 的内容块中。
适用位置
- 已经在用 Claude SDK 或 Anthropic 风格协议。
- 不想做 Chat Completions 字段转换。
- 需要文档阅读、工具调用或 thinking 参数。
验证顺序
- 用基础的
model+messages请求确认鉴权。 - 流式输出加
stream: true。 - 读 PDF、调工具、结构化输出时,补对应内容块和工具定义。
读取结果
非流式请求返回 Claude Messages 响应对象。工具调用会出现在内容块中,应用服务需要执行工具并继续回填工具结果。
POST
Authorizations
在请求头中传入:Authorization: Bearer sk-...
Body
application/json
The body is of type object.
Response
响应结果
The response is of type object.