docs
API

Messages

Markdown

The Anthropic Messages format. Used by Claude Code, the Anthropic SDK, and many agents.

Full guide
POSThttps://api.ailoot.ai/v1/messages
Messages
curl https://api.ailoot.ai/v1/messages \
  -H "x-api-key: $AILOOT_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello! What can you do?"}]
  }' 
200 OK
{
  "id": "msg_01H…",
  "type": "message",
  "role": "assistant",
  "model": "claude-sonnet-5-5",
  "content": [
    { "type": "text", "text": "Hello! I can write and explain code, answer questions…" }
  ],
  "stop_reason": "end_turn",
  "usage": { "input_tokens": 14, "output_tokens": 52 }
}

Authentication

  • x-api-keyheaderrequired

    Key sk-…. You can also use Authorization: Bearer sk-… — this is what Claude Code uses with ANTHROPIC_AUTH_TOKEN.

  • anthropic-versionheaderoptional

    API version, for example 2023-06-01. SDKs send it automatically.

Request body

  • modelstringrequired

    Model ID that supports the Messages format — 776 IDs: Claude, as well as GPT, Gemini, DeepSeek, Qwen, and others.

  • messagesarrayrequired

    Messages user and assistant; content — a string or blocks (text, image, tool_use, tool_result).

  • max_tokensintegerrequired

    Maximum number of response tokens. Included in the reserve; if your balance is too low for the full limit, Ailoot reduces it, but never below 256 (1025 with thinking enabled), and reports the new limit in the header X-Ailoot-Max-Tokens-Capped.

  • systemstring | arrayoptional

    System instruction.

  • streambooleanoptional

    SSE event stream (message_start, content_block_delta, …, message_stop). Billable text is delivered in a single block after the cost is calculated.

  • temperaturenumberoptional

    Response randomness, from 0 to 1.

  • toolsarrayoptional

    Tools: name, description, input_schema.

  • tool_choiceobjectoptional

    auto, any, tool or none.

  • thinkingobjectoptional

    {"type": "enabled", "budget_tokens": N} — thinking for models that support it.

  • stop_sequencesarrayoptional

    Strings that stop generation.

Response

  • contentarray

    Response blocks: text, thinking, tool_use.

  • stop_reasonstring

    end_turn, max_tokens, stop_sequence or tool_use.

  • usageobject

    input_tokens, output_tokens, for caching — cache_read_input_tokens and cache_creation_input_tokens.

Still have questions? Send your Request ID and a description — we'll help you troubleshoot.Contact support