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

# Chat Completions

`POST /v1/chat/completions`

## Headers

- `X-Task-ID` string, nullable
- `X-Request-Type` string, nullable
- `X-Kodik-Request-Kind` string, nullable

## Request body

- ChatCompletionRequest
  - `model` string, required — Model ID to use for completion
  - `messages` ChatMessage[], required
    - `role` 'system' | 'user' | 'assistant' | 'tool', required
    - `content` union — Message content (string or array of content parts)
      - string
      - ContentPart[]
        - `type` string, required — Content type (text, image_url, etc.)
        - `text` string, nullable — Text content
        - `image_url` object, nullable — Image URL object
    - `reasoning_content` string, nullable — Reasoning content from thinking mode (GLM-4.7)
    - `tool_calls` ToolCall[], nullable — Tool calls made by the assistant
      - `id` string, required
      - `type` string
      - `function` object, required
    - `tool_call_id` string, nullable — ID of the tool call this message is responding to
    - `name` string, nullable — Name of the function/tool
  - `stream` boolean
  - `temperature` number, nullable
  - `top_p` number, nullable
  - `max_tokens` integer
  - `frequency_penalty` number, nullable
  - `presence_penalty` number, nullable
  - `enable_thinking` boolean, nullable
  - `stream_options` object, nullable — Stream options (e.g., include_usage)
  - `include_reasoning` boolean, nullable — Include reasoning in response
  - `reasoning_effort` string, nullable — Semantic reasoning option advertised for the selected model by listModels
  - `reasoning_mode` string, nullable — Reasoning mode advertised for the selected model by listModels
  - `thinking` object, nullable — Anthropic-style thinking config block
  - `reasoning` object, nullable — OpenRouter-style reasoning config block
  - `verbosity` string, nullable — OpenRouter reasoning verbosity
  - `tools` object[], nullable — List of tools the model can call
  - `tool_choice` union — Controls which tool is called (none, auto, required, or specific tool)
    - string
    - object
  - `parallel_tool_calls` boolean, nullable — Whether to enable parallel function calling
  - `functions` object[], nullable — Deprecated: use tools instead
  - `function_call` union — Deprecated: use tool_choice instead
    - string
    - object

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/kodik/apis/kodik-api.md) · [All operations](https://skmtc.dev/kodik/apis/kodik-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/kodik/kodik-api/revisions/55c71b347360/schema)
