> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qlaud.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# POST /v1/messages

> Anthropic Messages API surface — works with every catalog model.

Native Anthropic Messages API. Body is forwarded verbatim to Anthropic for
Claude models, or translated to OpenAI Chat Completions shape for everything
else.

## Endpoint

```
POST https://api.qlaud.ai/v1/messages
```

## Auth

```
x-api-key: qlk_live_...
anthropic-version: 2023-06-01
```

## Request body

Standard Anthropic Messages shape. See
[Anthropic's docs](https://docs.anthropic.com/en/api/messages) for the full
schema. Notable extras:

* `cache_control: ephemeral` markers are forwarded to Anthropic upstream
  verbatim. \~75% input-cost reduction on cached blocks.
* `model` accepts any qlaud catalog slug (see [/models](https://qlaud.ai/models)
  for the full list).

## Example

```bash theme={null}
curl https://api.qlaud.ai/v1/messages \
  -H "x-api-key: $QLAUD_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [{"role":"user","content":"hello"}]
  }'
```

## Response

Standard Anthropic Messages response. `usage` field powers our metering.

## Errors

| Status | Meaning                                    |
| ------ | ------------------------------------------ |
| 401    | Bad / revoked qlk key                      |
| 402    | Wallet exhausted OR per-key cap exceeded   |
| 404    | Unknown model slug                         |
| 429    | Upstream rate-limited                      |
| 5xx    | Upstream returned 5xx — retry with backoff |
