ModelSell 文档
聊天系列Claude

Claude 格式

Anthropic Claude Messages API 兼容请求。需要在请求头中包含 `anthropic-version`。

POST
/v1/messages

Anthropic Claude Messages API 兼容请求。需要在请求头中包含 anthropic-version

Authorization

bearerAuth
AuthorizationBearer <token>

使用 Authorization Bearer API Key 进行鉴权。

In: header

Header Parameters

anthropic-version*string

Anthropic API 版本。

x-api-key?string

可选的 Anthropic 风格 API Key 请求头,也可使用 Bearer Token。

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST "https://example.com/v1/messages" \  -H "anthropic-version: 2023-06-01" \  -H "Content-Type: application/json" \  -d '{    "model": "claude-sonnet-4-5-20250929",    "max_tokens": 1024,    "messages": [      {        "role": "user",        "content": "你好,请用一句话介绍 ModelSell。"      }    ]  }'
{
  "id": "msg_123",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "string",
      "image_url": {},
      "inline_data": {}
    }
  ],
  "model": "string",
  "stop_reason": "string",
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "input_tokens": 0,
    "output_tokens": 0
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "request_id": "string"
  }
}
{
  "error": {
    "code": "string",
    "message": "string",
    "request_id": "string"
  }
}