v1

latestOpenAPI 3.0.32026-07-26451985.7 KB

Completions

Sends a prompt to an OpenAI compatible completion model and returns a completion. Provides completions for open source models that are text-generation, chat, audio-text-to-text, image-text-to-text, video-text-to-text, and also supports closed source providers openai, anthropic, mistral, cohere, and google. To send a request to a closed source provider, prefix your model with their provider name, e.g. openai/gpt-4.

post/models/v2/openai/v1/completions

Headers

Authorizationstring required

Token for authentication

Request body

modelstring required

The ID of the completion model to run (e.g., text-davinci-003)

promptstring required

The input text prompt

max_tokensinteger

Maximum number of tokens to generate

temperaturenumber

Sampling temperature

streamboolean

Whether to stream responses

top_pnumber

Nucleus sampling parameter

presence_penaltynumber

Penalize new tokens based on whether they appear in the text so far

frequency_penaltynumber

Penalize new tokens based on their existing frequency in the text so far

logprobsinteger

Include the log probabilities on the logprobs most likely output tokens (legacy-style)

Response

Successful text completion

idstring
objectstring
createdinteger