Skip to main content
The governance block lets you seed all governance resources directly in config.json. On startup, Bifrost loads these into the configuration store. This is the recommended approach for GitOps workflows where governance state is managed as code.
In default split mode, file-backed governance resources seed or update the DB by hash while unrelated DB-only resources are preserved. With source_of_truth: "config.json", only governance sub-sections that are explicitly present in the file are authoritative. Omit a sub-section to leave DB-managed rows alone; set it to an empty array only when you intend to remove stored rows for that sub-section. See Source of Truth & Reconciliation.
Governance enforcement is always active in OSS - you do not need a plugin entry to enable it. To require a virtual key on every inference request, set client.enforce_auth_on_inference: true. This is the global default, but a more specific inference-auth flag such as governance.auth_config.disable_auth_on_inference overrides it; if no specific override is set, client.enforce_auth_on_inference applies.

Admin Authentication

Protect the Bifrost dashboard and management API with username/password auth:

Virtual Keys

Virtual keys are issued to clients and act as scoped API tokens. Each key specifies which providers, models, and API keys the bearer is allowed to use.

Virtual Key Fields

Provider Config Fields


Budgets

Budgets cap cumulative spend (in USD) for an owning governance entity over a rolling window. The owner is declared on the budget:
Set at most one owner field on a budget. A team can own multiple budgets with different reset durations.

Rate Limits

Rate limits cap requests or tokens over a rolling window:
Attach a rate limit to a virtual key via virtual_keys[].rate_limit_id, or to a provider config via virtual_keys[].provider_configs[].rate_limit_id.

Model Limits

governance.model_configs applies budgets and rate limits keyed on a model name, an optional provider, and a scope. This is the same data the Budget & Limits → Model Limits UI manages.

Routing Rules

Routing rules dynamically select the provider and model for each request based on a CEL expression. They are evaluated in priority order before the request is dispatched.

Rule Fields

Target Fields

Fallback Fields

Each entry is either the string "provider/model" (use "provider/" to keep the incoming model), or an object when it needs to pin a key:
A fallback whose pinned key is missing from that provider’s pool is skipped, and the chain moves to the next entry.

Matching rules across restarts

On every startup each rule in config.json is matched to a stored rule, and only rules that changed are written:
  • With an id, the rule is matched by id. Changing the id creates a new rule. With the default source_of_truth (split), the rule under the old id stays in the database, still holding its priority.
  • Without an id, the rule is matched by name, scope and scope_id, so editing its targets, expression or priority updates it in place. The first time it is stored it gets a generated ID, which it keeps on later restarts. Renaming the rule, or moving it to another scope, creates a new rule just like changing an id does.
A rule without an id is matched to a rule created in the UI or API when the name, scope and scope ID match. It is skipped with a warning when its name is ambiguous: another rule in the file has the same name in the same scope, or more than one stored global rule has that name. Removing the id from a rule that already has one rewrites that rule once on the next startup, with no change to its content, and then matches it by name. If a rule’s priority is already held in its scope by a stored rule that config.json does not declare (usually the rule left behind by a changed id or name), the rule from the file is skipped and startup continues. The warning names the stored rule; delete it, or restore the old id or name, and restart to apply the file’s rule.

Customers & Teams

Define organizational entities and attach rate limits directly. Team budgets reference their owner through governance.budgets[].team_id:

Access profiles on teams, customers, and business units

Enterprise-only.
A team, customer, or business unit can hold one access profile instead of budgets and a rate limit of its own. Name it with access_profile on the entity’s entry; the profile itself is declared under the top-level access_profiles:

Projects

Declare projects that requests opt into for access and accounting. A project composes with what the caller already holds, spends against its own budgets, the calling principal’s, or both as accounting_mode directs, and can divide every budget and rate limit it holds equally between its members.
governance.projects is an enterprise capability. Members are added from the dashboard or the API: a project declared here starts with none, and membership cannot be declared in the file. The schema rejects a members key.
Requests reference a project by name with the x-bf-project-name header.

Project Fields

Budgets and rate limits inside a project are declared without ids.

Project Provider Config Fields

How projects are reconciled

  • Matched by name. A name not in the database creates the project; a name already stored updates it when the declaration’s hash differs from the one recorded at the last sync, and leaves it alone otherwise, so dashboard edits survive until the file changes.
  • Edits keep spend. Budgets are paired with their stored rows by reset_duration (in declared order when a duration appears twice), provider configs by provider_name, model budgets by model_name, and MCP configs by client. A paired row is updated in place, so raising a cap does not forgive what was already spent against it. A budget, provider, or client the file stops declaring is removed.
  • Equal splits redivide in the background. Changing a cap or the split policy of a project with split_policy: equal queues a recalculation of every member’s share, which runs shortly after startup.
  • Members are never touched. The file cannot add or remove members; the schema rejects a members key on a project.
  • Rate limits must divide by the stored roster. On a project with split_policy: equal, a declared token or request cap smaller than the number of members it already has is refused, at whichever tier is too small, rather than stored and left to fail mid-redivision. Raise the cap or shrink the roster.
  • With source_of_truth: "config.json" and governance.projects present, declarations always overwrite the database and projects the file does not declare are deleted, members included.

Full Governance Example