Authentication

Authenticate requests and keep your API keys secure across gateway endpoints.

Create an API key

Open API Keys in the console and create a key with sufficient quota and access to your chosen model. Replace YOUR_API_KEY in the examples with this key.

Authorization header

Use a gateway API key, not an upstream provider key. Send it in the Authorization header. Keep keys on your server and out of browser bundles, public repositories and shared screenshots.

Authorization: Bearer YOUR_API_KEY

Troubleshooting

For authentication errors, check the key and its expiry. For quota errors, check your balance and key quota. If a model is unavailable, check its exact ID and group access. For rate limits, retry with backoff.