Skip to content
API Reference

Messages API

The Messages API is the primary interface for interacting with Claude models. It supports structured multi-turn conversations, system prompts, image inputs, and advanced features like extended thinking and tool calling.

POST https://llm.siraya.ai/v1/messages

Body

model string Required
The model ID (e.g., `claude-sonnet-4.5`).
messages array Required
An array of input messages (roles: `user`, `assistant`). Content blocks can carry `cache_control` (see [Prompt Caching](../../features/prompt-caching.md#anthropic-claude)), and PDFs can be sent as `document` blocks (see [PDF Inputs](../../features/multimodal-input/pdf-inputs.md#using-the-messages-api-claude)). Claude 4.6 and later do not accept a trailing `assistant` message (prefill).
max_tokens integer Required
The maximum number of tokens to generate.
system string/array
A system prompt to provide context or instructions.
temperature number
Amount of randomness (0.0 to 1.0). Send only one of `temperature` and `top_p`. Claude 4.7 and later ignore `temperature` (other than 1), `top_p` and `top_k`.
stream boolean
Whether to use server-sent events for streaming.
thinking object
Configuration for extended thinking. See [Per-Model Details](../../models/per-model-details.md#claude-4) for how `type` and `budget_tokens` are applied to each Claude model.
tools array
Definitions of tools for the model to use.
import anthropic

client = anthropic.Anthropic(
    base_url="https://llm.siraya.ai",
    api_key="<API_KEY>"
)

message = client.messages.create(
    model="claude-sonnet-4.5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "How are you"}]
)
print(message.content)
curl https://llm.siraya.ai/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "model": "claude-sonnet-4.5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "How are you"}]
  }'

Example Response

{
  "id": "msg_2fXk9QmR7vT3bY8nLpZaW1",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "I'm doing well, thank you for asking! I'm here and ready to help you with whatever you need. How are you doing today? Is there anything I can assist you with?"
    }
  ],
  "model": "claude-sonnet-4.5",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 39,
    "output_tokens": 38,
    "cache_read_input_tokens": 0,
    "cache_creation_input_tokens": 0
  }
}