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

# Chat Completions

`POST /v1/chat/completions`

## Request

- Base URL: `https://api.oxlo.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.oxlo.ai/v1/chat/completions`
- Auth: HTTP bearer

Forward chat completion request to GPU worker and adapt response.
Uses model-specific prompt formatting (Mistral/Llama) to ensure models follow instructions.

## Request body

- ChatCompletionRequest: OpenAI-compatible chat completion request with full parameter support. Covers OpenAI, Anthropic, OpenRouter, and llama.cpp sampling params so users can switch providers without changing their code.
  - `model` string, required
  - `messages` ChatMessage[], required
    - `role` 'system' | 'user' | 'assistant' | 'developer' | 'tool', required
    - `content` union
      - string
      - object[]
    - `name` string, nullable
    - `reasoning_content` string, nullable
    - `tool_calls` object[], nullable
    - `tool_call_id` string, nullable
  - `max_tokens` integer, nullable
  - `temperature` number, nullable
  - `top_p` number, nullable
  - `stop` union
    - string
    - string[]
  - `stream` boolean, nullable
  - `frequency_penalty` number, nullable
  - `presence_penalty` number, nullable
  - `top_k` integer, nullable
  - `repeat_penalty` number, nullable
  - `min_p` number, nullable
  - `typical_p` number, nullable
  - `tfs_z` number, nullable
  - `mirostat_mode` integer, nullable
  - `mirostat_tau` number, nullable
  - `mirostat_eta` number, nullable
  - `n` integer, nullable
  - `seed` integer, nullable
  - `user` string, nullable
  - `tools` object[], nullable
  - `tool_choice` union
    - string
    - object
  - `stream_options` object, nullable
  - `response_format` object, nullable
  - `include_reasoning` boolean, nullable: Whether to include reasoning/thinking content in the response. When false, reasoning_content is omitted from assistant messages. Defaults to true for backward compatibility.
  - `auto_continue` boolean, nullable: When true (default), if a streamed response is cut off by the output token limit (finish_reason='length'), the backend automatically issues follow-up requests and stitches them into one continuous response. Each continuation is a separate billed upstream request. Set false to receive the truncated response and handle continuation yourself.
  - `max_continuations` integer, nullable: Safety ceiling on auto-continue passes for a single response. Continuation already stops naturally when the model finishes or its context window fills up; this is only a defense-in-depth cap against runaway cost. Defaults to 50. Raise it for very large generation tasks.

## Response `200`

Successful Response

- ChatCompletionResponse
  - `id` string, required
  - `object` string
  - `created` integer, required
  - `model` string, required
  - `choices` ChatCompletionChoice[], required
    - `index` integer, required
    - `finish_reason` string, required
    - `message` ChatMessage, required: OpenAI-compatible chat message. `content` can be: - A plain string (standard text message) - A list of content blocks for multimodal/vision messages, e.g.: [ {"type": "text", "text": "What's in this image?"}, {"type": "image_url", "image_url": {"url": "data:image/png;base64,..."}} ]
      - `role` 'system' | 'user' | 'assistant' | 'developer' | 'tool', required
      - `content` union
        - string
        - object[]
      - `name` string, nullable
      - `reasoning_content` string, nullable
      - `tool_calls` object[], nullable
      - `tool_call_id` string, nullable
  - `usage` Usage, required
    - `prompt_tokens` integer, required
    - `completion_tokens` integer, required
    - `total_tokens` integer, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/oxlo/apis/oxlo-backend.md) - [All operations](https://skmtc.dev/oxlo/apis/oxlo-backend/llms.txt) - [OpenAPI document](https://skmtc.dev/oxlo/apis/oxlo-backend/revisions/bc2ecdc94f31?raw)
