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

# API authentication

> Learn how to pass your Anyone API key in requests, supporting OpenAI, Claude, and Gemini formats.

All API requests require authentication. Include your Anyone API key in the request header.

## OpenAI format (recommended)

Use this for most scenarios — it works with all endpoints:

```bash theme={null}
curl https://api.anyone.ai/v1/chat/completions \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-5.4", "messages": [{"role": "user", "content": "hi"}]}'
```

## Claude Messages format

If you're using the Anthropic SDK or the native Claude format:

```bash theme={null}
curl https://api.anyone.ai/v1/messages \
  -H "x-api-key: YOUR_TOKEN" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-4-20250514", "max_tokens": 1024, "messages": [{"role": "user", "content": "hi"}]}'
```

## Gemini format

If you're using the Google Gemini SDK:

```bash theme={null}
# Option 1: Header authentication
curl "https://api.anyone.ai/v1beta/models/gemini-2.5-pro:generateContent" \
  -H "x-goog-api-key: YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"contents": [{"parts": [{"text": "hi"}]}]}'

# Option 2: URL parameter
curl "https://api.anyone.ai/v1beta/models/gemini-2.5-pro:generateContent?key=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"contents": [{"parts": [{"text": "hi"}]}]}'
```

## SDK configuration examples

<CodeGroup>
  ```python Python (OpenAI SDK) theme={null}
  from openai import OpenAI

  client = OpenAI(
      base_url="https://api.anyone.ai/v1",
      api_key="YOUR_TOKEN",
  )
  ```

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

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

  ```python Python (Anthropic SDK) theme={null}
  import anthropic

  client = anthropic.Anthropic(
      base_url="https://api.anyone.ai",
      api_key="YOUR_TOKEN",
  )
  ```
</CodeGroup>

<Tip>
  Not sure which format to use? **Go with the OpenAI format** — it works with all models (including Claude and Gemini), and is the most universal option.
</Tip>
