Skip to main content
POST
Create text completion

Authorizations

Authorization
string
header
required

API key for programmatic access (Authorization: Bearer sk-<api_key>)

Body

application/json
model
string
required
prompt
required

OpenAI /v1/completions prompt: a single string, a batch of strings, or token-ID array(s). This endpoint serves only the single-string form; the other shapes still deserialize (so the handler can return a clean 400 rather than a framework deserialization error) and are rejected there.

best_of
integer<int64> | null
echo
boolean | null
frequency_penalty
number<float> | null
logprobs
integer<int64> | null
max_tokens
integer<int64> | null
n
integer<int64> | null
presence_penalty
number<float> | null
stop

OpenAI stop: either a single string or an array of strings.

stream
boolean | null
temperature
number<float> | null
top_p
number<float> | null
{key}
any

Response

Completion generated successfully

choices
object[]
required
created
integer<int64>
required
id
string
required
model
string
required
object
string
required
usage
object
required

Usage for chat/completions endpoints. Serializes as prompt_tokens, completion_tokens, prompt_tokens_details, completion_tokens_details, total_tokens.