Messages
The Anthropic-style Messages endpoint, parameters, response shape, and token counting
POST /v1/messages is the Anthropic-style endpoint. It is a drop-in for the anthropic SDK and Claude Code.
Request
Authenticate with x-api-key: sk-ablatic-.... The base URL for this surface is https://api.ablatic.ai.
cURL
curl https://api.ablatic.ai/v1/messages \
-H "x-api-key: $ABLATIC_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "talos",
"max_tokens": 1024,
"messages": [{ "role": "user", "content": "Hello" }]
}'Parameters
| Name | Type | Required | Description |
|---|---|---|---|
model | string | yes | Model id, nonempty |
messages | array | yes | Conversation messages, 1 to 200 |
max_tokens | integer | yes | Max output tokens, 1 to 200000 |
system | string or array | no | System prompt |
metadata | object | no | Request metadata |
stop_sequences | array | no | Accepted but ignored |
stream | boolean | no | Stream over the Anthropic SSE event graph |
temperature | number | no | Sampling temperature, 0 to 2 |
top_p | number | no | Nucleus sampling cutoff |
top_k | integer | no | Top-k sampling cutoff |
tools | array | no | Tool definitions. Uses input_schema |
tool_choice | object | no | Tool selection policy |
thinking | object | no | { "type": ..., "budget_tokens": ... } |
The model name selects the reasoning mode by substring. A name containing haiku maps to fast, sonnet and opus to thinking (opus with the largest reasoning-token budget). Send talos for the default thinking mode. Unknown names map to thinking.
Response
{
"id": "msg_...",
"type": "message",
"role": "assistant",
"model": "talos",
"content": [
{ "type": "text", "text": "Hello. How can I help?" }
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 9,
"output_tokens": 7,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0
}
}The model field echoes the model you sent. usage reports input_tokens, output_tokens, cache_creation_input_tokens, and cache_read_input_tokens.
Behavior notes
response_format is not honored on this surface. There are no structured outputs here. For JSON mode use Chat completions.
- Prompt caching is real and billed. The server caches prompt prefixes automatically. On this surface
cache_controlmarks which prefixes to prime and shapes theusagebreakdown to match Anthropic. Cached reads are billed at a discount and the first write at the normal input rate, with no premium. See Usage and billing. Up to 4cache_controlbreakpoints are kept, extras are truncated. - Prior
thinkingblocks in the input are dropped. - PDF
documentblocks are extracted. URL documents are not fetched.
Count tokens
POST /v1/messages/count_tokens returns an estimate.
{ "input_tokens": 42 }The count is a heuristic (roughly characters divided by 4), not an exact token count.
Batches
POST /v1/messages/batches and its companion endpoints run Anthropic Message Batches. The body is requests[] of { custom_id, params }, with a 29-day result window, a cap of 100000 requests or 256 MiB per batch, and 50 in flight per user. They support Idempotency-Key, and results stream as application/x-ndjson once processing_status is ended. See Batch.