Skip to content
For the complete documentation index, see llms.txt. Markdown versions of documentation pages are available by appending .md to the page URL.
Primary navigation

Completions

Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.

Create completion
completions.create(**kwargs) -> Completion { id, choices, created, 4 more }
POST/completions
ModelsExpand Collapse
class Completion { id, choices, created, 4 more }

Represents a completion response from the API. Note: both the streamed and non-streamed response objects share the same shape (unlike the chat endpoint).

class CompletionChoice { finish_reason, index, logprobs, text }
class CompletionUsage { completion_tokens, prompt_tokens, total_tokens, 2 more }

Usage statistics for the completion request.