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

# Authentication

> Find your GGUF Cloud deployment's base URL and authenticate with your existing ModelsLab API key using the Authorization, x-api-key, or key header.

Every GGUF Cloud deployment is a private endpoint with its own base URL, authenticated with your existing ModelsLab API key. No separate key is required.

## Base URL

Each deployment has a unique base URL. The `{deployment_id}` is shown on the deployment's dashboard page at [modelslab.com/gguf-cloud](https://modelslab.com/gguf-cloud?utm_source=docs.modelslab.com\&utm_medium=referral\&utm_campaign=docs\&utm_content=gguf-cloud-authentication):

```
https://modelslab.com/api/gguf/{deployment_id}
```

### Choosing the right base\_url

The two SDK families expect the base URL in slightly different forms. Use the matching one:

| SDK / Client | `base_url` value |
| - | - |
| OpenAI SDK (Python, Node, LangChain, …) | `https://modelslab.com/api/gguf/{deployment_id}/v1` |
| Anthropic SDK / Claude Code | `https://modelslab.com/api/gguf/{deployment_id}` |

> [!NOTE]
>
> The OpenAI SDK appends paths like `/chat/completions` to the base URL, so the base URL ends in `/v1`. The Anthropic SDK appends `/v1/messages` itself, so its base URL is the **root** (no trailing `/v1`).

## API key

Authenticate with your existing **ModelsLab API key**. You can find or create one in your [API Keys Dashboard](https://modelslab.com/dashboard/api-keys?utm_source=docs.modelslab.com\&utm_medium=referral\&utm_campaign=docs\&utm_content=gguf-cloud-authentication). The gateway accepts the key in any of three headers, so SDKs from both ecosystems work unchanged:

**Authorization** `string`

Bearer token form used by OpenAI SDKs: `Authorization: Bearer YOUR_MODELSLAB_API_KEY`

**x-api-key** `string`

Header used by Anthropic SDKs and Claude Code: `x-api-key: YOUR_MODELSLAB_API_KEY`

**key** `string`

Plain header form: `key: YOUR_MODELSLAB_API_KEY`

> [!WARNING]
>
> Never share your API key publicly or commit it to version control. Treat it like a password and use environment variables in production.

## Examples

```python Python (OpenAI SDK) theme={"theme":{"light":"github-light","dark":"github-dark"}}
from openai import OpenAI

client = OpenAI(
    api_key="YOUR_MODELSLAB_API_KEY",
    base_url="https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1",
)
```

```python Python (Anthropic SDK) theme={"theme":{"light":"github-light","dark":"github-dark"}}
from anthropic import Anthropic

client = Anthropic(
    api_key="YOUR_MODELSLAB_API_KEY",
    base_url="https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID",
)
```

```bash cURL (Authorization) theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/models" \
  -H "Authorization: Bearer $MODELSLAB_API_KEY"
```

```bash cURL (x-api-key) theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl "https://modelslab.com/api/gguf/YOUR_DEPLOYMENT_ID/v1/models" \
  -H "x-api-key: $MODELSLAB_API_KEY"
```

## Next steps

> [card] [Chat Completions](https://docs.modelslab.com/gguf-cloud/chat-completions.md)
>
> Call the OpenAI-compatible endpoints on your deployment.

> [card] [Messages](https://docs.modelslab.com/gguf-cloud/messages.md)
>
> Call the Anthropic-compatible endpoint, or point Claude Code at your deployment.


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