---
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
    - `stop_sequence` string — StopSequence is the matched stop sequence when the provider reports one natively (Anthropic stop_reason "stop_sequence"). OpenAI's finish_reason "stop" conflates natural stops with stop-parameter hits, so this is an extension field: present only when the provider knows the answer, in the same spirit as the relayed reasoning_content extension.
  - `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

---

[API](https://skmtc.net/enterpilot/apis/gomodel-api.md) · [All operations](https://skmtc.net/enterpilot/apis/gomodel-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/enterpilot/gomodel-api/revisions/4c27ea61fcfe/schema)
