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

# Messages

> Create a message using the Anthropic Messages format.

Creates a model response using the Anthropic Messages API request and response format. Like all
inference endpoints, requests are served through the attested TEE gateway and return an
`x-receipt-id` header for [verification](/guides/verify-a-response).

```bash theme={null}
POST https://api.redpill.ai/v1/messages
```

## Request Body

<ParamField body="model" type="string" required>
  Model id, for example `anthropic/claude-haiku-4.5`.
</ParamField>

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

<ParamField body="messages" type="array" required>
  Conversation turns. Each item has a `role` (`user` or `assistant`) and `content` (a string or an
  array of content blocks).
</ParamField>

<ParamField body="system" type="string">
  A system prompt, sent as a top-level field rather than a message.
</ParamField>

<ParamField body="temperature" type="number">
  Sampling temperature.
</ParamField>

<ParamField body="stream" type="boolean">
  Stream the response as server-sent events.
</ParamField>

<ParamField body="provider" type="object">
  Routing constraints for this request, applied together. `zdr` restricts routing to providers that
  do not retain content; `aci_verified` restricts it to an upstream verified inside the TEE;
  `aci_session_ids` pins it to specific attested channels.

  ```json theme={null}
  {"provider": {"aci_verified": true}}
  ```

  If no provider satisfies the constraints the request fails before the prompt is sent, and failover
  retries stay inside the allowed set. Field reference:
  [Chat Completions](/api-reference/chat-completions#body-provider). See
  [Attested routing](/guides/attested-routing) and
  [Zero data retention](/guides/zero-data-retention).
</ParamField>

## Example

```bash theme={null}
curl https://api.redpill.ai/v1/messages \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-haiku-4.5",
    "max_tokens": 100,
    "messages": [
      {"role": "user", "content": "Say hello in 3 words."}
    ]
  }'
```

## Response

```json theme={null}
{
  "id": "msg_01ABC...",
  "type": "message",
  "role": "assistant",
  "model": "anthropic/claude-haiku-4.5",
  "content": [
    { "type": "text", "text": "Hello, howdy, hi!" }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": { "input_tokens": 14, "output_tokens": 8 }
}
```

Read assistant text from `content[].text` on blocks with `type: "text"`. `stop_reason` is one of
`end_turn`, `max_tokens`, `stop_sequence`, or `tool_use`.

## Related

<CardGroup cols={2}>
  <Card title="Chat Completions" icon="comments" href="/api-reference/chat-completions" />

  <Card title="Responses" icon="arrow-right-arrow-left" href="/api-reference/responses" />
</CardGroup>
