Files
bifrost/docs/openapi/paths/management/governance.yaml
Beyhan Oğur 880f412e2c first commit
2026-04-26 21:52:23 +03:00

1065 lines
30 KiB
YAML

# Virtual Keys CRUD
virtual-keys:
get:
operationId: listVirtualKeys
summary: List virtual keys
description: Returns a list of all virtual keys with their configurations.
tags:
- Governance
parameters:
- name: from_memory
in: query
description: If true, returns virtual keys from in-memory cache instead of database
schema:
type: boolean
default: false
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ListVirtualKeysResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
post:
operationId: createVirtualKey
summary: Create virtual key
description: Creates a new virtual key with the specified configuration.
tags:
- Governance
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/CreateVirtualKeyRequest'
responses:
'200':
description: Virtual key created successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/VirtualKeyResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
virtual-keys-quota:
get:
operationId: getVirtualKeyQuota
summary: Get virtual key quota
description: |
Returns the budget and rate limit quota for the authenticated virtual key.
This is a self-service endpoint — no admin authentication required.
The virtual key value itself (provided via header) is the credential.
tags:
- Governance
security:
- VirtualKeyAuth: []
- BearerAuth: []
- ApiKeyAuth: []
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/VirtualKeyQuotaResponse'
'401':
description: Missing or invalid virtual key
content:
application/json:
schema:
type: object
properties:
error:
type: string
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
virtual-keys-by-id:
get:
operationId: getVirtualKey
summary: Get virtual key
description: Returns a specific virtual key by ID.
tags:
- Governance
parameters:
- name: vk_id
in: path
required: true
description: Virtual key ID
schema:
type: string
- name: from_memory
in: query
description: If true, returns virtual key from in-memory cache instead of database
schema:
type: boolean
default: false
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
virtual_key:
$ref: '../../schemas/management/governance.yaml#/VirtualKey'
'404':
description: Virtual key not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
put:
operationId: updateVirtualKey
summary: Update virtual key
description: Updates an existing virtual key's configuration.
tags:
- Governance
parameters:
- name: vk_id
in: path
required: true
description: Virtual key ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/UpdateVirtualKeyRequest'
responses:
'200':
description: Virtual key updated successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/VirtualKeyResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'404':
description: Virtual key not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
delete:
operationId: deleteVirtualKey
summary: Delete virtual key
description: Deletes a virtual key.
tags:
- Governance
parameters:
- name: vk_id
in: path
required: true
description: Virtual key ID
schema:
type: string
responses:
'200':
description: Virtual key deleted successfully
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/MessageResponse'
'404':
description: Virtual key not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
# Teams CRUD
teams:
get:
operationId: listTeams
summary: List teams
description: Returns a list of all teams.
tags:
- Governance
parameters:
- name: customer_id
in: query
description: Filter teams by customer ID
schema:
type: string
- name: from_memory
in: query
description: If true, returns teams from in-memory cache instead of database
schema:
type: boolean
default: false
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ListTeamsResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
post:
operationId: createTeam
summary: Create team
description: Creates a new team.
tags:
- Governance
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/CreateTeamRequest'
responses:
'200':
description: Team created successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/TeamResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
teams-by-id:
get:
operationId: getTeam
summary: Get team
description: Returns a specific team by ID.
tags:
- Governance
parameters:
- name: team_id
in: path
required: true
description: Team ID
schema:
type: string
- name: from_memory
in: query
description: If true, returns team from in-memory cache instead of database
schema:
type: boolean
default: false
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
team:
$ref: '../../schemas/management/governance.yaml#/Team'
'404':
description: Team not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
put:
operationId: updateTeam
summary: Update team
description: Updates an existing team.
tags:
- Governance
parameters:
- name: team_id
in: path
required: true
description: Team ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/UpdateTeamRequest'
responses:
'200':
description: Team updated successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/TeamResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'404':
description: Team not found
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/ErrorResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
delete:
operationId: deleteTeam
summary: Delete team
description: Deletes a team.
tags:
- Governance
parameters:
- name: team_id
in: path
required: true
description: Team ID
schema:
type: string
responses:
'200':
description: Team deleted successfully
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/MessageResponse'
'404':
description: Team not found
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/ErrorResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
# Customers CRUD
customers:
get:
operationId: listCustomers
summary: List customers
description: Returns a list of all customers.
tags:
- Governance
parameters:
- name: from_memory
in: query
description: If true, returns customers from in-memory cache instead of database
schema:
type: boolean
default: false
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ListCustomersResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
post:
operationId: createCustomer
summary: Create customer
description: Creates a new customer.
tags:
- Governance
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/CreateCustomerRequest'
responses:
'200':
description: Customer created successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/CustomerResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
customers-by-id:
get:
operationId: getCustomer
summary: Get customer
description: Returns a specific customer by ID.
tags:
- Governance
parameters:
- name: customer_id
in: path
required: true
description: Customer ID
schema:
type: string
- name: from_memory
in: query
description: If true, returns customer from in-memory cache instead of database
schema:
type: boolean
default: false
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
customer:
$ref: '../../schemas/management/governance.yaml#/Customer'
'404':
description: Customer not found
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/ErrorResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
put:
operationId: updateCustomer
summary: Update customer
description: Updates an existing customer.
tags:
- Governance
parameters:
- name: customer_id
in: path
required: true
description: Customer ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/UpdateCustomerRequest'
responses:
'200':
description: Customer updated successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/CustomerResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'404':
description: Customer not found
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/ErrorResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
delete:
operationId: deleteCustomer
summary: Delete customer
description: Deletes a customer.
tags:
- Governance
parameters:
- name: customer_id
in: path
required: true
description: Customer ID
schema:
type: string
responses:
'200':
description: Customer deleted successfully
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/MessageResponse'
'404':
description: Customer not found
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/ErrorResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
# Budgets and Rate Limits GET operations
budgets:
get:
operationId: listBudgets
summary: List budgets
description: Returns a list of all budgets. Use the `from_memory` query parameter to get data from in-memory cache.
tags:
- Governance
parameters:
- name: from_memory
in: query
description: If true, returns budgets from in-memory cache instead of database
schema:
type: boolean
default: false
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ListBudgetsResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
rate-limits:
get:
operationId: listRateLimits
summary: List rate limits
description: Returns a list of all rate limits. Use the `from_memory` query parameter to get data from in-memory cache.
tags:
- Governance
parameters:
- name: from_memory
in: query
description: If true, returns rate limits from in-memory cache instead of database
schema:
type: boolean
default: false
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ListRateLimitsResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
# Routing Rules CRUD
routing-rules:
get:
operationId: listRoutingRules
summary: List routing rules
description: Returns a list of all routing rules configured for intelligent request routing across providers.
tags:
- Governance
parameters:
- name: scope
in: query
description: Filter routing rules by scope (global, team, customer, virtual_key)
schema:
type: string
- name: scope_id
in: query
description: Filter routing rules by scope ID
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ListRoutingRulesResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
post:
operationId: createRoutingRule
summary: Create routing rule
description: Creates a new CEL-based routing rule for intelligent request routing. Provider and model can be left empty to use the incoming request values.
tags:
- Governance
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/CreateRoutingRuleRequest'
responses:
'200':
description: Routing rule created successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/RoutingRuleResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
routing-rules-by-id:
get:
operationId: getRoutingRule
summary: Get routing rule
description: Returns a specific routing rule by ID.
tags:
- Governance
parameters:
- name: rule_id
in: path
required: true
description: Routing rule ID
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
rule:
$ref: '../../schemas/management/governance.yaml#/RoutingRule'
'404':
description: Routing rule not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
put:
operationId: updateRoutingRule
summary: Update routing rule
description: Updates an existing routing rule's configuration.
tags:
- Governance
parameters:
- name: rule_id
in: path
required: true
description: Routing rule ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/UpdateRoutingRuleRequest'
responses:
'200':
description: Routing rule updated successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/RoutingRuleResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'404':
description: Routing rule not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
delete:
operationId: deleteRoutingRule
summary: Delete routing rule
description: Deletes a routing rule.
tags:
- Governance
parameters:
- name: rule_id
in: path
required: true
description: Routing rule ID
schema:
type: string
responses:
'200':
description: Routing rule deleted successfully
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/MessageResponse'
'404':
description: Routing rule not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
# Model Configs CRUD
model-configs:
get:
operationId: listModelConfigs
summary: List model configs
description: Returns a list of all model configurations with their budget and rate limit settings.
tags:
- Governance
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ListModelConfigsResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
post:
operationId: createModelConfig
summary: Create model config
description: Creates a new model configuration with budget and rate limit settings.
tags:
- Governance
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/CreateModelConfigRequest'
responses:
'200':
description: Model config created successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ModelConfigResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
model-configs-by-id:
get:
operationId: getModelConfig
summary: Get model config
description: Returns a specific model configuration by ID.
tags:
- Governance
parameters:
- name: mc_id
in: path
required: true
description: Model config ID
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
model_config:
$ref: '../../schemas/management/governance.yaml#/ModelConfig'
'404':
description: Model config not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
put:
operationId: updateModelConfig
summary: Update model config
description: Updates an existing model configuration's budget and rate limit settings.
tags:
- Governance
parameters:
- name: mc_id
in: path
required: true
description: Model config ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/UpdateModelConfigRequest'
responses:
'200':
description: Model config updated successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ModelConfigResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'404':
description: Model config not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
delete:
operationId: deleteModelConfig
summary: Delete model config
description: Deletes a model configuration.
tags:
- Governance
parameters:
- name: mc_id
in: path
required: true
description: Model config ID
schema:
type: string
responses:
'200':
description: Model config deleted successfully
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/MessageResponse'
'404':
description: Model config not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
# Provider Governance
provider-governance:
get:
operationId: listProviderGovernance
summary: List provider governance
description: Returns a list of all providers with their governance settings (budget and rate limits).
tags:
- Governance
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ListProviderGovernanceResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
provider-governance-by-name:
put:
operationId: updateProviderGovernance
summary: Update provider governance
description: Updates governance settings (budget and rate limits) for a specific provider.
tags:
- Governance
parameters:
- name: provider_name
in: path
required: true
description: Provider name
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/UpdateProviderGovernanceRequest'
responses:
'200':
description: Provider governance updated successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ProviderGovernanceResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'404':
description: Provider not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
delete:
operationId: deleteProviderGovernance
summary: Delete provider governance
description: Removes governance settings (budget and rate limits) for a specific provider.
tags:
- Governance
parameters:
- name: provider_name
in: path
required: true
description: Provider name
schema:
type: string
responses:
'200':
description: Provider governance deleted successfully
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/MessageResponse'
'404':
description: Provider not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
# Pricing Overrides CRUD
pricing-overrides:
get:
operationId: listPricingOverrides
summary: List pricing overrides
description: Returns all pricing overrides, optionally filtered by scope.
tags:
- Governance
parameters:
- name: scope_kind
in: query
description: Filter by scope kind
schema:
type: string
enum:
- global
- provider
- provider_key
- virtual_key
- virtual_key_provider
- virtual_key_provider_key
- name: virtual_key_id
in: query
description: Filter by virtual key ID (for virtual_key* scopes)
schema:
type: string
- name: provider_id
in: query
description: Filter by provider ID
schema:
type: string
- name: provider_key_id
in: query
description: Filter by provider key ID
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/ListPricingOverridesResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
post:
operationId: createPricingOverride
summary: Create pricing override
description: Creates a new pricing override. The most specific matching scope always wins during cost resolution.
tags:
- Governance
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/CreatePricingOverrideRequest'
responses:
'201':
description: Pricing override created successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/PricingOverrideResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
pricing-overrides-by-id:
put:
operationId: updatePricingOverride
summary: Update pricing override
description: Updates an existing pricing override. Omitted fields are merged from the existing record. The `patch` field is always replaced in full when provided.
tags:
- Governance
parameters:
- name: id
in: path
required: true
description: Pricing override ID
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/UpdatePricingOverrideRequest'
responses:
'200':
description: Pricing override updated successfully
content:
application/json:
schema:
$ref: '../../schemas/management/governance.yaml#/PricingOverrideResponse'
'400':
$ref: '../../openapi.yaml#/components/responses/BadRequest'
'404':
description: Pricing override not found
content:
application/json:
schema:
$ref: '../../schemas/inference/common.yaml#/BifrostError'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'
delete:
operationId: deletePricingOverride
summary: Delete pricing override
description: Deletes a pricing override by ID.
tags:
- Governance
parameters:
- name: id
in: path
required: true
description: Pricing override ID
schema:
type: string
responses:
'200':
description: Pricing override deleted successfully
content:
application/json:
schema:
$ref: '../../schemas/management/common.yaml#/MessageResponse'
'500':
$ref: '../../openapi.yaml#/components/responses/InternalError'