Skip to main content
POST
Generate legacy text completion from prompt

Authorizations

x-api-key
string
header
required

Headers

x-selected-account-id
string | null

Body

application/json
model
string
required

model specified as model_vendor/model, for example openai/gpt-4o

prompt
required

The prompt to generate completions for, encoded as a string

stream
boolean | null

Whether to stream back partial progress. If set, tokens will be sent as data-only server-sent events.

best_of
integer | null

Generates best_of completions server-side and returns the best one. Must be greater than n when used together.

echo
boolean | null

Echo back the prompt in addition to the completion

frequency_penalty
number | null

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text.

logit_bias
Logit Bias · object | null

Modify the likelihood of specified tokens appearing in the completion. Maps tokens to bias values from -100 to 100.

logprobs
integer | null

Include log probabilities of the most likely tokens. Maximum value is 5.

max_tokens
integer | null

The maximum number of tokens that can be generated in the completion.

n
integer | null

How many completions to generate for each prompt.

presence_penalty
number | null

Number between -2.0 and 2.0. Positive values penalize new tokens based on their presence in the text so far.

seed
integer | null

If specified, attempts to generate deterministic samples. Determinism is not guaranteed.

stop

Up to 4 sequences where the API will stop generating further tokens.

stream_options
Stream Options · object | null

Options for streaming response. Only set this when stream is True.

suffix
string | null

The suffix that comes after a completion of inserted text. Only supported for gpt-3.5-turbo-instruct.

temperature
number | null

Sampling temperature between 0 and 2. Higher values make output more random, lower more focused.

top_p
number | null

Alternative to temperature. Consider only tokens with top_p probability mass. Range 0-1.

user
string | null

A unique identifier representing your end-user, which can help OpenAI monitor and detect abuse.

Response

Successful Response

id
string
required
choices
CompletionChoice · object[]
required
created
integer
required
model
string
required
object
string
default:text_completion
Allowed value: "text_completion"
system_fingerprint
string | null
usage
CompletionUsage · object | null

Usage statistics for the completion request.