completions

Create a text completion

Changed on

Creates a completion for the provided prompt and parameters.

post/api/v1/completions

Request

  • Base URL: / (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /api/v1/completions
  • Auth: HTTP bearer

Request body

best_ofinteger nullable

Number of completions to generate and return the best

echoboolean nullable

Echo the prompt in the response

frequency_penaltynumber double nullable

Penalize repeated tokens (-2.0 to 2.0)

logit_biasobject

Token bias map

logprobsinteger nullable

Number of log probabilities to return

max_tokensinteger nullable

Maximum tokens to generate

metadataobject

Hadrian Extension: Request metadata for tracking and filtering

modelstring nullable

Model to use for completion

modelsstring[] nullable

Hadrian Extension: List of models for multi-model routing (alternative to single model)

ninteger nullable

Number of completions to generate

presence_penaltynumber double nullable

Penalize new topics (-2.0 to 2.0)

promptobject required

The prompt to generate completions for

response_formatobject

Hadrian Extension: Response format (OpenAI only supports this on chat/completions)

seedinteger nullable

Random seed for reproducibility

stopobject

Stop sequence(s)

streamboolean

Enable streaming

stream_optionsobject

Stream options

suffixstring nullable

Text to append after completion

temperaturenumber double nullable

Sampling temperature (0.0 to 2.0)

top_pnumber double nullable

Nucleus sampling probability (0.0 to 1.0)

userstring nullable

User identifier for abuse detection

Response

Completion response (streaming or non-streaming)

Changes