Skip to content

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`).
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).
stream boolean
Whether to use server-sent events for streaming.
thinking object
Configuration for extended thinking (Claude 4.5+).
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 "x-api-key: <API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4.5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "How are you"}]
  }'

Example Response

{
  "id": "msg_9a...",
  "content": [
    {
      "thinking": "This is a simple greeting asking how I am. I should respond in a friendly and helpful way while being genuine.",
      "type": "thinking"
    },
    {
      "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?",
      "type": "text"
    }
  ],
  "model": "claude-sonnet-4.5",
  "role": "assistant",
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "type": "message",
  "usage": {
    "input_tokens": 39,
    "output_tokens": 72
  }
}