Anthropic
创建消息 —— Anthropic API 标准路径
Claude Code 兼容的标准 Anthropic Messages API 路径。
授权
ApiKeyAuth x-api-key<token>
位置: header
请求主体
application/json
TypeScript 定义
在 TypeScript 中使用 request body 类型。
响应主体
application/json
application/json
application/json
curl -X POST "https://example.com/anthropic/v1/messages" \ -H "Content-Type: application/json" \ -d '{ "model": "string", "max_tokens": 0, "messages": [ { "role": "user", "content": "string" } ] }'{ "id": "string", "type": "message", "role": "assistant", "model": "string", "content": [ { "type": "text", "text": "string", "source": { "type": "base64", "media_type": "image/jpeg", "data": "string", "url": "string" }, "id": "string", "name": "string", "input": {}, "tool_use_id": "string", "is_error": true, "thinking": "string", "signature": "string", "data": "string", "cache_control": { "type": "ephemeral" } } ], "stop_reason": "end_turn", "stop_sequence": "string", "usage": { "input_tokens": 0, "output_tokens": 0, "cache_creation_input_tokens": 0, "cache_read_input_tokens": 0 }}