v4

latestOpenAPI 3.1.02026-07-31155218294.8 KB
Text Completions

Openai Completions

post/v1/completions

Headers

x-deepinfra-sourcestring nullable
xi-api-keystring nullable
x-api-keystring nullable

Request body

service_tier'default' | 'priority' | 'flex'
fail_fastboolean

If true, the request is rejected immediately with HTTP 429 when the model has no spare capacity, instead of waiting in the queue. Opt-in; the default (false) keeps standard queueing behavior.

modelstring required

model name

max_tokensinteger nullable

The maximum number of tokens to generate in the completion.

The total length of input tokens and generated tokens is limited by the model's context length.If explicitly set to None it will be the model's max context length minus input length or 65536, whichever is smaller.

temperaturenumber

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic

top_pnumber

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

min_pnumber

Float that represents the minimum probability for a token to be considered, relative to the probability of the most likely token. Must be in [0, 1]. Set to 0 to disable this.

top_kinteger

Sample from the best k (number of) tokens. 0 means off

ninteger

number of sequences to return

streamboolean

whether to stream the output via SSE or return the full response

logprobsinteger nullable

return top tokens and their log-probabilities

echoboolean nullable

return prompt as part of the respons

presence_penaltynumber

Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.

frequency_penaltynumber

Positive values penalize new tokens based on how many times they appear in the text so far, increasing the model's likelihood to talk about new topics.

repetition_penaltynumber

Alternative penalty for repetition, but multiplicative instead of additive (> 1 penalize, < 1 encourage)

userstring nullable

A unique identifier representing your end-user, which can help monitor and detect abuse. Avoid sending us any identifying information. We recommend hashing user identifiers.

seedinteger nullable

Seed for random number generator. If not provided, a random seed is used. Determinism is not guaranteed.

stop_token_idsinteger[] nullable

Up to 16 token IDs where the API will stop generating further tokens. Merged with the model's built-in stop tokens. Intended for private deployments.

return_tokens_as_token_idsboolean nullable

return tokens as token ids

prompt_cache_keystring nullable

A key to identify prompt cache for reuse across requests. If provided, the prompt will be cached and can be reused in subsequent requests with the same key.

Example request

{
  "model": "meta-llama/Llama-2-70b-chat-hf"
}

Response

Successful Response

{"stackTrail":"paths:/v1/completions:post:responses:200:content:application/json:schema","oasType":"schema","type":"unknown"}