Skip to main content

Completions

POST 

/v1/completions

Follows the exact same API spec as OpenAI's Completions API https://platform.openai.com/docs/api-reference/completions

Request​

Body

required

    model stringrequired

    ID of the model to use

    prompt

    object

    required

    The prompt(s) to generate completions for

    oneOf

    string

    best_of integernullable

    Generates multiple completions server-side and returns the best one.

    Possible values: >= 1

    Default value: 1
    frequency_penalty numbernullable

    Penalizes tokens based on their existing frequency in the text so far.

    Possible values: >= -2 and <= 2

    Default value: 0

    logit_bias

    object

    nullable

    Modify the likelihood of specified tokens appearing in the completion.

    property name* integer

    logprobs

    object

    Include log probabilities on the logprobs most likely output tokens.

    oneOf

    boolean

    max_tokens integernullable

    The maximum number of tokens to generate.

    Possible values: >= 1

    Default value: 16
    n integernullable

    How many completions to generate for each prompt.

    Possible values: >= 1

    Default value: 1
    presence_penalty numbernullable

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

    Possible values: >= -2 and <= 2

    Default value: 0
    seed int64nullable

    Seed for deterministic sampling.

    stop

    object

    Up to 4 sequences where the API will stop generating further tokens.

    oneOf

    string

    stream booleannullable

    Whether to stream back partial progress.

    Default value: false

    stream_options

    object

    nullable

    Options for streaming responses.

    property name* anynullable

    Options for streaming responses.

    suffix stringnullable

    Suffix that comes after a completion of inserted text.

    temperature numbernullable

    Sampling temperature.

    Possible values: <= 2

    Default value: 1
    top_p numbernullable

    Nucleus sampling parameter.

    Possible values: <= 1

    Default value: 1
    user stringnullable

    Unique identifier representing the end user.

Responses​

Successful Response

Schema

    id stringrequired

    A unique identifier for the completion

    object stringrequired

    The object type

    Possible values: [text_completion]

    created integerrequired

    The Unix timestamp of when the completion was created

    model stringrequired

    The model used for completion

    choices

    object[]

    required

    The list of completion choices

  • Array [

  • text stringrequired

    The generated text

    index integerrequired

    The index of this choice

    finish_reason stringrequired

    The reason the model stopped generating

    Possible values: [stop, length]

  • ]

  • usage

    object

    prompt_tokens integerrequired
    completion_tokens integerrequired
    total_tokens integerrequired
    prompt_tokens_details objectnullable

    Dettaglio dei token (oggetto) oppure null se non disponibile.

    completions_tokens_details objectnullable

    Dettaglio dei token (oggetto) oppure null se non disponibile.

Loading...