POST /v1/messages
Anthropic-compatible message creation. Use the official anthropic SDK
with the gateway base URL — and call any catalog model through it, not
just Claude.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
model | string | required | Catalog model id. |
messages | array | required | user / assistant turns; content is a string or content-block array. |
max_tokens | integer | required | Anthropic surface requires an explicit cap. |
system | string | System prompt. | |
stream | boolean | Stream Anthropic-style events over SSE. | |
tools | array | Anthropic tool definitions. |
Example
- Request
- Python SDK
curl https://gateway.oya.moe/v1/messages \
-H "Authorization: Bearer $ARKAFLOW_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-opus-4-7",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello!"}]
}'
# pip install anthropic
from anthropic import Anthropic
client = Anthropic(
base_url="https://gateway.oya.moe",
api_key="sk-arka-…",
)
msg = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello!"}],
)
print(msg.content[0].text)
Cross-surface behaviour
The two surfaces are interchangeable views over the same catalog: a model
called via /v1/messages bills and routes identically to the same model
via /v1/chat/completions. Pick the surface your codebase already speaks.
Errors use the shared vocabulary — see Errors.