---
title: "Create Chat Completions"
method: POST
path: "/v1/chat/completions"
tags: ["Chat"]
---

# Create Chat Completions

`POST /v1/chat/completions`

## Request

- The document declares no server URL.
- Auth: HTTP bearer

Creates a model response for the given chat conversation.

## Request body

- CreateChatCompletionsBody
  - `messages` object[], required: A list of messages comprising the conversation so far.
  - `model` string, required: ID of the model to use. Call `/v1/models` endpoint to get the list of available models, only `text-generation` model type is supported.
  - `stream` boolean, nullable: If set, partial message deltas will be sent. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.

## Response `200`

Successful Response

- union
  - ChatCompletionResponse
    - `id` string, required
    - `choices` OpenaiTypesChatChatCompletionChoice[], required
      - `finish_reason` 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', required
      - `index` integer, required
      - `logprobs` ChoiceLogprobs: Log probability information for the choice.
        - `content` ChatCompletionTokenLogprob[], nullable
          - `token` string, required
          - `bytes` integer[], nullable
          - `logprob` number, required
          - `top_logprobs` TopLogprob[], required
            - `token` string, required
            - `bytes` integer[], nullable
            - `logprob` number, required
        - `refusal` ChatCompletionTokenLogprob[], nullable
          - `token` string, required
          - `bytes` integer[], nullable
          - `logprob` number, required
          - `top_logprobs` TopLogprob[], required
            - `token` string, required
            - `bytes` integer[], nullable
            - `logprob` number, required
      - `message` ChatCompletionMessage, required: A chat completion message generated by the model.
        - `content` string, nullable
        - `refusal` string, nullable
        - `role` 'assistant', required
        - `annotations` Annotation[], nullable
          - `type` 'url_citation', required
          - `url_citation` AnnotationURLCitation, required: A URL citation when using web search.
            - `end_index` integer, required
            - `start_index` integer, required
            - `title` string, required
            - `url` string, required
        - `audio` ChatCompletionAudio: If the audio output modality is requested, this object contains data about the audio response from the model. [Learn more](https://platform.openai.com/docs/guides/audio).
          - `id` string, required
          - `data` string, required
          - `expires_at` integer, required
          - `transcript` string, required
        - `function_call` FunctionCall: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
          - `arguments` string, required
          - `name` string, required
        - `tool_calls` union[], nullable
          - union
            - ChatCompletionMessageFunctionToolCall: A call to a function tool created by the model.
              - …
            - ChatCompletionMessageCustomToolCall: A call to a custom tool created by the model.
              - …
    - `created` integer, required
    - `model` string, required
    - `object` 'chat.completion', required
    - `service_tier` 'auto' | 'default' | 'flex' | 'scale' | 'priority', nullable
    - `system_fingerprint` string, nullable
    - `usage` Usage
      - `prompt_tokens` integer
      - `completion_tokens` integer
      - `total_tokens` integer
      - `prompt_tokens_details` PromptTokensDetails
        - `cached_tokens` integer
      - `cost` number
      - `impacts` ApiDomainUsageEntitiesEnvironmentalImpacts
        - `kWh` number
        - `kgCO2eq` number
  - ChatCompletionChunkResponse
    - `id` string, required
    - `choices` OpenaiTypesChatChatCompletionChunkChoice[], required
      - `delta` ChoiceDelta, required: A chat completion delta generated by streamed model responses.
        - `content` string, nullable
        - `function_call` ChoiceDeltaFunctionCall: Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model.
          - `arguments` string, nullable
          - `name` string, nullable
        - `refusal` string, nullable
        - `role` 'developer' | 'system' | 'user' | 'assistant' | 'tool', nullable
        - `tool_calls` ChoiceDeltaToolCall[], nullable
          - `index` integer, required
          - `id` string, nullable
          - `function` ChoiceDeltaToolCallFunction
            - `arguments` string, nullable
            - `name` string, nullable
          - `type` 'function', nullable
      - `finish_reason` 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', nullable
      - `index` integer, required
      - `logprobs` ChoiceLogprobs: Log probability information for the choice.
        - `content` ChatCompletionTokenLogprob[], nullable
          - `token` string, required
          - `bytes` integer[], nullable
          - `logprob` number, required
          - `top_logprobs` TopLogprob[], required
            - `token` string, required
            - `bytes` integer[], nullable
            - `logprob` number, required
        - `refusal` ChatCompletionTokenLogprob[], nullable
          - `token` string, required
          - `bytes` integer[], nullable
          - `logprob` number, required
          - `top_logprobs` TopLogprob[], required
            - `token` string, required
            - `bytes` integer[], nullable
            - `logprob` number, required
    - `created` integer, required
    - `model` string, required
    - `object` 'chat.completion.chunk', required
    - `service_tier` 'auto' | 'default' | 'flex' | 'scale' | 'priority', nullable
    - `system_fingerprint` string, nullable
    - `usage` Usage
      - `prompt_tokens` integer
      - `completion_tokens` integer
      - `total_tokens` integer
      - `prompt_tokens_details` PromptTokensDetails
        - `cached_tokens` integer
      - `cost` number
      - `impacts` ApiDomainUsageEntitiesEnvironmentalImpacts
        - `kWh` number
        - `kgCO2eq` number

## Other responses

- `400`: Insufficient budget.
- `401`: Invalid authentication scheme.<br>Invalid API key.
- `403`: Your account has expired. Please contact support to renew your account.
- `404`: Model {name} not found.
- `422`: Model has wrong type. Expected: {expected_type}. Actual: {actual_type}.
- `429`: Token/request limit per minute/day exceeded.
- `503`: Model is too busy, please try again later.

## Changes

- **2026-09-29** `2f7a4a0aac8f`: 1 info
  - endpoint added
- **2026-09-29** `da70d9cd1957`: 1 breaking
  - api path removed without deprecation
- **2026-09-21** `5fdbd3614b8c`: 9 breaking, 7 info
  - request property `stream` list-of-types was narrowed by removing types `null` from media type `application/json`
  - request property `tools/anyOf[subschema #1]/` list-of-types was narrowed by removing types `null` from media type `application/json`
  - the `messages/items/` request property type changed from no type to `object`
  - the response property `headers` became optional for the status `404`
  - …12 more
- **2026-07-11** `0fd1d281f985`: 2 breaking, 5 warning
  - removed `#/components/schemas/SearchTool, subschema #1` from the `tools/anyOf[subschema #1]/anyOf[subschema #1]/items/` request property `anyOf` list
  - the `tools/anyOf[subschema #1]/anyOf[subschema #1]/items/` request property type changed from no type to `object`
  - deleted the `query` request parameter `required`
  - removed the request property `search`
  - …3 more
- …earlier changes not shown

[Operation history](https://skmtc.dev/betagouv/apis/opengatellm/changes/v1/chat/completions/post.md)

---

[API](https://skmtc.dev/betagouv/apis/opengatellm.md) - [All operations](https://skmtc.dev/betagouv/apis/opengatellm/llms.txt) - [OpenAPI document](https://skmtc.dev/betagouv/apis/opengatellm/revisions/2f7a4a0aac8f?raw)
