API Keys
RedPill uses API keys to authenticate requests. All requests must include your API key in theAuthorization
header.
Getting Your API Key
1
Sign Up
Create an account at redpill.ai/signup
2
Access Dashboard
Navigate to your dashboard
3
Generate API Key
Click “Generate API Key” to create a new key
4
Add Credits
Add credits to your account to start making requests
Using API Keys
Include your API key in theAuthorization
header with the Bearer
scheme:
Environment Variables
Store your API key securely using environment variables:Key Format
RedPill API keys follow this format:sk-9JABKD0bYW6s8VN6PoIG0LUOj1uo44TrXm0MNJWXe7GWP1wR
Security Best Practices
Never Hardcode API Keys
Never Hardcode API Keys
❌ Don’t do this:✅ Do this instead:
Use Environment Variables
Use Environment Variables
Store API keys in environment variables or secure secret management systems:
.env
files (add to.gitignore
)- AWS Secrets Manager
- Google Cloud Secret Manager
- Azure Key Vault
- HashiCorp Vault
Never Commit Keys to Git
Never Commit Keys to Git
Add files containing keys to
.gitignore
:Rotate Keys Regularly
Rotate Keys Regularly
- Generate new API keys periodically
- Revoke old keys after rotation
- Use different keys for development and production
Use Server-Side Only
Use Server-Side Only
Never expose API keys in client-side code (browsers, mobile apps):
- ❌ Don’t include in JavaScript sent to browsers
- ❌ Don’t embed in mobile app binaries
- ✅ Make requests from your backend server
- ✅ Use proxy endpoints for client apps
Request Headers
Required Headers
Header | Value | Description |
---|---|---|
Authorization | Bearer YOUR_API_KEY | Your RedPill API key |
Content-Type | application/json | Request body format |
Optional Headers
Header | Example | Description |
---|---|---|
x-redpill-provider | openai | Force specific provider |
x-redpill-trace-id | custom-trace-123 | Custom trace ID for logging |
x-redpill-metadata | {"user_id": "123"} | Custom metadata |
Managing API Keys
View Your Keys
Access your API keys in the dashboard.Revoke a Key
If a key is compromised:- Go to your dashboard
- Find the compromised key
- Click “Revoke”
- Generate a new key
Multiple Keys
You can create multiple API keys for different purposes:- Development: For local testing
- Staging: For staging environment
- Production: For live applications
- CI/CD: For automated testing
Rate Limits
API keys are subject to rate limits based on your account tier:Tier | Requests/Min | Tokens/Min |
---|---|---|
Free | 60 | 100,000 |
Pro | 600 | 1,000,000 |
Enterprise | Custom | Custom |
Learn More About Pricing
View detailed pricing and rate limits →
Checking Your Usage
Monitor your API usage and credit balance:Error Handling
Invalid API Key
Missing API Key
Insufficient Credits
Error Handling Guide
Learn how to handle all API errors →
FAQs
Can I use my OpenAI API key with RedPill?
Can I use my OpenAI API key with RedPill?
No, you need a RedPill API key. However, RedPill is OpenAI-compatible, so you can use the same SDKs and code - just change the API key and base URL.
How are credits calculated?
How are credits calculated?
Credits are deducted based on the number of tokens processed. Different models have different per-token costs. See Pricing for details.
What happens if my API key is compromised?
What happens if my API key is compromised?
Immediately revoke the compromised key in your dashboard and generate a new one. Past requests cannot be reversed, but revoking stops future unauthorized use.
Can I share my API key with teammates?
Can I share my API key with teammates?
Do API keys expire?
Do API keys expire?
API keys don’t expire automatically but can be revoked manually. It’s recommended to rotate keys periodically for security.