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

# Authentication

> Create API keys in the UncensoredGPT Console and authenticate requests with a Bearer token.

The API uses API keys to authenticate requests. Every request must include your key in the `Authorization` header:

```bash theme={null}
Authorization: Bearer $UNCENSOREDGPT_API_KEY
```

> [!WARNING]
>
> Keep your API keys private. Do not share them in browser code, public repositories, or chat messages. If a key is compromised, delete it in the Console and create a new one.

## Create an API key

1. Sign in to the [UncensoredGPT Console](https://console.uncensoredgpt.ai).
2. Go to **Keys** and click **Create key**.
3. Give the key a name (for example, `my-app`) and set any limits you need.
4. Copy the key. It is shown only once — store it somewhere safe.

Keys start with `sk-` and are tied to your account's credit balance and rate limits.

## Use the key in code

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

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://api.uncensoredgpt.ai/v1"
)

response = client.chat.completions.create(
    model="uncensoredgpt/qwen3.8-27b-uncensored",
    messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
```

```javascript JavaScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "YOUR_API_KEY",
  baseURL: "https://api.uncensoredgpt.ai/v1"
});

const response = await client.chat.completions.create({
  model: "uncensoredgpt/qwen3.8-27b-uncensored",
  messages: [{ role: "user", content: "Hello!" }]
});
console.log(response.choices[0].message.content);
```

## The Messages endpoints

The [Anthropic-format Messages endpoints](https://docs.uncensoredgpt.ai/api-reference/endpoints/messages/create-message.md) also accept the `x-api-key` header, so clients that send keys that way work unchanged:

```bash theme={null}
x-api-key: $UNCENSOREDGPT_API_KEY
```

## Managing keys

In the Console you can create multiple keys, rename or delete them, and set per-key limits:

* **Token limits** — tokens per minute (TPM) and requests per minute (RPM).
* **Allowed models** — restrict a key to a subset of the catalog.
* **Allowed routes** — restrict a key to specific endpoints.

All keys on your account draw from the same credit balance. See [Usage & Billing](https://docs.uncensoredgpt.ai/api-reference/usage-and-billing.md) for details.


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