Native Claude Format
Anthropic Claude Messages API requests. Requires the anthropic-version header.
Note: Requests must include anthropic-version (e.g. 2023-06-01). Auth via Authorization: Bearer or x-api-key.
Example model
Examples below use claude-3-opus-20240229 (Claude 3 Opus). Replace model and adjust size, quality, etc. per console docs when switching models.
Create message
POST
https://token.easyapi.com/v1/messagesCreate a chat response using the Anthropic Claude Messages API format. Full path: POST /v1/messages.
Request parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Authorization | header | string | Yes | EasyAPI API Key. Format: Bearer `API_KEY` |
Content-Type | header | string | Yes | Request body format, always application/json |
anthropic-version | header | string | Yes | Anthropic API version, required, e.g. 2023-06-01 |
x-api-key | header | string | No | Anthropic API Key (optional; Bearer Token also works) |
Request body
| Name | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID, e.g. claude-3-opus-20240229 |
messages | array<object> | Yes | Conversation messages, each with role and content |
max_tokens | integer | Yes | Max output tokens, must be ≥ 1 |
system | string | array<object> | No | System prompt as string or content block array |
temperature | number | No | Sampling temperature, range 0–1 |
top_p | number | No | Nucleus sampling parameter |
top_k | integer | No | Sample only from the top K tokens |
stream | boolean | No | Enable streaming responses |
stop_sequences | array<string> | No | Custom stop sequences |
tools | array<object> | No | Tool definitions the model may call |
tool_choice | object | No | Tool selection strategy |
thinking | object | No | Extended thinking config (for supported models) |
metadata | object | No | Request metadata |
Example
{
"model": "claude-3-opus-20240229",
"messages": [
{
"role": "user",
"content": "Hello!"
}
],
"max_tokens": 1024
}Response example
{
"id": "msg_01XFDUDYJgAACzvnptvVoYEL",
"type": "message",
"role": "assistant",
"content": [
{
"type": "text",
"text": "Hello! How can I help you today?"
}
],
"model": "claude-3-opus-20240229",
"stop_reason": "end_turn",
"usage": {
"input_tokens": 10,
"output_tokens": 20,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}