---
title: "OpenAI-compatible chat/text completion"
method: POST
path: "/api/v1/chat/completions"
---

# OpenAI-compatible chat/text completion

`POST /api/v1/chat/completions`

## Request

- Base URL: `https://genmagic.co`
- URL: `https://genmagic.co/api/v1/chat/completions`
- Auth: HTTP bearer

Point any OpenAI SDK at this base URL. Routes the messages to the selected model through GenMagic, billed against the key's real USD balance at the model provider's own usage cost (cached input and long-context prompts bill at the prices in /api/v1/models). The request body is forwarded to the model unchanged, so every parameter in the model's supported_parameters works as sent (temperature, tools, response_format, seed, ...). Streams with server-sent events when stream=true. When the key owner has Brand personalization on, a brand system message is prepended automatically.

## Request body

- object
  - `model` string: Model id to use. Omit to use the text default. Call /api/v1/models to list ids.
  - `messages` object[], required: OpenAI-style messages array [{ role, content }]; supports multimodal content parts.
  - `stream` boolean: Stream tokens as server-sent events. Defaults to false.
  - `reasoning_effort` string: Thinking effort for a reasoning model, one of the model's capabilities.reasoning_efforts (for example low, medium, high).
  - `reasoning` object: Object form of the thinking controls: { effort, enabled, max_tokens }. enabled: false is refused when the model's capabilities.reasoning_mandatory is true.

## Response `200`

Success.

## Other responses

- `401`: authentication_error: missing or invalid API key.
- `402`: insufficient_quota: credit balance would go negative.
- `429`: rate_limit_error: over 300 requests/minute for this key.

---

[API](https://skmtc.dev/genmagic/apis/genmagic-api.md) · [All operations](https://skmtc.dev/genmagic/apis/genmagic-api/llms.txt) · [OpenAPI document](https://skmtc.dev/genmagic/apis/genmagic-api/revisions/c75319e568f6?raw)
