Create a completion
OpenAI-compatible prompt completions for clients that send a raw
prompt instead of chat messages. Every model that accepts
POST /v1/chat/completions accepts this shape.
Send one text prompt per request: a list with more than one prompt,
or a prompt given as token IDs, returns 400 with param set to
prompt. Set echo to true to receive the prompt followed by the
completion in text; a stream adds the prompt to the first text of
each choice. A non-empty suffix, or a best_of above 1, returns
400 naming the parameter.
Streaming uses Server-Sent Events.
usage arrives at the end of the stream on a chunk that also has
choices. Set stream_options.include_usage to true to receive it
the way OpenAI sends it, in its own chunk just before [DONE] whose
choices is an empty list; some models still report it on a chunk
with choices. Read usage from the last chunk that carries it.
An error after the stream starts arrives as a data: event whose
JSON is an error body,
{"error": {"message", "type", "param", "code"}}, the same shape as
an HTTP error.
Authentication
Pass your EmpirioLabs API key as a bearer token. The Anthropic-style
x-api-key header is also accepted on every endpoint.
Request
The prompt text, or a list holding one prompt. A list with more than one prompt, or a prompt given as token IDs, returns 400.
Return the prompt followed by the completion in each choice’s text.
Not supported. A non-empty value returns 400; leave it out or send an empty string.
Only 1 is accepted. A larger value returns 400.
Streaming options, used with stream: true. Without them, usage arrives at the end of the stream on a chunk that also has choices. Set include_usage to true to receive it the way OpenAI sends it: in its own chunk just before data: [DONE], whose choices is an empty list. Some models still report it on a chunk with choices.
Response
Completion object or SSE stream when stream=true.
