Authentication
How to authenticate your API requests.
Authentication
TurboAPI uses API keys to authenticate requests. You can view and manage your API keys in the Dashboard.
API Keys
Your API keys carry many privileges, so be sure to keep them secure! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
Getting Your API Key
Authentication Request
Include your API key in the Authorization header:
curl https://api.turboapi.ai/v1/models \
-H "Authorization: Bearer YOUR_API_KEY"
Environment Variables
Store your API key securely:
# .env
TURBOAPI_API_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxxxx
Using in Code
import { TurboAPI } from '@turboapi/sdk';
const client = new TurboAPI({
apiKey: process.env.TURBOAPI_API_KEY,
});
from turboapi import TurboAPI
client = TurboAPI(api_key="YOUR_API_KEY")
import "github.com/turboapi/sdk-go"
client := turboapi.NewClient(turboapi.WithAPIKey("YOUR_API_KEY"))
Key Types
| Key Type | Prefix | Usage |
|---|---|---|
| Live | sk_live_ | Production requests |
| Test | sk_test_ | Testing (no real charges) |
| Restricted | sk_restrict_ | Limited permissions |
Security Best Practices
- ✅ Use environment variables
- ✅ Rotate keys regularly
- ✅ Use restricted keys for frontend
- ❌ Never commit keys to Git
- ❌ Don't expose keys in URLs
- ❌ Don't share in chat/slack
If you believe an API key has been compromised, revoke it immediately in the Dashboard.