Skip to main content
POST

Text Completion API

The Legacy Completions API uses prompt as input and is suitable for businesses still using the old OpenAI SDK or simple text completion workflows. For new conversational scenarios, it is recommended to use the chat completions API.

Request Body

model
string
required
Model name.
prompt
string | array<string>
required
Input prompt.
stream
boolean
Whether to enable streaming output.
max_tokens
integer
Maximum number of tokens to generate.
temperature
number
Sampling temperature.
top_p
number
Nucleus sampling parameter.
stop
string | array<string>
Stop sequences.

Request Example

Response Example