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
client.completions.create(CompletionCreateParamsbody, RequestOptionsoptions?): Completion { id, choices, created, 4 more } | Stream<Completion { id, choices, created, 4 more } >
POST/completions
ModelsExpand Collapse
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).

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

Usage statistics for the completion request.