Docs
API Reference

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

NameTypeRequiredDescription
modelstringyesModel id, nonempty
messagesarrayyesConversation messages, 1 to 200
max_tokensintegeryesMax output tokens, 1 to 200000
systemstring or arraynoSystem prompt
metadataobjectnoRequest metadata
stop_sequencesarraynoAccepted but ignored
streambooleannoStream over the Anthropic SSE event graph
temperaturenumbernoSampling temperature, 0 to 2
top_pnumbernoNucleus sampling cutoff
top_kintegernoTop-k sampling cutoff
toolsarraynoTool definitions. Uses input_schema
tool_choiceobjectnoTool selection policy
thinkingobjectno{ "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_control marks which prefixes to prime and shapes the usage breakdown 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 4 cache_control breakpoints are kept, extras are truncated.
  • Prior thinking blocks in the input are dropped.
  • PDF document blocks 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.

Next