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

# API Overview

> Base URL, authentication, and the full list of API endpoints.

## Base URL

```
https://api.redpill.ai/v1
```

## Authentication

Send your API key as a bearer token:

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

See [Authentication](/get-started/authentication) for key management.

## Endpoints

### Inference

| Endpoint                                                  | Method | Description                                               |
| --------------------------------------------------------- | ------ | --------------------------------------------------------- |
| [`/v1/chat/completions`](/api-reference/chat-completions) | POST   | Create a chat completion.                                 |
| [`/v1/responses`](/api-reference/responses)               | POST   | Create a response (Responses API format).                 |
| [`/v1/messages`](/api-reference/messages)                 | POST   | Create a message (Anthropic Messages format).             |
| [`/v1/embeddings`](/api-reference/embeddings)             | POST   | Create text embeddings.                                   |
| [`/v1/models`](/api-reference/models)                     | GET    | List models with providers, context windows, and pricing. |

Each model has an `is_tee` boolean: `is_tee: true` means it can be served confidentially, on a
verified TEE provider. The receipt's `upstream.verified` event confirms a specific response was. See
[Confidential models](/confidential-ai/confidential-models).

### Verification

| Endpoint                                            | Method | Description                                                       |
| --------------------------------------------------- | ------ | ----------------------------------------------------------------- |
| [`/v1/aci/attestation`](/api-reference/attestation) | GET    | Fresh TEE attestation report, bound to a caller-supplied `nonce`. |
| [`/v1/aci/receipts/{id}`](/api-reference/receipts)  | GET    | Signed receipt for a response, by receipt id or chat id.          |
| [`/v1/aci/sessions/{id}`](/api-reference/sessions)  | GET    | Attested-session record referenced by a receipt.                  |
| [`/v1/aci/sessions`](/api-reference/sessions)       | GET    | List a provider's attested sessions (`?provider=&model=`).        |

To verify a response: fetch the attestation report with a fresh `nonce`, read the `x-receipt-id`
header on your response, fetch its signed receipt, then check the receipt signature under the attested
keyset and compare the request and response hashes. See [Verify a response](/guides/verify-a-response).

### Legacy

Legacy endpoints kept for backward compatibility with earlier API clients. New integrations should use the canonical
endpoints above.

| Endpoint                                                      | Method | Canonical replacement   |
| ------------------------------------------------------------- | ------ | ----------------------- |
| [`/v1/completions`](/api-reference/completions)               | POST   | `/v1/chat/completions`  |
| [`/v1/signature/{id}`](/api-reference/signature)              | GET    | `/v1/aci/receipts/{id}` |
| [`/v1/attestation/report`](/api-reference/attestation-report) | GET    | `/v1/aci/attestation`   |

## Request format

POST requests use JSON:

```bash theme={null}
curl https://api.redpill.ai/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "qwen/qwen3-30b-a3b-instruct-2507",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

## Response format

```json theme={null}
{
  "id": "chatcmpl-123",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "qwen/qwen3-30b-a3b-instruct-2507",
  "choices": [{
    "index": 0,
    "message": { "role": "assistant", "content": "Hello! How can I help you?" },
    "finish_reason": "stop"
  }],
  "usage": { "prompt_tokens": 9, "completion_tokens": 12, "total_tokens": 21 }
}
```

## Response headers

Inference responses include verification headers:

| Header                | Description                                                           |
| --------------------- | --------------------------------------------------------------------- |
| `x-receipt-id`        | Id of the signed [receipt](/api-reference/receipts) for the response. |
| `x-aci-identity`      | The attested workload identity that served the request.               |
| `x-aci-keyset-digest` | Digest of the workload's published keyset.                            |
| `x-aci-version`       | ACI version, for example `aci/1`.                                     |

To select a model, set the `model` field in the request body. For end-to-end encryption, send the
`X-E2EE-*` request headers from the [E2EE guide](/guides/e2ee-encryption).

## Errors

Errors return a JSON body with an appropriate HTTP status:

```json theme={null}
{
  "error": {
    "message": "Invalid API key",
    "type": "invalid_request_error",
    "code": "invalid_api_key"
  }
}
```

| Code | Meaning                          |
| ---- | -------------------------------- |
| 200  | Success                          |
| 400  | Bad request (invalid parameters) |
| 401  | Unauthorized (invalid API key)   |
| 403  | Forbidden (insufficient credits) |
| 404  | Endpoint or model not found      |
| 429  | Rate limit exceeded              |
| 500  | Server error                     |
| 503  | Service unavailable              |

See [Error handling](/guides/error-handling). Rate limits depend on your account tier; check the
[dashboard](https://www.redpill.ai/dashboard).

## Using existing client libraries

The API follows the OpenAI request and response format, so OpenAI client libraries work by pointing
the base URL at the gateway and using your API key:

```python theme={null}
from openai import OpenAI

client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.redpill.ai/v1")
resp = client.chat.completions.create(
    model="qwen/qwen3-30b-a3b-instruct-2507",
    messages=[{"role": "user", "content": "Hello"}],
)
```

See [Integrations](/guides/integrations/overview) for SDKs and tools.
