Skip to main content
POST
Messages

Authorizations

Authorization
string
header
required

Authorization: Bearer (OpenAI SDK, Codex, OpenCode, etc.)

Headers

X-Mdlx-Session-Id
string

Optional session affinity header. Length 8–128; alphanumeric, -, and _ only.

Required string length: 8 - 128
Pattern: ^[A-Za-z0-9_-]+$
Example:

"my-conversation-001"

anthropic-version
string

Anthropic API version header (optional; often set automatically by native Anthropic clients; forwarded upstream when present)

Example:

"2023-06-01"

Body

application/json

Anthropic Messages request body. Requires model, messages, and max_tokens; optional system and stream. Message roles are user or assistant only.

Core fields below; other fields follow Anthropic Messages.

model
string
required

Model ID in provider/name form

Examples:

"openai/gpt-5.5"

"openai/gpt-5.6-sol"

"anthropic/claude-sonnet-5"

"google/gemini-3.6-flash"

messages
object[]
required

Anthropic Messages list (min 1). Roles are user or assistant only; put system text in system, not as a message role.

Minimum array length: 1
max_tokens
integer
required

Required. Maximum number of tokens to generate.

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

Default false. When true, returns an Anthropic Messages SSE event stream.

system

System prompt (string or content-block array)

Response

Success. Non-streaming returns JSON; streaming returns SSE.

Shape follows Anthropic message

id
string

Unique identifier for this Anthropic message.

type
string

Object type. Typically message for Anthropic Messages.

Example:

"message"

role
string

Role of the response message. Typically assistant.

Example:

"assistant"

model
string

Model ID that produced this Anthropic message.

content
object[]

Array of Anthropic content blocks in the assistant reply.

stop_reason
string | null

Why generation stopped, or null.

usage
object

Token usage object for the Anthropic Messages API. Shape follows Anthropic usage (for example input and output tokens), not Chat Completions prompt_tokens fields.