For most new applications, prefer the Chat Completions endpoint. It supports more capable models, structured conversations, and function calling. The completions endpoint exists primarily for backward compatibility.
Endpoint
Request parameters
The model to use. Use the provider-prefixed format (
openai/gpt-3.5-turbo-instruct) or the short name where unambiguous. Retrieve available model IDs from GET /v1/models.The prompt text to complete. Pass a string for a single prompt or an array of strings to generate completions for multiple prompts in one request.
Sampling temperature between
0 and 2. Lower values are more deterministic; higher values are more creative.Stream the response as server-sent events. Each event contains a partial completion delta. The stream ends with
data: [DONE].One or more stop sequences. Generation stops when any sequence is encountered; the stop sequence itself is not included in the output.
Generate this many completions server-side and return the best one (as measured by log probability). Higher values increase latency and token usage.