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

# Create a chat completion

`POST /v1/chat/completions`

## Request

- Base URL: `https://app.getsupers.com`
- URL: `https://app.getsupers.com/v1/chat/completions`
- Auth: one of:
  - HTTP bearer
  - OAuth 2
    - Authorization code: `https://app.getsupers.com/oauth/authorize`
    - Token URL: `https://app.getsupers.com/oauth/token` scopes: `api:chat`

Creates an OpenAI-compatible chat completion. Cached compatible work may return without a new upstream model call.

## Request body

- ChatCompletionRequest
  - `model` string: A model ID returned by GET /v1/models.
  - `messages` Message[], required
    - `role` 'system' | 'user' | 'assistant' | 'tool', required
    - `content` union, required
      - string
      - object[]
    - `name` string
    - `tool_call_id` string
    - `tool_calls` object[]
  - `temperature` number
  - `max_tokens` integer
  - `max_completion_tokens` integer
  - `stream` boolean
  - `cache` boolean: Set false when the request must bypass compatible shared completions.
  - `tools` object[]
  - `tool_choice` union: OpenAI-compatible tool selection value.
    - string
    - object
  - `plugins` object[]
  - `modalities` string[]
  - `image_config` object
  - `reasoning` object

## Response `200`

Completion result. If stream is true, the response uses Server-Sent Events and ends with data: [DONE].

- ChatCompletion
  - `id` string, required
  - `object` string, required
  - `created` integer, required
  - `model` string, required
  - `choices` ChatChoice[], required
    - `index` integer, required
    - `message` Message, required
      - `role` 'system' | 'user' | 'assistant' | 'tool', required
      - `content` union, required
        - string
        - object[]
      - `name` string
      - `tool_call_id` string
      - `tool_calls` object[]
    - `finish_reason` string, nullable
  - `usage` Usage
    - `prompt_tokens` integer
    - `completion_tokens` integer
    - `total_tokens` integer
  - `x_superpowers` SuperMetadata, required
    - `cache_hit` boolean, required
    - `cache_entry_id` string, nullable
    - `cache_store_status` string, nullable
    - `credits_used` number, required
    - `credits_remaining` number, required
    - `owner` string, required
    - `resolved_owner` string, nullable
    - `usage_estimated` boolean

## Other responses

- `400`: The request body is invalid or the model is unsupported.
- `401`: The API key is missing, invalid, revoked, or unauthorized.
- `402`: The account does not have enough credits for the completion.
- `403`: The authenticated credential does not carry the required named OAuth scope or API-key permission.
- `429`: The request rate is too high. Retry after the duration in Retry-After.
- `500`: The model provider or Super API could not complete the request.
- `502`: The model provider or Super API could not complete the request.
- `4XX`: A typed client error not covered by a more specific 4xx response.
- `5XX`: The model provider or Super API could not complete the request.

---

[API](https://skmtc.dev/agentsbase/apis/superpowers-ai-super-api.md) - [All operations](https://skmtc.dev/agentsbase/apis/superpowers-ai-super-api/llms.txt) - [OpenAPI document](https://skmtc.dev/agentsbase/apis/superpowers-ai-super-api/revisions/863feb591af3?raw)
