Messages
Anthropic-compatible messages endpoint. Use this if you prefer the Anthropic API format.
POST
/v1/messagesRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model to use (e.g. "claude-sonnet-4-20250514", "gpt-4o") |
messages | array | Yes | Array of message objects. Each message has a role and content (string or content blocks) |
max_tokens | integer | Yes | Maximum number of tokens to generate |
system | string | No | System prompt to guide the model's behavior |
stream | boolean | No | If true, returns a stream of server-sent events. Default: false |
Request Example
curl https://api.osiris.ai/v1/messages \
-H "Authorization: Bearer sk-osiris-YOUR_KEY" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"system": "You are a helpful assistant.",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'Content Blocks
Messages can use content blocks instead of plain strings. This allows structured content like text blocks:
Content blocks format
{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe what you see in this image."
}
]
}
]
}Response Format
The response follows the Anthropic message format with content blocks:
Response
{
"id": "msg_abc123",
"type": "message",
"role": "assistant",
"model": "claude-sonnet-4-20250514",
"content": [
{
"type": "text",
"text": "The capital of France is Paris."
}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 25,
"output_tokens": 12
}
}Streaming
When stream: true, the response is delivered as SSE events in the Anthropic streaming format:
SSE stream format
event: message_start
data: {"type":"message_start","message":{"id":"msg_abc123","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[],"stop_reason":null,"usage":{"input_tokens":12,"output_tokens":0}}}
event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"!"}}
event: content_block_stop
data: {"type":"content_block_stop","index":0}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":2}}
event: message_stop
data: {"type":"message_stop"}Streaming Request
curl https://api.osiris.ai/v1/messages \
-H "Authorization: Bearer sk-osiris-YOUR_KEY" \
-H "Content-Type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "claude-sonnet-4-20250514",
"max_tokens": 1024,
"stream": true,
"messages": [{"role": "user", "content": "Hello!"}]
}'