Skip to main content
POST
Claude 消息接口
GregAPI 兼容 Anthropic Messages API,可直接使用官方 SDK 或 cURL 调用。 请求需携带 anthropic-version 头:

请求示例

cURL

Python SDK

TypeScript SDK

构建方式

推荐开发路径

  1. 完成第一次调用:配置环境变量,用 cURL 或 SDK 发出首条请求。
  2. 理解 Messages API:掌握 messages 结构、多轮对话与 stop_reason 等。
  3. 选择模型:通过 GET /v1/models 或控制台确认可用模型。
  4. 扩展能力:工具调用、视觉、结构化输出等以 Anthropic 官方文档为准。

开发资源

  • GregAPI 控制台:创建与管理 API 密钥、查看调用与配额。
  • GregAPI 用户文档:平台能力说明与多产品线导航。
网关行为以 GregAPI 控制台说明为准;Anthropic 原生能力以官方文档为准。

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求头

anthropic-version
string
必填

Anthropic API 版本

示例:

"2023-06-01"

请求体

application/json
model
string
必填

模型名称

max_tokens
integer
必填

最大输出 token 数

messages
object[]
必填

对话消息数组

响应

200

成功返回消息结果