API Key Types
The gateway supports two authentication methods:Bearer Token (Recommended)
Include your API key in theAuthorization header:
X-API-Key Header
Alternatively, use thex-api-key header:
Getting Your API Key
- Sign in to your LLM Gateway dashboard
- Navigate to the API Keys page
- Click Create API Key
- Copy and securely store your API key
API Key Status
API keys can have the following statuses:- Active - Key is valid and can be used
- Inactive - Key has been disabled
- Deleted - Key has been permanently removed
Usage Limits
API keys can have optional usage limits:401 Unauthorized error:
Authentication Errors
Missing API Key
Invalid API Key
Usage Limit Reached
Project Modes
API keys are associated with projects that operate in different modes:API Keys Mode
Requires provider API keys to be configured in your project settings. The gateway uses your provider keys to make requests.Credits Mode
Uses LLM Gateway’s shared pool of provider keys. Requests are billed against your account credits.Hybrid Mode
Attempts to use your provider API keys first, then falls back to credits if no key is configured.IAM Permissions
API keys can have IAM policies that restrict:- Which models can be accessed
- Which providers can be used
- Which operations are allowed
403 Forbidden error:
Best Practices
Rotate API Keys Regularly
Rotate API Keys Regularly
Create new API keys periodically and delete old ones to minimize security risks.
Use Environment Variables
Use Environment Variables
Store API keys in environment variables instead of hardcoding them:
Set Usage Limits
Set Usage Limits
Configure usage limits on API keys to prevent unexpected charges from runaway processes.
Use Separate Keys for Environments
Use Separate Keys for Environments
Create different API keys for development, staging, and production environments.