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

# Anthropic Messages API — POST /v1/messages

> POST /v1/messages — Anthropic-compatible endpoint. Accepts model, messages, max_tokens, and system. Returns an Anthropic-format content array response.

The messages endpoint implements the Anthropic Messages API format, letting you use the official Anthropic SDK with Darkbloom by pointing it at `https://api.darkbloom.dev`. The request and response shapes follow the Anthropic API specification; the coordinator routes the request through the same provider dispatch and attestation pipeline as all other inference endpoints.

## Authentication

All inference endpoints require a Bearer token:

```
Authorization: Bearer sk-db-...
```

When using the Anthropic SDK, set `base_url="https://api.darkbloom.dev"` and pass your Darkbloom API key as `auth_token`. The SDK's `api_key` option sends `x-api-key`, which the coordinator ignores.

## Request

**model** `string` *required*

The model ID to use. See [Models](https://docs.darkbloom.dev/reference/models.md) for the list of available IDs.

**messages** `object[]` *required*

The conversation as an array of message objects. Each object must have:

* `role` — `"user"` or `"assistant"`
* `content` — the message text (string)

**max\_tokens** `integer` *required*

Maximum number of tokens to generate. Required in Anthropic format.

**system** `string`

An optional system prompt that sets context or persona for the assistant.

## Response

The response follows the Anthropic response shape with a `content` array.

**id** `string`

Unique identifier for the request.

**type** `string`

Always `"message"`.

**role** `string`

Always `"assistant"`.

**content** `object[]`

Array of content blocks. Text responses contain a single block with `type: "text"`.

**content block fields**

**content\[].type** `string`

Content block type. `"text"` for standard responses.

**content\[].text** `string`

The generated text (present when `type` is `"text"`).

**stop\_reason** `string`

Why generation stopped. `"end_turn"` for natural completion; `"max_tokens"` if the token limit was reached.

**usage** `object`

**usage fields**

**usage.input\_tokens** `integer`

Tokens consumed by the input.

**usage.output\_tokens** `integer`

Tokens generated in the response.

## Examples

```python Python (Anthropic SDK) theme={null}
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.darkbloom.dev",
    auth_token="sk-db-...",
)

message = client.messages.create(
    model="gemma-4-26b",
    max_tokens=512,
    system="You are a helpful assistant.",
    messages=[
        {"role": "user", "content": "What is the difference between a process and a thread?"}
    ],
)

print(message.content[0].text)
```

```bash cURL theme={null}
curl https://api.darkbloom.dev/v1/messages \
  -H "Authorization: Bearer sk-db-..." \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemma-4-26b",
    "max_tokens": 512,
    "system": "You are a helpful assistant.",
    "messages": [
      {"role": "user", "content": "What is the difference between a process and a thread?"}
    ]
  }'
```

### Example response

```json theme={null}
{
  "id": "msg_01XFDUDYJgAACTvhG8fDDBEc",
  "type": "message",
  "role": "assistant",
  "content": [
    {
      "type": "text",
      "text": "A process is an independent program with its own memory space..."
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 22,
    "output_tokens": 94
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.