Authentication
OpenModels authenticates API requests with an OpenModels API key in the Authorization header. API keys use the ale-... format.
API key format
Keys are shown once when created. Store them in a secrets manager or environment variable before leaving the creation screen.
Authorization header
Send the key as a Bearer token:
Environment variables
Use an environment variable for local development:
Then pass it to an OpenAI-compatible SDK:
Key management
Use separate keys for development, staging, and production. This makes it easier to rotate a key without disrupting every environment.
Recommended practices:
- Store keys in a secrets manager.
- Do not commit keys to source control.
- Rotate a key immediately if it may have leaked.
- Revoke unused keys.
- Use monthly spend limits to cap the maximum spend for each key.
- Use separate keys for different applications or workloads when you need cleaner usage tracking.
Common authentication errors
If a request fails with 401, check that the Authorization header uses the exact Bearer <key> format and that the key still exists in the OpenModels dashboard.
If authentication succeeds but a request is blocked by credits or spend limits, see Credits & Billing, Rate Limits, and Errors.