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

# Authentication

> How to obtain and use API Keys

> Last updated: 2026-06-16

## Bearer Token Authentication

All API requests require an API Key in the header:

```
Authorization: Bearer YOUR_API_KEY
```

## Getting an API Key

1. Log in to [Crazyrouter](https://crazyrouter.com)
2. After signing in, go to the [Token Management](https://crazyrouter.com/console/token) page
3. Click "Create Token"
4. Set the token name, quota limit, available models, etc.
5. Copy the generated key starting with `sk-`

<Warning>
  The API Key is only displayed once at creation time. Please save it securely. If lost, you will need to create a new one.
</Warning>

## Usage Examples

<Note>
  For OpenAI-compatible access, use `https://api.crazyrouter.com/v1` as the default international address. For East Asia, prefer `https://cn.crazyrouter.com/v1`. If you are configuring Claude Code, Hermes, OpenClaw, or another client, check [API Endpoints](https://docs.crazyrouter.com/en/api-endpoint) first.
</Note>

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.crazyrouter.com/v1/chat/completions \
    -H "Authorization: Bearer sk-xxxxxxxx" \
    -H "Content-Type: application/json" \
    -d '{"model": "gpt-5.5", "messages": [{"role": "user", "content": "Hi"}]}'
  ```

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

  client = OpenAI(
      api_key="sk-xxxxxxxx",
      base_url="https://api.crazyrouter.com/v1"
  )
  ```

  ```javascript Node.js theme={null}
  import OpenAI from 'openai';

  const client = new OpenAI({
    apiKey: 'sk-xxxxxxxx',
    baseURL: 'https://api.crazyrouter.com/v1'
  });
  ```
</CodeGroup>

## Token Permission Controls

When creating a token, you can configure:

* **Name**: For easy identification of its purpose
* **Quota Limit**: Set the maximum available quota
* **Expiration Time**: Set a validity period
* **Available Models**: Restrict which models can be called
* **IP Whitelist**: Restrict the source IPs allowed to make calls
