Skip to main content
POST
Create a text completion

Body

application/json

Request body for the text completion endpoint.

prompt
string
required

The text prompt to generate completions from. Required.

images
array | null

Optional images referenced by the prompt (base64, array of images or descriptors).

audios
array | null

Optional audio inputs referenced by the prompt.

videos
array | null

Optional video inputs referenced by the prompt.

max_completion_tokens
integer | null

Maximum tokens to generate for the completion.

temperature
number | null

Sampling temperature to control randomness of generation.

top_p
number | null

Nucleus sampling cumulative probability threshold.

top_k
integer | null

Top-k filtering size to restrict token choices.

stream
boolean
default:false

If true, request streaming partial output as it is produced.

stop
string[] | null

List of stop sequences to end generation.

seed
integer | null

Optional seed to make generation deterministic.

presence_penalty
number | null

Penalty to reduce likelihood of new tokens based on presence.

frequency_penalty
number | null

Penalty to reduce likelihood of tokens appearing based on frequency.

logit_bias
object | null

Token-specific additive biases applied to logits before sampling.

logprobs
boolean
default:false

Whether to include logprob information in the completion response.

Response

200 - application/json

Completions response

Response returned from the text completions endpoint.

id
string
required

Unique identifier for this completion response.

object
enum<string>
default:completion
required

Type of the returned object; always 'completion' for this response.

Available options:
completion
created
integer
required

Unix timestamp (seconds) when the completion was created.

model
string
required

Name or ID of the model used to generate the completion.

choices
object[]
required

List of generated choices produced by the model.

usage
object | null

Optional token usage details for this request.