Messages
POST /api/anthropic/v1/messages: the Anthropic-compatible way to chat, streamed or in one piece. For examples and explanations, see the Messages API guide.
Create message
Anthropic's Messages API on ARK models. No anthropic-version header is required. Unknown fields are rejected with 400.
Request body
A chat or vision model id.
user and assistant turns. Content is a string or blocks: text, image (base64 or url source), document (plain-text source), search_result, tool_use, tool_result, thinking (dropped).Maximum tokens to generate, thinking included.
System prompt, as text or text blocks.
Default 0.6.
Sampling parameters.
Up to 4. Not allowed with ark_stateful.
Stream events.
Client tools: {"name", "description", "input_schema"}. Server tools return 400.
{"type": "auto" | "any" | "none"} or {"type": "tool", "name": …}; disable_parallel_tool_use limits the reply to one call.{"type": "enabled", "budget_tokens": n} (n ≥ 8192: high, otherwise medium), {"type": "adaptive"} (medium) or {"type": "disabled"}. Absent: no thinking.effort (low … max) and format: {"type": "json_schema", "schema": …}.Stateful session, as on the chat route.
Accepted for compatibility.
Response
content holds thinking, text and tool_use blocks, in that order. stop_reason is end_turn, max_tokens, stop_sequence or tool_use. In usage, input_tokens plus cache_read_input_tokens is the full prompt; output_tokens_details.thinking_tokens counts thinking.
curl https://api.ark-labs.cloud/api/anthropic/v1/messages \
-H "Authorization: Bearer $ARK_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "arklabsai/Qwen3.5-122B-A10B",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'message = client.messages.create(
model="arklabsai/Qwen3.5-122B-A10B",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
){
"id": "msg_01J9…",
"type": "message",
"role": "assistant",
"model": "arklabsai/Qwen3.5-122B-A10B",
"content": [{"type": "text", "text": "Hello! How can I help you today?"}],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 18,
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"output_tokens": 10,
"output_tokens_details": {"thinking_tokens": 0},
"service_tier": "standard"
}
}Message stream events
With "stream": true, each event is event: <name> followed by data: <json>:
message_start: the message with empty content and the prompt usage.content_block_start, thenpingonce.content_block_delta:text_delta,thinking_delta, or oneinput_json_deltacarrying a whole tool input.content_block_stopfor each block.message_delta:stop_reasonand the final usage.message_stop.
An error mid-stream arrives as event: error.
event: message_start
data: {"type":"message_start","message":{"id":"msg_…","type":"message","role":"assistant","content":[],…}}
event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
event: ping
data: {"type":"ping"}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}
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":10,…}}
event: message_stop
data: {"type":"message_stop"}