Create a chat completion

OpenAI-compatible chat completions. Pass any chat-capable model from the catalog as model. Supports streaming (SSE), tool calling, vision input, audio input, JSON mode, structured output, and provider-specific reasoning controls.

Streaming uses Server-Sent Events with data: ... lines and a final data: [DONE].

Authentication

AuthorizationBearer

Pass your EmpirioLabs API key as a bearer token. The Anthropic-style x-api-key header is also accepted on every endpoint.

Request

This endpoint expects an object.
modelstringRequired
messageslist of objectsRequired
streambooleanOptionalDefaults to false
temperaturedoubleOptional0-2
max_tokensintegerOptional
toolslist of objectsOptional
tool_choiceenum or map from strings to anyOptional
response_formatobjectOptional

Constrain the output format on models that advertise structured output. Omit it for normal text. Set { "type": "json_object" } to force a valid JSON object (JSON mode). Set { "type": "json_schema", "json_schema": { "name": "...", "strict": true, "schema": { ... } } } to force output that conforms to a JSON Schema. Support is per model: check the structured_output field and the “Structured Outputs” capability on GET /v1/models/{model}. Sending it to a model that does not support the requested format returns a 400.

enable_thinkingbooleanOptional
Enable model reasoning on models that advertise this parameter.
thinking_budgetintegerOptional>=1
Maximum tokens reserved for model reasoning on models that advertise this parameter.
disable_formattingbooleanOptionalDefaults to false

Return raw upstream response with no server-side formatting.

Response

Completion (or SSE stream when stream=true).

idstringOptional
objectstringOptional
createdintegerOptional
modelstringOptional
choiceslist of objectsOptional
usageobjectOptional

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
429
Too Many Requests Error