Create chat completion (OpenAI-compatible)
Creates a chat completion using an OpenAI-compatible request and response shape. Set `stream=true` to receive Server-Sent Events with `chat.completion.chunk` payloads. Use `model="auto"` to let beatra choose a capable model, or pass a specific model id returned by `/v1/models`.
Request Body
application/jsonRequiredmodelRequired
ModelModel name (e.g. 'gpt-4o-mini', 'qwen-max', 'auto')
messagesRequired
MessagestemperatureTemperaturetop_pTop Pmax_tokensMax TokensLegacy; reasoning models reject this. beatra maps to max_completion_tokens.
max_completion_tokensMax Completion TokensnNseedSeedstopStopstreamStreamDefault:
falsestream_optionsAny properties in StreamOptionsfrequency_penaltyFrequency Penaltypresence_penaltyPresence Penaltylogit_biasLogit BiaslogprobsLogprobstop_logprobsTop LogprobstoolsToolstool_choiceTool Choiceparallel_tool_callsParallel Tool Callsresponse_formatResponse Formatreasoning_effortReasoning EffortaudioAny properties in AudioOutputConfigmodalitiesModalitiesmetadataMetadatastoreStoreservice_tierService Tiersafety_identifierSafety Identifierprompt_cache_keyPrompt Cache KeyuserUserDeprecated; use safety_identifier
model_optionsModel Optionsbeatra extension; per-model passthrough
[key: string]anyHeader Parameters
X-Request-IdstringOptional client request id echoed in the response.
AuthorizationRequired
stringBearer API key.
Idempotency-KeystringOptional idempotency key for safe retries of mutating requests.
Sync completion or streaming chat completion chunks