API Key Management: Budgets, Rate Limits & Spending Controls
Qubax gives you granular control over API spending. This guide covers budgets, rate limits, and multi-key strategies to keep costs predictable.
Creating API Keys
- Go to qubax.ai/app → API Keys
- Click Create Key
- Name it (e.g., "Production", "Testing", "Cline")
- Copy the key immediately (shown only once)
Budget Controls
Each API key can have three budget types:
| Budget | Scope | Use Case |
|---|---|---|
| Daily | Resets every 24h | Prevent runaway costs |
| Weekly | Resets every 7 days | Sprint-based spending |
| Monthly | Resets every 30 days | Team budget per developer |
Example: Limit Cline to $5/month
- Create a key named "Cline"
- Set Monthly Budget to $5.00
- Use that key in Cline settings
When the budget is hit, the API returns a 402 error instead of silently letting you overspend.
Rate Limits
| Setting | Scope | Example |
|---|---|---|
| Rate limit per minute | Prevents burst | 60 req/min |
| Rate limit per day | Daily cap | 1000 req/day |
Example: Prevent accidental loops
Set rate limit to 100 req/min. If your code has an infinite loop, it'll hit the rate limit and stop instead of draining your balance in seconds.
Multi-Key Strategy
Best practice: use separate keys for different tools:
Key 1: "Cursor" — Monthly budget $10, model: claude-sonnet-5
Key 2: "Cline" — Monthly budget $5, model: claude-sonnet-5
Key 3: "Scripts" — Daily budget $1, model: gpt-5.6-terra
Key 4: "Production" — Monthly budget $50, no rate limitThis way, if one tool goes rogue, it only burns its own budget — not your entire balance.
Monitoring Usage
Each key shows:
- Total requests
- Total cost in USD
- Tokens in/out
- 7-day daily breakdown
- Top models used
All visible from the API Keys dashboard.
API Key Scopes
| Scope | Access |
|---|---|
| CHAT | Chat completions endpoint |
| MODELS | List models endpoint |
| BILLING_READ | View balance (read-only) |
Use scoped keys for third-party integrations — they can only access what they need.
CLI Key Management
# Create key via API
curl -X POST https://api.qubax.ai/v1/api-keys \
-H "Authorization: Bearer qbx_live_YOUR_KEY" \
-d '{"name": "Production", "monthlyBudgetUsd": 50}'
# List keys
curl https://api.qubax.ai/v1/api-keys \
-H "Authorization: Bearer qbx_live_YOUR_KEY"
# Revoke a key
curl -X DELETE https://api.qubax.ai/v1/api-keys/KEY_ID \
-H "Authorization: Bearer qbx_live_YOUR_KEY"Best Practices
- Never commit keys to git — use environment variables
- Rotate keys quarterly — delete old, create new
- Set budgets on every key — even "unlimited" should have a cap
- Use scoped keys for integrations — minimize blast radius
- Monitor the 7-day chart — catch spikes early
Related
Start managing your API spending — [get $1 free credits](https://qubax.ai/register).