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

# Chat Completions

`POST /v1/chat/completions`

## Request

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

Generate text. OpenAI-compatible request/response; billed per token at
the routed model's cost plus the tier margin, exact cents in the response's
`corent.cost_cents` field. Failed generations are never charged.

Send an `Idempotency-Key` header to make a retry safe: a key this account has
already used returns 409 naming the original request instead of generating
and charging a second time. Both SDKs deliberately omit the header on chat --
without it a transport error surfaces to the caller rather than resolving to
a duplicate -- so this honors the header, it does not require it.

## Headers

- `Idempotency-Key` string, nullable

## Request body

- ChatCompletionRequest
  - `model` string, required: Either a tier ("corent/text-premium" -- brain-routed, answers with the tier name) or an exact model ("corent-claude-sonnet-5" -- direct access, never substituted). Note the separator: tiers use `corent/`, models use `corent-`. GET /v1/models publishes model names in the `corent-` spelling; older spellings of the same model are still accepted, and the response still answers with the published name.
  - `messages` ChatMessage[], required
    - `role` string, required
    - `content` unknown
    - `name` string, nullable
    - `tool_call_id` string, nullable
    - `tool_calls` object[], nullable
  - `max_tokens` integer, nullable
  - `max_completion_tokens` integer, nullable
  - `temperature` number, nullable
  - `stream` boolean
  - `tools` object[], nullable
  - `tool_choice` unknown
  - `response_format` object, nullable
  - `customer_id` string, nullable: Optional tag for YOUR end user, so you can attribute spend: 1 to 128 characters from A-Z a-z 0-9 . _ : @ -. Stored on the job, returned on receipts, and filterable with GET /v1/account/usage?customer_id=...
  - `user` string, nullable: Optional tag for YOUR end user, so you can attribute spend: 1 to 128 characters from A-Z a-z 0-9 . _ : @ -. Stored on the job, returned on receipts, and filterable with GET /v1/account/usage?customer_id=...

## Response `200`

Successful Response

- unknown

## Other responses

- `409`: This Idempotency-Key was already used by another chat completion. Nothing was generated or billed again; the body names the original request id.
- `422`: Validation Error

---

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