Authentication
All API requests require authentication with an API key.
Getting Your API Key
- Sign up at scalellm.dev/signup
- Go to your dashboard
- Create a new API key
- Copy the key (starts with
sk_)
Store your API key securely. Don’t commit it to version control or share it publicly.
Using Your API Key
Include the key in the Authorization header:
curl https://api.scalellm.dev/v1/chat/completions \
-H "Authorization: Bearer sk_your_key" \
-H "Content-Type: application/json" \
-d '{"model": "claude-sonnet-4.5", "messages": [{"role": "user", "content": "Hi"}]}'
Environment Variables
Store your key in an environment variable:
export SCALELLM_API_KEY="sk_your_key"
Then use it in code:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.scalellm.dev/v1",
api_key=os.environ["SCALELLM_API_KEY"]
)
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.scalellm.dev/v1',
apiKey: process.env.SCALELLM_API_KEY
});
curl https://api.scalellm.dev/v1/chat/completions \
-H "Authorization: Bearer $SCALELLM_API_KEY" \
-H "Content-Type: application/json" \
-d '...'
API Key Best Practices
- Don’t commit keys to version control
- Use environment variables in production
- Rotate keys periodically via your dashboard
- Use separate keys for development and production
Error Responses
| Status | Meaning |
|---|
| 401 | Invalid or missing API key |
| 403 | Key doesn’t have permission |
| 429 | Rate limit exceeded |