---
title: "OpenAI-compatible routed chat completion with optional SSE streaming"
method: POST
path: "/v1/chat/completions"
---

# OpenAI-compatible routed chat completion with optional SSE streaming

`POST /v1/chat/completions`

## Request

- Base URL: `https://modelpilot.andycywu.cc`
- URL: `https://modelpilot.andycywu.cc/v1/chat/completions`
- Auth: HTTP bearer

## Request body

- ChatCompletionRequest
  - `model` string: ModelPilot target ID or auto.
  - `messages` object[], required
    - `role` 'system' | 'user' | 'assistant' | 'tool', required
    - `content` string, nullable
    - `tool_call_id` string
    - `tool_calls` ToolCall[]
      - `id` string, required
      - `type` 'function', required
      - `function` object, required
        - `name` string, required
        - `arguments` string, required: JSON-encoded function arguments.
      - `provider_metadata` object: Opaque provider context. Preserve this object unchanged when returning assistant tool_calls in a later request.
        - `gemini_thought_signature` string
  - `tools` FunctionTool[]
    - `type` 'function', required
    - `function` object, required
      - `name` string, required
      - `description` string
      - `parameters` object, required
      - `strict` boolean
  - `tool_choice` union
    - 'auto' | 'none' | 'required'
    - object
      - `type` 'function', required
      - `function` object, required
        - `name` string, required
  - `reasoning_effort` 'none' | 'low' | 'medium' | 'high' | 'xhigh' | 'max': For openai-mini (GPT-6 Luna): none, low, medium, high, xhigh, or max. Omission uses medium.
  - `stream` boolean: SSE streaming is available for OpenAI, Anthropic, and Google Gemini targets, including normalized tool-call deltas.
  - `stream_options` object
    - `include_usage` boolean
  - `max_tokens` integer

## Response `200`

OpenAI-compatible JSON completion or text/event-stream when stream=true

## Other responses

- `400`: Malformed request or unsupported model parameter
- `404`: Unknown ModelPilot model ID
- `422`: Known target is not configured, policy eligible, or streaming-capable
- `502`: Provider execution failed

---

[API](https://skmtc.dev/andycywu/apis/modelpilot-task-api.md) · [All operations](https://skmtc.dev/andycywu/apis/modelpilot-task-api/llms.txt) · [OpenAPI document](https://skmtc.dev/andycywu/apis/modelpilot-task-api/revisions/5af2d641c7e1?raw)
