Skip to main content

Overview

Virtual Keys are the primary governance entity in Bifrost. Users and applications authenticate using the given headers to access virtual keys and get specific access permissions, budgets, and rate limits. Allowed Headers:
  • x-bf-vk - Virtual key header, eg. sk-bf-*
  • Authorization - Authorization header, eg. Bearer sk-bf-* (OpenAI style)
  • x-api-key - API key header, eg. sk-bf-* (Anthropic style)
  • x-goog-api-key - API key header, eg. sk-bf-* (Google Gemini style)
  • api-key - API key header, eg. sk-bf-* (Azure OpenAI style)
Old virtual keys(without sk-bf-* prefix) are only supported by x-bf-vk header.
Key Features:
  • Access Control - Model and provider filtering
  • Cost Management - Independent budgets (checked along with team/customer budgets if attached)
  • Rate Limiting - Token and request-based throttling (VK-level only)
  • Key Restrictions - Limit VK to specific provider API keys (if configured, VK can only use those keys)
  • Exclusive Attachment - Belongs to either one team OR one customer OR neither (mutually exclusive)
  • Active/Inactive Status - Enable/disable access instantly

Configuration

  1. Go to Virtual Keys
  2. Click on Add Virtual Key button Virtual Key Creation
Budget Settings:
  • Max Limit: Dollar amount (e.g., 10.50)
  • Reset Duration: 1m, 1h, 1d, 1w, 1M, 1Y
  • Calendar aligned (optional): When enabled, the budget resets at calendar boundaries in UTC (day/week/month/year) instead of on a rolling window. Only applies to day/week/month/year periods. See Budget and Limits.
Rate Limits:
  • Token Limit: Max tokens per period
  • Request Limit: Max requests per period
  • Reset Duration: Reset frequency for each limit
Associations:
  • Team: Assign to existing team (mutually exclusive with customer)
  • Customer: Assign to existing customer (mutually exclusive with team)
Expiry (optional): Pick Never, a preset (30 min to 7 days), or a custom date and time. See Key Expiry.
  1. Click Create Virtual Key

User Groups

Teams

Teams provide organizational grouping for virtual keys with department-level budget management. Teams can belong to one customer and have their own independent budget allocation. Key Features:
  • Organizational Structure - Group multiple virtual keys
  • Independent Budgets - Department-level cost control (separate from customer budgets)
  • Customer Association - Can belong to one customer (optional)
  • No Rate Limits - Teams cannot have rate limits (VK-level only)
Configuration
  1. Go to Users & GroupsTeams
  2. Click on Add Team button Team Creation
Fill the form and click on Create Team button
  1. Assign Virtual Keys to Team
    • Go to Virtual Keys page
    • Edit the virtual key and assign it to the team
    • Click on Save button

Customers

Customers represent the highest level in the governance hierarchy, typically corresponding to organizations or major business units. They provide top-level budget control and organizational structure. Key Features:
  • Top-Level Organization - Highest hierarchy level
  • Independent Budgets - Organization-wide cost control (separate from team/VK budgets)
  • Team Management - Contains multiple teams and direct VKs
  • No Rate Limits - Customers cannot have rate limits (VK-level only)
Configuration
  1. Go to Users & GroupsCustomers
  2. Click on Add Customer button Customer Creation
Fill the form and click on Create Customer button
  1. Assign Teams to Customer
    • Go to Teams page
    • Edit the team and assign it to the customer
    • Click on Save button
  2. Assign Virtual Keys to Customer
    • Go to Virtual Keys page
    • Edit the virtual key and assign it to the customer
    • Click on Save button

Features

  • Budget and Limits - Enterprise-grade budget management and cost control and rate limiting using virtual keys
  • Routing - Route requests to the appropriate providers/models and restrict api keys using virtual keys
  • MCP Tool Filtering - Manage MCP clients/tools for virtual keys

Usage

Making Virtual Keys Mandatory

All governance-enabled requests must include the virtual key header:
By default governance is optional, meaning that if the virtual key header is not present, the request will be allowed but without any governance checks/routing. But you can make it mandatory by enforcing the virtual key header.
  1. Go to ConfigSecurity
  2. Check the Enforce Virtual Keys checkbox Enforce Virtual Keys
When the governance header is enforced, the request will be rejected if the x-bf-vk header is not present.

Key Expiry

Virtual keys can optionally carry an expiry timestamp. Once the expiry passes, requests using the key are rejected with a 403 and the reason Virtual key has expired — the key is not deleted or deactivated, so it stays visible for auditing and can be restored at any time.
  • No expiry by default — keys without expires_at never expire.
  • Fail closed — both LLM inference and MCP tool execution are blocked once the key expires.
  • Inactive wins — a key that is both inactive and expired is rejected as inactive.
  • Restore anytime — extend the expiry to a future timestamp or clear it; access resumes immediately.
  1. Go to Virtual Keys and create or edit a key
  2. In the Expiry section, pick Never, a preset (30 min, 1 hour, 24 hours, 7 days), or choose a custom date and time from the calendar Virtual Key Expiry Picker
Expired keys show an Expired badge in the virtual keys table.

Authentication and Virtual Keys

Virtual keys and HTTP authentication are independent layers that can work together: When disable_auth_on_inference: true (auth disabled): Virtual keys can be passed via any supported header without additional authentication:

Listing models with a virtual key

When you call GET /v1/models with a virtual key, Bifrost only lists (and only queries) providers that are allowed by that virtual key. This avoids unnecessary “provider not allowed” errors in logs and keeps error-rate metrics meaningful.
If you specify a provider explicitly via ?provider=..., that provider must still be allowed by the virtual key or the request will be rejected:
When disable_auth_on_inference: false (auth enabled): You must provide both authentication credentials AND the virtual key. Use x-bf-vk for the virtual key since the Authorization header is used for authentication:
Configuring disable_auth_on_inference:
  1. Go to ConfigSecurity
  2. Toggle Disable Auth on Inference to enable/disable Disable Auth on Inference

Error Responses

  • Virtual Key Not Found (400)
  • Virtual Key Blocked (403)
  • Rate Limit Exceeded (429)
  • Token Limit Exceeded (429)
  • Request Limit Exceeded (429)
  • Budget Exceeded (402)
  • Model Not Allowed (403)
  • Provider Not Allowed (403)

Footnotes

  1. Authorization can carry virtual keys only when auth is disabled (disable_auth_on_inference: true). When auth is enabled, Authorization is consumed by authentication and cannot be used for virtual keys.