Skip to main content
POST
cURL
Anthropic’s wire format, served by the same models as everything else here. Anthropic SDKs and Claude Code work by changing base_url alone.

Two differences from Anthropic’s own API

Model names stay ours. There is no claude-* aliasing — pass a model from GET /models. See Models and resource names. max_tokens is optional. Anthropic’s API requires it; here, omitting it falls back to the model’s own default rather than failing the call.

Authentication

Both headers work, and they name the same key:
The SDKs append /v1/messages themselves, so construct them with the origin:

Authorizations

Authorization
string
header
required

Authorization: Bearer <your API key>. On /v1/messages, the Anthropic-style x-api-key: <your API key> header is accepted instead.

Body

application/json
model
string
required

Which model answers the call. A bare slug for platform models (deepseek-v4.1-flash), or a full resource name for something your account owns (accounts/{account}/models/{model}, or a deployment). Never an upstream vendor's own name.

messages
object[]
required

The conversation so far, oldest first. Only user and assistant turns -- the system prompt travels in its own system field. Content is a string, or a list of text / image / tool_use / tool_result blocks.

Minimum array length: 1
system

Instructions that sit outside the conversation. Counted as input tokens like any other prompt text.

max_tokens
integer

Ceiling on how many tokens may be generated. Anthropic's own API requires this; here it is optional and falls back to the model's default rather than failing the call.

Required range: x >= 1
stream
boolean
default:false

Return the answer as server-sent events as it is generated, instead of one response at the end. The last data event carries the usage numbers either way.

stop_sequences
string[]

Up to 4 strings that end generation as soon as the model produces one. The matched string is not included in the output.

Maximum array length: 4
temperature
number

How much randomness to allow when picking each token. Lower is more repeatable, higher is more varied.

Required range: 0 <= x <= 2
top_p
number

Nucleus sampling: only consider the most likely tokens up to this share of the probability mass. Tune this or temperature, not both.

Required range: 0 <= x <= 1
top_k
integer

Accepted so Anthropic clients do not break, then dropped: it is not passed to the model.

tools
object[]

Tool definitions in Anthropic's shape ({name, description, input_schema}). Server-side built-in tools are rejected by name.

tool_choice
object

Whether the model may, must, or must not call a tool: auto, any, none, or one named tool.

metadata
object

Free-form metadata about the call. metadata.user_id is the equivalent of the user field on the OpenAI-shaped endpoints.

thinking
object

Extended thinking configuration.

output_config
object

Vendor-specific output configuration.

Not supported. Sending it returns INVALID_REQUEST.

raw_output
object

Vendor-specific raw output configuration.

Not supported. Sending it returns INVALID_REQUEST.

Response

OK. With stream: true the same call answers text/event-stream instead, one chunk per event, terminated by data: [DONE]; the last data event carries usage whether or not you asked for it.

id
string
required
type
string
required
Allowed value: "message"
role
string
required
Allowed value: "assistant"
model
string
required
content
object[]
required
usage
object
required
stop_reason
enum<string> | null
Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
refusal,
null
stop_sequence
string | null