---
title: "Create completion"
method: POST
path: "/v1/completions"
tags: ["inference"]
---

# Create completion

`POST /v1/completions`

Creates a model completion for the given input prompt.

## Query parameters

- `ai_project_id` string, nullable — current project ID

## Request body

- CompletionRequest
  - `model` string, required — ID of the model to use.
  - `prompt` union, required — The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays.
    - string
    - string[]
    - integer[]
  - `stream` boolean, nullable — Enable response streaming.
  - `stream_options` object, nullable — If set to {"include_usage": True}, usage stats will be sent with the last chunk of data
  - `max_tokens` integer, nullable — Max completion token count
  - `temperature` number, nullable — 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_p` number, nullable — 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.
  - `n` integer, nullable — How many completions to generate for each prompt.
  - `logprobs` integer, nullable — Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. So for example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response.
  - `echo` boolean, nullable — Echo back the prompt in addition to the completion.
  - `stop` union — Up to 4 sequences where the API will stop generating further tokens.
    - string
    - string[]
  - `presence_penalty` number, nullable — Number between -2.0 and 2.0. 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_penalty` number, nullable — Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
  - `logit_bias` object, nullable — Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.
  - `user` string, nullable — A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
  - `extra_body` object, nullable — To provide extra parameters.
  - `service_tier` 'auto' | 'default' | 'over-limit' | 'flex' | 'no-limit' — Represents the service tier for requests. Attributes: Auto: Automatically choose the best available tier for the request (Default or OverLimit). Analyze response to determine which tier was used. Default: Return 429 errors on hitting the rate limit, do not exceed to the OverLimit tier. OverLimit: Indicate that the request was over the user limit. This tier cannot be set by user in the request, but us used in a response for tier=Auto. Flex: Do not consume rate-limit credits, but run with lower priority. May still result in 429 errors in case of if there is no resources to process.

## Response `200`

OK

- CompletionResponse
  - `id` string, required — A unique identifier for the chat completion.
  - `object` string, required — The object type, which is always `text_completion`.
  - `created` integer, required — The Unix timestamp of when the completion was created.
  - `model` string, required — The model used for the chat completion.
  - `choices` CompletionChoice[], required — A list of completion choices.
    - `index` integer, required — The index of the choice in the list of choices.
    - `text` string, required — A completion message generated by the model.
    - `finish_reason` 'stop' | 'length' | 'content_filter', required
  - `usage` Usage, required
    - `completion_tokens` integer, required — Number of tokens in the generated completion.
    - `prompt_tokens` integer, required — Number of tokens in the prompt.
    - `total_tokens` integer, required — Total number of tokens used in the request (prompt + completion).
    - `prompt_tokens_details` PromptTokensDetails
      - `cached_tokens` integer, nullable
    - `completion_tokens_details` CompletionTokensDetails
      - `reasoning_tokens` integer, nullable
  - `service_tier` 'auto' | 'default' | 'over-limit' | 'flex' | 'no-limit', required — Represents the service tier for requests. Attributes: Auto: Automatically choose the best available tier for the request (Default or OverLimit). Analyze response to determine which tier was used. Default: Return 429 errors on hitting the rate limit, do not exceed to the OverLimit tier. OverLimit: Indicate that the request was over the user limit. This tier cannot be set by user in the request, but us used in a response for tier=Auto. Flex: Do not consume rate-limit credits, but run with lower priority. May still result in 429 errors in case of if there is no resources to process.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/nebius/apis/nebius-openai-compatible-inference-api.md) · [All operations](https://skmtc.net/nebius/apis/nebius-openai-compatible-inference-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/nebius/nebius-openai-compatible-inference-api/versions/0fb323abba3c/schema)
