Appearance
Are you an LLM? You can read better optimized documentation at /docs/api/anthropic-messages.md for this page in Markdown format
Anthropic Messages
POST /v1/messages
Anthropic Messages API compatible endpoint.
See Anthropic's documentation for the full request and response specification.
INFO
For compatibility with Claude Code and other compatible agents, the /v1/messages endpoint also supports the X-Api-Key header for authentication.
Request
bash
curl https://hyper.charm.land/v1/messages \
-H "x-api-key: sk-hyper-xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-pro",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello!"}
]
}'| Field | Type | Required | Description |
|---|---|---|---|
model | string | yes | Model ID from /v1/models |
max_tokens | integer | yes | Max output tokens |
messages | array | yes | Array of message objects |
system | string or array | no | System prompt |
stream | boolean | no | Set true for SSE streaming |
All standard Anthropic parameters are accepted.
Response
json
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"content": [
{"type": "text", "text": "Hey there!"}
],
"model": "deepseek-v4-pro",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 10,
"output_tokens": 5
}
}Errors
All errors use the Anthropic error format:
json
{
"type": "error",
"error": {
"type": "...",
"message": "..."
}
}| Status | error.type | Cause |
|---|---|---|
| 400 | invalid_request_error | Invalid JSON, missing model, messages, or max_tokens, context window exceeded |
| 401 | authentication_error | Missing or invalid x-api-key |
| 403 | permission_error | Forbidden |
| 404 | not_found_error | Model not found |
| 429 | rate_limit_error | Rate limit exceeded |
| 5xx | api_error | Upstream provider failure |
