For AI agents: a documentation index is available at the root level at /llms.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Generate a chat completion from one of the available models. Mixlayer’s API is OpenAI-compatible, so existing OpenAI client libraries work without modification — see [Client Libraries](/client-libraries) for examples.
Set `stream` to true to receive JSON chunks as server-sent events; the stream ends with `data: [DONE]`.
Authentication
AuthorizationBearer
Mixlayer API key or console user session supplied as a Bearer token.
Request
Chat completion parameters
messageslist of objectsRequired
Message objects in turn order. Each message has a role and content.
modelstringRequired
Model identifier.
web_search_optionsobject or nullOptional
Chat Completions request shape for hosted web search.
frequency_penaltyfloat or nullOptional
Penalizes tokens proportional to how often they have appeared. Positive values reduce repetition.
max_completion_tokensinteger or nullOptional>=0
Maximum tokens to generate. Takes precedence over max_tokens.
max_tokensinteger or nullOptional>=0
Legacy alias for max_completion_tokens.
metadataanyOptional
Developer-supplied metadata stored with the response when store is true.
parallel_tool_callsboolean or nullOptional
Whether the model may emit multiple tool calls in one generation leg.
presence_penaltyfloat or nullOptional
Penalizes tokens that have appeared at all. Positive values encourage topical novelty.
reasoning_effortstring or nullOptional
Reasoning effort: none, minimal, low, medium, high, xhigh, or max.
repetition_penaltyfloat or nullOptional
Multiplicative penalty on tokens already in the context. 1.0 applies no penalty.
response_formatobject or nullOptional
seedlong or nullOptional>=0
Best-effort deterministic sampling seed.
stoplist of strings or nullOptional
Sequences that halt generation. The stop sequence is not included in the output.
storebooleanOptionalDefaults to false
Persist the completed request and response for later use.
streambooleanOptionalDefaults to false
If true, stream the response as Server-Sent Events. Defaults to false.
stream_optionsobject or nullOptional
temperaturefloat or nullOptional
Controls randomness. Lower values make output more deterministic; higher values make it more diverse.
thinkingboolean or nullOptional
Legacy boolean reasoning switch accepted as thinking or reasoning.
toolslist of objects or nullOptional
Function tools the model may call.
top_kinteger or nullOptional
Only consider the top-k most likely tokens at each step.
top_pfloat or nullOptional
Only consider tokens whose cumulative probability is below this value.
Response
A complete response or a stream of completion chunks, selected by the request’s stream field
choiceslist of objects
Generated completion choices.
createdlong>=0
Unix timestamp when the completion was created.
idstring
Unique identifier for the chat completion.
modelstring
Model used to generate the completion.
objectenum
Object type, always chat.completion.
Allowed values:
usageobject
Token usage for the request.
Errors
400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
429
Too Many Requests Error
500
Internal Server Error
Generate a chat completion from one of the available models. Mixlayer’s API is OpenAI-compatible, so existing OpenAI client libraries work without modification — see Client Libraries for examples.
Set stream to true to receive JSON chunks as server-sent events; the stream ends with data: [DONE].