Two Authentication Methods
| Method | Used For | How It Works |
|---|---|---|
| Virtual key (Bearer token) | Proxy API and management API | Include in Authorization header |
| Session cookie | Dashboard web application | Set automatically by the browser |
Virtual Keys
Virtual keys are the primary authentication method for the Raven API. They look like this:Key Format
| Prefix | Environment | Description |
|---|---|---|
rk_live_ | Production | For live API requests |
rk_test_ | Test | For development and testing |
Using a Virtual Key
Include your virtual key in theAuthorization header as a Bearer token:
Creating a Virtual Key
Click Create Key
Enter a name, select the environment, and optionally set rate limits and expiration.
Virtual keys are hashed before storage. After creation, Raven cannot retrieve or display the full key again. If you lose a key, create a new one and revoke the old one.
X-Org-Id Header
For management API requests, specify which organization to operate on using theX-Org-Id header:
/v1/chat/completions), the organization is determined automatically from the virtual key — no X-Org-Id header is needed.
BYOK via X-Provider-Key
Bring Your Own Key (BYOK) lets you pass your own provider API key for a specific request using theX-Provider-Key header:
X-Provider-Key is present:
- The provided key is used instead of the organization’s stored provider key
- All gateway features still apply: logging, guardrails, rate limiting, budgets, and analytics
- The provided key is not stored by Raven — it is used only for the current request
- Playground keys — Let users try the API with their own provider keys
- Per-request overrides — Use a specific key for certain requests without configuring it as a provider
- Testing — Try different provider accounts without updating org settings
Session Authentication
The Raven dashboard uses session-based authentication via HTTP cookies. This is handled automatically by the web application and is not used for API requests.Sign-In Methods
| Method |
|---|
| Email/password |
Security Best Practices
Never expose keys in client-side code
Never expose keys in client-side code
Virtual keys should only be used in server-side code. Never include them in JavaScript that runs in the browser, mobile app bundles, or public repositories.
Use environment variables
Use environment variables
Store keys in environment variables, not in source code:
Use test keys for development
Use test keys for development
Use
rk_test_ keys in development and staging environments. Reserve rk_live_ keys for production.Set expiration dates
Set expiration dates
Configure an expiration date when creating keys. This ensures keys are rotated regularly and reduces the risk from leaked credentials.
Set rate limits
Set rate limits
Configure RPM and RPD limits on every key to prevent abuse. See Rate Limiting.
Monitor usage patterns
Monitor usage patterns
Review analytics regularly for unexpected usage spikes that might indicate a leaked key.
Rotate keys periodically
Rotate keys periodically
Use the key rotation feature to generate a new key and revoke the old one in a single operation.
Error Responses
Missing Authentication
401 Unauthorized
Invalid Key
401 Unauthorized
Expired Key
401 Unauthorized