Skip to main content
POST

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"

Body

application/json

OpenAI Chat Completions request body. Requires model and messages; optional stream, max_tokens, max_completion_tokens, temperature, and n.

Core fields below; other fields follow OpenAI Chat Completions.

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

OpenAI Chat Completions message list (min 1). Each item has role and content; roles include system, user, assistant, and tool.

Minimum array length: 1
stream
boolean
default:false

Default false. When true, returns SSE chat.completion.chunk events ending with data: [DONE].

max_tokens
integer

Optional maximum number of tokens to generate. Model-dependent.

Required range: x >= 1
max_completion_tokens
integer

Optional generation cap preferred by some newer OpenAI-style models.

Required range: x >= 1
temperature
number

Sampling temperature for Chat Completions. Model-dependent.

n
integer

Number of chat completion choices to generate.

Required range: x >= 1

Response

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

Shape follows OpenAI chat.completion

id
string

Unique identifier for this chat completion.

object
string

Object type. Typically chat.completion for non-streaming responses.

Example:

"chat.completion"

created
integer

Unix timestamp (seconds) when the chat completion was created.

model
string

Model ID that produced this chat completion.

choices
object[]

List of chat completion choices.

usage
object

OpenAI chat.completion token usage counts.