> ## 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 eigeninference-...
```

When using the Anthropic SDK, pass your Darkbloom API key as the `api_key` argument alongside the custom `base_url`.

## Request

<ParamField body="model" type="string" required>
  The model ID to use. See [Models](/reference/models) for the list of available IDs.
</ParamField>

<ParamField body="messages" type="object[]" required>
  The conversation as an array of message objects. Each object must have:

  * `role` — `"user"` or `"assistant"`
  * `content` — the message text (string)
</ParamField>

<ParamField body="max_tokens" type="integer" required>
  Maximum number of tokens to generate. Required in Anthropic format.
</ParamField>

<ParamField body="system" type="string">
  An optional system prompt that sets context or persona for the assistant.
</ParamField>

## Response

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

<ResponseField name="id" type="string">
  Unique identifier for the request.
</ResponseField>

<ResponseField name="type" type="string">
  Always `"message"`.
</ResponseField>

<ResponseField name="role" type="string">
  Always `"assistant"`.
</ResponseField>

<ResponseField name="content" type="object[]">
  Array of content blocks. Text responses contain a single block with `type: "text"`.

  <Expandable title="content block fields">
    <ResponseField name="content[].type" type="string">
      Content block type. `"text"` for standard responses.
    </ResponseField>

    <ResponseField name="content[].text" type="string">
      The generated text (present when `type` is `"text"`).
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="stop_reason" type="string">
  Why generation stopped. `"end_turn"` for natural completion; `"max_tokens"` if the token limit was reached.
</ResponseField>

<ResponseField name="usage" type="object">
  <Expandable title="usage fields">
    <ResponseField name="usage.input_tokens" type="integer">
      Tokens consumed by the input.
    </ResponseField>

    <ResponseField name="usage.output_tokens" type="integer">
      Tokens generated in the response.
    </ResponseField>
  </Expandable>
</ResponseField>

## Examples

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

  client = anthropic.Anthropic(
      base_url="https://api.darkbloom.dev",
      api_key="eigeninference-...",
  )

  message = client.messages.create(
      model="qwen3.5-27b-claude-opus-8bit",
      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 eigeninference-..." \
    -H "Content-Type: application/json" \
    -d '{
      "model": "qwen3.5-27b-claude-opus-8bit",
      "max_tokens": 512,
      "system": "You are a helpful assistant.",
      "messages": [
        {"role": "user", "content": "What is the difference between a process and a thread?"}
      ]
    }'
  ```
</CodeGroup>

### 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
  }
}
```
