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

# Create a chat completion

`POST /v1/chat/completions`

## Request body

- CoreChatRequest
  - `max_tokens` integer
  - `messages` CoreMessage[]
    - `content` CoreContentPart[] — ContentSchema documents that `content` accepts either a plain string or an array of ContentPart values.
      - `image_url` CoreImageURLContent
        - `detail` string
        - `media_type` string
        - `url` string
      - `input_audio` CoreInputAudioContent
        - `data` string
        - `format` string
      - `text` string
      - `type` string
    - `role` string
    - `tool_call_id` string
    - `tool_calls` CoreToolCall[]
      - `function` CoreFunctionCall
        - `arguments` string
        - `name` string
      - `id` string
      - `type` string
  - `model` string
  - `parallel_tool_calls` boolean
  - `provider` string — Gateway routing hint; stripped before upstream execution.
  - `reasoning` CoreReasoning
    - `effort` string — Effort controls how much reasoning effort the model should use. Valid values are "low", "medium", "high", "xhigh", and "max". "xhigh" and "max" are supported by newer models such as Claude Opus 4.8; providers downgrade unsupported levels to their nearest equivalent.
  - `service_tier` string
  - `stream` boolean
  - `stream_options` CoreStreamOptions
    - `include_usage` boolean — IncludeUsage requests token usage information in streaming responses. When true, the final streaming chunk will include usage statistics.
  - `temperature` number
  - `tool_choice` unknown
  - `tools` object[]
  - `top_p` number
  - `user` string

## Response `200`

JSON response or SSE stream when stream=true

- CoreChatResponse
  - `choices` CoreChoice[]
    - `finish_reason` string
    - `index` integer
    - `logprobs` object
    - `message` CoreResponseMessage
      - `content` CoreContentPart[]
        - `image_url` CoreImageURLContent
          - `detail` string
          - `media_type` string
          - `url` string
        - `input_audio` CoreInputAudioContent
          - `data` string
          - `format` string
        - `text` string
        - `type` string
      - `role` string
      - `tool_calls` CoreToolCall[]
        - `function` CoreFunctionCall
          - `arguments` string
          - `name` string
        - `id` string
        - `type` string
  - `created` integer
  - `id` string
  - `model` string
  - `object` string
  - `provider` string
  - `system_fingerprint` string
  - `usage` CoreUsage
    - `completion_tokens` integer
    - `completion_tokens_details` CoreCompletionTokensDetails
      - `accepted_prediction_tokens` integer
      - `audio_tokens` integer
      - `reasoning_tokens` integer
      - `rejected_prediction_tokens` integer
    - `prompt_tokens` integer
    - `prompt_tokens_details` CorePromptTokensDetails
      - `audio_tokens` integer
      - `cached_tokens` integer
      - `image_tokens` integer
      - `text_tokens` integer
    - `raw_usage` object
    - `total_tokens` integer

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `429` — Too Many Requests
- `502` — Bad Gateway

## Changes

- **2026-06-08** `8c7901df38df` — 3 info
  - added the new optional request property `service_tier`
  - added the new optional request property `top_p`
  - added the new optional request property `user`
- **2026-04-19** `1a90f5d80e5a` — 48 warning, 8 info
  - removed the optional property `code` from the response with the `400` status (media type: application/json)
  - removed the optional property `code` from the response with the `400` status (media type: text/event-stream)
  - removed the optional property `code` from the response with the `401` status (media type: application/json)
  - removed the optional property `code` from the response with the `401` status (media type: text/event-stream)
  - …52 more

[Change history](https://skmtc.dev/enterpilot/apis/gomodel-api/changes/v1/chat/completions/post.md)

---

[API](https://skmtc.dev/enterpilot/apis/gomodel-api.md) · [All operations](https://skmtc.dev/enterpilot/apis/gomodel-api/llms.txt) · [OpenAPI document](https://skmtc.dev/enterpilot/apis/gomodel-api/revisions/34ad11a1ad01?raw)
