Create a chat
Requests a model response for the given chat conversation. Supports both streaming and non-streaming modes, with one OpenAI-compatible request/response shape across every model and provider.
/api/v1/chat/completionsAuthorizations
AuthorizationrequiredAPI key as bearer token in the Authorization header.
Body
modelrequiredThe model to use, provider-qualified, e.g. "openai/gpt-4.1". Short ids from common model families (e.g. "gpt-4o") are automatically resolved to the full canonical id ("openai/gpt-4o"); values already in canonical form pass through unchanged. An unrecognized short id is not force-rewritten — model resolution surfaces a clear model-not-found error instead.
"openai/gpt-4.1"messagesrequiredArray of conversation messages, at least one. Each has a role (system/user/assistant/tool) and content.
modelsFallback model list — tried in order, only used once the primary model's own candidate group is exhausted.
streamtrue streams the response as SSE; omitted or false returns a single JSON response.
temperatureSampling temperature — higher is more random, lower is more deterministic.
max_tokensMaximum number of tokens the response may generate.
max_completion_tokensAlias of max_tokens with identical semantics.
top_pNucleus sampling threshold.
top_kLimits sampling to the K highest-probability tokens.
frequency_penaltyPenalizes tokens based on how often they've already appeared.
presence_penaltyPenalizes tokens based on whether they've appeared at all, regardless of count.
repetition_penaltyRepetition penalty coefficient — a separate mechanism from frequency/presence penalty.
min_pMinimum probability threshold relative to the most likely token.
top_aAnother dynamic-cutoff sampling mechanism, scaling the threshold by the square of the top probability.
seedDeterministic sampling seed; not all providers guarantee reproducibility.
nNumber of completions to generate.
stopSequences where generation stops, up to 4.
toolsList of tool/function definitions the model may call.
tool_choiceControls whether/how the model is forced to call a tool.
parallel_tool_callsWhether to allow parallel tool calls when tools are provided. Default true. OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
response_formatConstrains the output format, e.g. {type:"json_object"} or {type:"json_schema"} with a JSON Schema.
logit_biasMaps token IDs to bias values [-100, 100] added before sampling. OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
logprobsReturn log probabilities of each output token. OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
top_logprobsNumber of most-likely tokens to return per position (requires logprobs: true). OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
userEnd-user identifier for monitoring and abuse detection. Has no effect on billing. OpenAI-family models only — silently stripped when the target model isn't OpenAI's own, not an error.
reasoningReasoning-model thinking control object (e.g. {effort, max_tokens}).
reasoning_effortFlat shorthand for reasoning.effort.
lowmediumhighimage_configImage generation/edit options (used when modalities includes image).
modalitiesRequested output modalities. Including image routes through the image-generation dispatch path.
textimagepluginsArray of plugins (e.g. {id:"web"} to enable web search). Supported only on some model routes, no effect elsewhere; the :online model variant auto-injects {id:"web"}, likewise only on supporting routes.