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

# Authentication

> How to authenticate API requests to KiosAPI using OpenAI, Claude, or Gemini header formats.

# Authentication

All API requests to KiosAPI require an **API key** passed in the HTTP header. The exact header you use depends on which endpoint format you're calling.

## API Key

Your KiosAPI API key starts with `sk-` and looks like:

```
sk-kioo-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

Treat your API key as a secret — do not expose it in client-side code, public repositories, or logs.

## Authentication Formats

### 1. OpenAI Format

Use this when calling the OpenAI-compatible endpoints (`/v1/chat/completions`, `/v1/responses`):

```bash theme={null}
curl https://kiosapi.com/v1/chat/completions \
  -H "Authorization: Bearer sk-kioo-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.5",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'
```

| Header | Value |
| - | - |
| `Authorization` | `Bearer sk-kioo-xxxxxxxxxxxx` |
| `Content-Type` | `application/json` |

> [!TIP]
>
> This is the most common format. All OpenAI SDK libraries send the key automatically when you set `api_key`.

### 2. Claude (Anthropic) Native Format

Use this when calling the Claude-native endpoint (`/v1/messages`):

```bash theme={null}
curl https://kiosapi.com/v1/messages \
  -H "x-api-key: sk-kioo-xxxxxxxxxxxx" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'
```

| Header | Value |
| - | - |
| `x-api-key` | `sk-kioo-xxxxxxxxxxxx` |
| `anthropic-version` | `2023-06-01` |
| `Content-Type` | `application/json` |

> [!WARNING]
>
> When using the Claude native endpoint, the `anthropic-version` header is **mandatory**. Omitting it will cause a `400 Bad Request` error.

### 3. Gemini (Google) Native Format

Use this when calling the Gemini-native endpoint (`/v1beta/models/{model}:generateContent`):

```bash theme={null}
curl "https://kiosapi.com/v1beta/models/gemini-3.8-flash:generateContent" \
  -H "x-goog-api-key: sk-kioo-xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {"parts": [{"text": "Hello!"}]}
    ]
  }'
```

| Header | Value |
| - | - |
| `x-goog-api-key` | `sk-kioo-xxxxxxxxxxxx` |
| `Content-Type` | `application/json` |

## Getting Your API Key

You can obtain and manage your API key from the KiosAPI dashboard:

1. Log in to [kiosapi.com](https://kiosapi.com).
2. Navigate to **Dashboard > Token Management**.
3. Create a new token or copy an existing one.

> [!TIP]
>
> Your API key carries full access to your KiosAPI account. Never share it publicly, commit it to version control, or embed it in client-side applications. Use environment variables or a secrets manager to load it at runtime.

## Don't Mix Up Your Base URL and Key

> [!WARNING]
>
> KiosAPI keys are **not** interchangeable with keys from OpenAI, Anthropic, or Google. Make sure you:
>
> * Use a **KiosAPI key** (`sk-kioo-...`) for requests to **`kiosapi.com`**.
> * Do **not** send your KiosAPI key to `api.openai.com`, `api.anthropic.com`, or `googleapis.com` — it will be rejected.
> * Do **not** send an OpenAI/Anthropic/Google key to `kiosapi.com` — it will also be rejected.
>
> Mixing up the base URL and key is the most common cause of `401 Unauthorized` errors.


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