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

# Using API Keys

> How to authenticate requests with your RamaLama Cloud API key.

Once you have [created an API key](/cloud/api-keys/creating), use it to authenticate requests to RamaLama Cloud.

Your API key provisions access to a variety of hosted API gateways, allowing you to access models from multiple providers through a unified interface.

## Authentication

Include your API key in the `Authorization` header with the `Bearer` prefix:

```
Authorization: Bearer your-api-key
```

## Accessing Models

Models are referenced using the format `provider/model-name`. This allows you to call models from different providers through the same API endpoint.

### Example: Calling GPT-5.1

<CodeGroup>
  ```bash title="curl" theme={"system"}
  curl -X POST https://gateway.ramalama.com/v1/chat/completions \
    -H "Authorization: Bearer $RAMALAMA_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "openai/gpt-5.1",
      "messages": [
        {"role": "user", "content": "Hello, world!"}
      ]
    }'
  ```

  ```python title="Python" theme={"system"}
  import os
  import requests

  api_key = os.environ.get("RAMALAMA_API_KEY")

  response = requests.post(
      "https://gateway.ramalama.com/v1/chat/completions",
      headers={
          "Authorization": f"Bearer {api_key}",
          "Content-Type": "application/json"
      },
      json={
          "model": "openai/gpt-5.1",
          "messages": [
              {"role": "user", "content": "Hello, world!"}
          ]
      }
  )

  print(response.json())
  ```
</CodeGroup>

## Environment Variables

Store your API key in an environment variable to avoid hardcoding it:

```bash theme={"system"}
export RAMALAMA_API_KEY="your-api-key-here"
```

## Error Responses

| Status Code | Meaning                                            |
| ----------- | -------------------------------------------------- |
| 401         | Invalid or missing API key                         |
| 403         | API key does not have permission for this resource |
| 429         | Rate limit exceeded                                |

## Security Tips

* Never expose API keys in client-side code
* Use environment variables or secret management tools
* Implement key rotation in production environments
