Manage Virtual Keys
Create per-user or per-team API keys with budget limits and rate limits.
Prerequisites
- A Xilos account with admin access
- Your master API key (from Settings)
Why Virtual Keys?
Virtual keys give you granular control over who can access Xilos and how much they can spend:
- Budget limits — Set a monthly USD spend cap per key
- Rate limits — Set requests per minute per key
- Per-user tracking — Each key's usage is tracked separately in Cost Controls
- Easy deactivation — Disable a key without affecting others
- No key sharing — Each user or service gets their own key
Step 1: Create a Virtual Key
- Navigate to SuperAdmin > Keys in the sidebar.
- Click Create Virtual Key.
- Fill in the form:
- Name — Descriptive name (e.g., "Engineering Team", "CI/CD Pipeline")
- Budget (USD/month) — Monthly spend limit (e.g., 500.00)
- Rate Limit (requests/minute) — Maximum requests per minute (e.g., 100)
- Click Save.
- Copy the generated key — it will only be shown once.
Warning: Virtual keys are only shown once at creation time. Store the key securely. If lost, you must create a new key.
Step 2: Distribute Keys
Give each user or service their own virtual key:
- Per-user: Create a key for each developer or team member
- Per-team: Create a key per department (Engineering, Marketing, etc.)
- Per-service: Create a key for each integration (CI/CD, chatbot, etc.)
Users set the virtual key as their API key:
export OPENAI_API_KEY="xilos-vk-..."
export OPENAI_BASE_URL="https://api.xilos.ai/api/v1"Step 3: Monitor Usage
Track each key's usage in Cost Controls:
- Navigate to Dashboard > Cost Controls.
- View the Per-User Breakdown section.
- See spend, query count, and average cost per key.
Step 4: Manage Budgets
When a key exceeds its monthly budget:
- The key is automatically deactivated.
- Requests using that key return a 429 (rate limited) or 403 (forbidden).
- The key status changes to "Budget Exceeded" in the dashboard.
- The key reactivates at the start of the next billing cycle.
To manually adjust:
- Navigate to SuperAdmin > Keys.
- Find the key.
- Increase the budget or deactivate the key.
Step 5: Deactivate or Delete Keys
- Navigate to SuperAdmin > Keys.
- Find the key.
- Toggle Active to deactivate (preserves the key for future use).
- Or click Delete to permanently remove the key.
Info: Deactivated keys immediately reject all requests. Use deactivation for temporary access revocation.
Best Practices
- Use virtual keys for all non-administrative access — never share your master key
- Start with conservative budgets and adjust based on actual usage
- Set rate limits to prevent runaway scripts
- Review the Per-User Breakdown weekly to spot anomalies
- Create separate keys for each service to track costs independently
- Rotate keys periodically by creating new keys and deactivating old ones