Messages

Create message (Anthropic-compatible)

Anthropic-compatible Messages surface over the same serving pipeline as /chat/completions. Billing, credits, idempotency, rate limits, request-size limits and cached-input pricing follow the same rules. Supports text, base64 image input on compatible models, client tools, thinking controls, structured output and Anthropic event-named streaming. anthropic-beta and Claude Code compatibility headers are accepted and ignored.

post/messages

Headers

anthropic-versionstring
Example:2023-06-01

Accepted and echoed back on the response. It does not select a behavior: this endpoint publishes one grammar.

anthropic-betastring

Accepted and ignored for client compatibility.

Idempotency-Keystring

Binds the outcome to the Anthropic request body sent, so a retry replays instead of generating and billing a second time.

Request body

modelstring required

Model id returned by GET /v1/models.

max_tokensinteger required

Required by POST /messages and optional for POST /messages/count_tokens. Reasoning spends this budget. 0 is refused.

temperaturenumber

Passed through.

top_pnumber

Passed through.

{"stackTrail":"paths:/messages:post:requestBody:content:application/json:schema:allOf:properties:top_k","oasType":"schema","type":"unknown","description":"Accepted and ignored."}
stop_sequencesstring[]

Passed through as stop strings. The matched sequence is not reported.

streamboolean

true returns text/event-stream in the Anthropic event grammar.

{"stackTrail":"paths:/messages:post:requestBody:content:application/json:schema:allOf:properties:cache_control","oasType":"schema","type":"unknown","description":"Accepted and ignored."}
{"stackTrail":"paths:/messages:post:requestBody:content:application/json:schema:allOf:properties:service_tier","oasType":"schema","type":"unknown","description":"Accepted and ignored."}
{"stackTrail":"paths:/messages:post:requestBody:content:application/json:schema:allOf:properties:container","oasType":"schema","type":"unknown","description":"Accepted and ignored."}
{"stackTrail":"paths:/messages:post:requestBody:content:application/json:schema:allOf:properties:mcp_servers","oasType":"schema","type":"unknown","description":"Accepted and ignored."}
{"stackTrail":"paths:/messages:post:requestBody:content:application/json:schema:allOf:properties:context_management","oasType":"schema","type":"unknown","description":"Accepted and ignored."}
{"stackTrail":"paths:/messages:post:requestBody:content:application/json:schema:allOf:properties:inference_geo","oasType":"schema","type":"unknown","description":"Accepted and ignored."}
{"stackTrail":"paths:/messages:post:requestBody:content:application/json:schema:allOf:properties:speed","oasType":"schema","type":"unknown","description":"Accepted and ignored."}

Example request

{
  "model": "deepseek-v4-flash"
}

Response

Anthropic Message, or an Anthropic SSE event stream if stream=true

idstring required
type'message' required
role'assistant' required
modelstring required
stop_reason'end_turn' | 'max_tokens' | 'tool_use' | 'null' nullable required

end_turn when the model finished, max_tokens at the output ceiling, tool_use when it requested a client tool, or null when no reason is available.

stop_sequencestring nullable required

Always null on this endpoint, for the reason above. Your stop_sequences are still honored by the model.

Example response

{
  "id": "msg_a1b2c3d4"
}

Changes