Skip to main content
POST
Chat Completions

Authorizations

Authorization
string
header
required

Enter your MeshAPI key (rsk_...) or, for the admin-keys endpoints, a dashboard session token — sent as Authorization: Bearer <token>.

Headers

X-Mesh-Version
enum<string>
default:2026-08

Dated version of the API contract to pin this request to. Omit it and the request is served under 2026-08 — the oldest supported version, so an existing integration is never moved by a release. A malformed or unsupported value is rejected with 400 invalid_api_version rather than falling back silently. The version actually served is echoed as X-Mesh-Version on every response, including errors.

Available options:
2026-08,
2026-09

Body

application/json
messages
Message · object[]
required
model
string | null
template
string | null
template_version
integer | null
variables
Variables · object | null
session_id
string | null
weight_profile
string | null
router_version
string | null
stream
boolean
default:false
temperature
number | null
Required range: 0 <= x <= 2
max_tokens
integer | null
Required range: x >= 1
top_p
number | null
Required range: 0 <= x <= 1
frequency_penalty
number | null
Required range: -2 <= x <= 2
presence_penalty
number | null
Required range: -2 <= x <= 2
stop
seed
integer | null
reasoning_effort
enum<string> | null
deprecated
Available options:
high,
medium,
low,
none
reasoning
ReasoningConfig · object | null

Structured reasoning object (supersedes reasoning_effort).

effort and max_tokens are mutually exclusive: effort is the OpenAI/Grok dial, max_tokens the Anthropic/Gemini/Qwen thinking budget. exclude reasons internally but omits the content from the response. enabled: true alone means "reason at defaults"; false disables. context/mode are gpt-5.x-only passthroughs.

tools
(Tool · object | ServerTool · object)[] | null
tool_choice
response_format
Response Format · object | null
transforms
string[] | null
models
string[] | null
plugins
Plugins · object[] | null
safety_identifier
string | null

A stable, anonymised identifier for the end user making this request, recorded on the usage row and available as a filter and a group-by dimension in the usage API. Supersedes the deprecated user field. Use an opaque id, not an email address or a name.

Maximum string length: 256
user
string | null
deprecated
Maximum string length: 256
modality
enum<string> | null
Available options:
text,
image
image
ImageOptions · object | null
async_mode
boolean
default:false
modalities
enum<string>[] | null
Available options:
text,
audio,
image
audio
AudioOutputOptions · object | null
timeout
number | null
Required range: x > 0
service_tier
enum<string> | null
Available options:
auto,
default,
flex
cache
boolean | null
tags
Tags · object | null

Your own labels for this request, echoed back on the usage row and available as a filter and a group-by dimension in the usage API. String keys to string values. Never put personal or sensitive data here — tags are stored with the usage record and are not redacted.

Example:

Response

Completion (JSON), or an SSE stream when stream=true

id
string
required
object
string
required
created
integer
required
model
string
required
choices
Choice · object[]
required
usage
UsageInfo · object | null

On chat completions every key below is present, 0 when unused, whoever served it. Any other key the serving provider reports is passed through as sent.

system_fingerprint
string | null
dropped_parameters
DroppedParameter · object[] | null