Skip to main content

Overview

Virtual keys allow you to create API keys with:
  • Custom budgets and rate limits
  • Model access restrictions
  • Expiration dates
  • Team associations
  • Metadata and tags

Generate a Key

Create a virtual key using the master key:
Response:

Key Generation Parameters

Basic Parameters

Budget Parameters

Rate Limiting

Team Association

Complete Example

Get Key Information

Retrieve information about a key:
Response:

Update a Key

Modify key properties:
You can only update a key using the master key, not the key itself.

Delete a Key

Revoke a virtual key:

List All Keys

Get all virtual keys:

Key Auto-Rotation

Configure automatic key rotation:
The key will automatically rotate every 90 days. The key_alias remains constant while the underlying key changes.

Budget Tracking

Check Spend

Monitor key spending:
The response includes:
  • spend: Current spend
  • max_budget: Budget limit
  • budget_reset_at: When budget resets

Budget Alerts

Set soft budget for alerts:
Configure webhook for alerts in your config:
config.yaml

Model Access Control

Restrict to Specific Models

Requests to other models will be rejected:

Allow All Models

Omit the models parameter or use null:

Rate Limiting

Per-Key Rate Limits

When rate limit is exceeded:

Team Keys

Generate keys associated with teams:
1

Create a Team

2

Generate Team Key

Team keys inherit team budgets and settings. The key budget is separate from the team budget.

Key Metadata

Attach custom metadata to keys:
Use metadata for:
  • Cost allocation
  • Usage tracking
  • Access auditing
  • Organizational reporting

Security Best Practices

1. Master Key Protection

Never expose the master key in client applications. Use virtual keys instead.

2. Key Rotation

Rotate keys regularly:

3. Principle of Least Privilege

Grant minimum required access:

4. Monitor Usage

Regularly audit key usage:

Programmatic Key Management

Next Steps

Budget Alerts

Set up spending alerts and notifications

Configuration

Advanced proxy configuration

Quick Start

Get started with the proxy

Docker Deployment

Deploy in production