Anthropic Messages
Anthropic Messages API surface.
01概述
Accepts Anthropic Messages requests and translates them through CAPI's shared chat relay. Existing clients can use the Anthropic request shape; tool use, image input, streaming, and other model-specific features depend on the configured upstream. Anthropic-only features are not guaranteed to map to every OpenAI-compatible channel.
POST
/v1/messagesBase URL https://capi.minapp.xinAPI 版本 v1认证方式 Bearer YOUR_API_TOKEN
02参数
| 名称 | 类型 | 说明 |
|---|---|---|
| model* | string | Claude model ID. |
| messages* | array | Messages in Anthropic format. |
| max_tokens* | integer | Upper bound on generated tokens. |
| system | string | content blocks | System prompt in Anthropic format. |
03请求体
JSON
{
"model": "claude-opus-5",
"max_tokens": 1024,
"messages": [
{ "role": "user", "content": "Explain the CAP theorem." }
]
}示例
Anthropic Messages
cURL
curl -X POST https://capi.minapp.xin/api/v1/messages \
-H "x-api-key: YOUR_API_TOKEN" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-5",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'HTTP 200· OK
{
"id": "msg_7c41ab",
"type": "message",
"role": "assistant",
"content": [{ "type": "text", "text": "..." }],
"stop_reason": "end_turn",
"usage": { "input_tokens": 18, "output_tokens": 240 }
}