Messages.
The Anthropic Messages dialect on the lx1 catalog — the surface Claude Code and the Anthropic SDKs speak. Content blocks, tools, vision, and PDFs, with SSE streaming.
Endpoint
/v1/messagesAuthenticate with x-api-key: lx1_... (a bearer token also works). Any model in the catalog is valid in model.
Request parameters
| Parameter | Type | Notes |
|---|---|---|
model | string · required | Any catalog id, e.g. lx1-sonnet-4.6. |
max_tokens | integer · required | Output ceiling. On reasoning models, hidden reasoning counts against it — budget generously. |
messages | array · required | Alternating turns. Content is a string or an array of blocks: text, image (base64), document (PDF), tool_result. |
system | string | array | System prompt. |
tools | array | Tool definitions with JSON-schema input. See Tool calling. |
tool_choice | object | { "type": "auto" | "any" | "tool" }. |
temperature | number | Sampling temperature. |
top_p | number | Nucleus sampling. |
stop_sequences | string[] | Custom stop sequences. |
stream | boolean | Anthropic SSE event stream when true. |
Image blocks and PDF document blocks are read by lx1-sonnet-4.6— the catalog's vision model. Other models reject them with a 400.
Example
curl https://api.layerx1.in/v1/messages \
-H "x-api-key: $LAYERX1_API_KEY" \
-H "content-type: application/json" \
-d '{
"model": "lx1-sonnet-4.6",
"max_tokens": 512,
"system": "You are concise.",
"messages": [{ "role": "user", "content": "Say hi." }]
}'{
"id": "msg_...",
"type": "message",
"role": "assistant",
"model": "lx1-sonnet-4.6",
"content": [{ "type": "text", "text": "Hi." }],
"stop_reason": "end_turn",
"usage": { "input_tokens": 14, "output_tokens": 3 }
}Response fields
| Field | Notes |
|---|---|
content | Array of blocks — text, and tool_use when the model calls a tool. |
stop_reason | end_turn, max_tokens, stop_sequence, or tool_use. |
usage | Input and output token counts for the request. |
Streaming
With stream: true the response is the Anthropic SSE event sequence — message_start, content_block_start, content_block_delta, content_block_stop, message_delta, message_stop — exactly what the Anthropic SDKs expect.
curl -N https://api.layerx1.in/v1/messages \
-H "x-api-key: $LAYERX1_API_KEY" \
-H "content-type: application/json" \
-d '{
"model": "lx1-gpt-oss-120b",
"max_tokens": 256,
"stream": true,
"messages": [{ "role": "user", "content": "Count to five." }]
}'Errors
Failures return standard status codes with Anthropic-shaped bodies ({ "type": "error", "error": { ... } }). Retry on 429/5xx with backoff and honor retry-after. Full reference: Errors.