Skip to main content
The /v1/completions endpoint accepts a text prompt and returns a completion. It is a legacy endpoint — for new projects, use /v1/chat/completions instead. It is included for compatibility with tools that depend on the completions interface, such as older SDKs or fine-tuned workflows built around raw prompt templates.
For new integrations, use /v1/chat/completions — it supports system prompts, tool calls, and structured output.

Endpoint

Request Body

string
required
Model slug to use for the request, e.g. llama-3.3-70b-instruct. See Models for all available slugs.
string
required
The text prompt to complete. The model continues generation from wherever the prompt ends.
integer
Maximum number of tokens to generate. Default: 16.
number
Sampling temperature between 0 and 2. Lower values produce more deterministic output. Default: 1.
boolean
When true, streams the response as server-sent events. Default: false.
string | array
One or more sequences at which generation stops. Generation halts as soon as any sequence in the list is encountered.
number
Nucleus sampling probability mass. Only tokens comprising the top top_p probability are considered. Default: 1.

Example Request

Example Response

Response Fields

string
Unique identifier for the completion. Use this for logging and tracing.
string
The generated text continuation from the model for this choice.
string
Reason generation stopped. Common values: "stop" (natural end or stop sequence hit), "length" (max_tokens reached).
integer
Number of tokens in the input prompt.
integer
Number of tokens generated in the response.