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

# Authentication

> Authenticate requests with a bearer API key.

Every request requires a bearer API key, passed in the `Authorization` header:

```text theme={null}
Authorization: Bearer <YOUR_API_KEY>
```

Requests without a valid, active key return `401 Unauthorized`.

<Note>
  Create and manage API keys in the **web panel** at [bananahub.io](https://bananahub.io). Keys can be scoped to specific models — a key without permission for the requested model returns `403`.
</Note>

## Idempotency

All generation endpoints accept an optional `Idempotency-Key` header. Replaying the same key returns the original `job_id` **without** creating a duplicate job or charging again.

```text theme={null}
Idempotency-Key: 9f1c8b1e-7c2a-4a86-9b6e-2c5fa0b7d8e1
```

<Tip>
  Use a fresh UUID per logical request and retry with the same key on network failures — this makes job creation safe to retry.
</Tip>

```bash Example theme={null}
curl -s -X POST https://bananahub.io/api/v1/text-generations \
  -H "Authorization: Bearer $API_KEY" \
  -H "Idempotency-Key: 9f1c8b1e-7c2a-4a86-9b6e-2c5fa0b7d8e1" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a red panda astronaut floating in a nebula",
    "aspect_ratio": "16:9",
    "resolution": "2K"
  }'
```
