Create a text completion
POST/completions
Generate text from a prompt. Requires the execute:inference:requests permission and access to inference. Prepaid accounts must have positive inference credit. Select a model from GET /models; support depends on the selected model.
With stream=true, the response is an SSE stream of JSON text completion chunks with choices[].text, followed by data: [DONE]. Clients must accept usage-only chunks with an empty choices array. Errors before streaming use an HTTP error response; an interrupted stream is not a complete response.
Request
Responses
- 200
- 400
- 401
- 402
- 403
- 404
- 429
- 500
- 502
- 503
A JSON text completion, or SSE chunks when stream=true. Streaming ends with data: [DONE].
Response Headers
Canonical model selected for this request. The response body retains the requested model ID or alias.
Invalid request. Send an application/json body with the required fields.
Missing, invalid, or expired bearer token.
Insufficient prepaid inference credit. Add credits in the Portal before retrying.
Missing required permission or account access to inference.
Unknown or unavailable model, or unsupported endpoint. Refresh GET /models to discover available IDs.
Request rate limit exceeded. Retry after a delay.
The service could not process the request.
The service could not complete the inference request. Retry after a delay.
Service is temporarily unavailable. Retry after the indicated delay.
Response Headers
Suggested delay in seconds before retrying.