diff --git a/core/providers/bedrock/bedrock.go b/core/providers/bedrock/bedrock.go index eb5da01fde..0dc798bc0f 100644 --- a/core/providers/bedrock/bedrock.go +++ b/core/providers/bedrock/bedrock.go @@ -962,10 +962,6 @@ func (provider *BedrockProvider) TextCompletionStream(ctx *schemas.BifrostContex Message: schemas.ErrProviderNetworkError, Error: err, }, - ExtraFields: schemas.BifrostErrorExtraFields{ - RequestType: schemas.TextCompletionStreamRequest, - Provider: providerName, - }, }, responseChan, provider.logger) } else { providerUtils.ProcessAndSendError(ctx, postHookRunner, err, responseChan, provider.logger) @@ -1139,7 +1135,6 @@ func (provider *BedrockProvider) ChatCompletionStream(ctx *schemas.BifrostContex responseChan := make(chan *schemas.BifrostStreamChunk, schemas.DefaultStreamBufferSize) providerUtils.SetStreamIdleTimeoutIfEmpty(ctx, provider.networkConfig.StreamIdleTimeoutInSeconds) - providerName := provider.GetProviderKey() // Start streaming in a goroutine go func() { defer func() { @@ -1202,7 +1197,7 @@ func (provider *BedrockProvider) ChatCompletionStream(ctx *schemas.BifrostContex break } ctx.SetValue(schemas.BifrostContextKeyStreamEndIndicator, true) - provider.logger.Warn("Error decoding %s EventStream message: %v", providerName, err) + provider.logger.Warn("Error decoding EventStream message: %v", err) // Transport-level errors (stale/closed connection, unexpected EOF) are retryable. // Use IsBifrostError:false so the retry gate in executeRequestWithRetries can retry. if isStreamTransportError(err) { @@ -1230,7 +1225,7 @@ func (provider *BedrockProvider) ChatCompletionStream(ctx *schemas.BifrostContex } } errMsg := string(message.Payload) - err := fmt.Errorf("%s stream %s: %s", providerName, excType, errMsg) + err := fmt.Errorf("stream %s: %s", excType, errMsg) // Retryable AWS exceptions must not set IsBifrostError:true — that would // bypass the retry gate in executeRequestWithRetries. Instead emit // IsBifrostError:false with the equivalent HTTP status code so the existing @@ -1533,7 +1528,6 @@ func (provider *BedrockProvider) ResponsesStream(ctx *schemas.BifrostContext, po lastChunkTime := startTime decoder := eventstream.NewDecoder() payloadBuf := make([]byte, 0, 1024*1024) // 1MB payload buffer - providerName := provider.GetProviderKey() for { // If context was cancelled/timed out, let defer handle it if ctx.Err() != nil { @@ -1575,7 +1569,7 @@ func (provider *BedrockProvider) ResponsesStream(ctx *schemas.BifrostContext, po break } ctx.SetValue(schemas.BifrostContextKeyStreamEndIndicator, true) - provider.logger.Warn("Error decoding %s EventStream message: %v", providerName, err) + provider.logger.Warn("Error decoding EventStream message: %v", err) // Transport-level errors (stale/closed connection, unexpected EOF) are retryable. // Use IsBifrostError:false so the retry gate in executeRequestWithRetries can retry. if isStreamTransportError(err) { @@ -1603,7 +1597,7 @@ func (provider *BedrockProvider) ResponsesStream(ctx *schemas.BifrostContext, po } } errMsg := string(message.Payload) - err := fmt.Errorf("%s stream %s: %s", providerName, excType, errMsg) + err := fmt.Errorf("stream %s: %s", excType, errMsg) // Retryable AWS exceptions must not set IsBifrostError:true — that would // bypass the retry gate in executeRequestWithRetries. Instead emit // IsBifrostError:false with the equivalent HTTP status code so the existing diff --git a/core/providers/openai/openai.go b/core/providers/openai/openai.go index 9cb2b3db29..197334a22c 100644 --- a/core/providers/openai/openai.go +++ b/core/providers/openai/openai.go @@ -1772,6 +1772,7 @@ func HandleOpenAIResponsesStreaming( providerUtils.ProcessAndSendBifrostError(ctx, postHookRunner, providerUtils.EnrichError(ctx, bifrostErr, jsonBody, nil, sendBackRawRequest, sendBackRawResponse), responseChan, logger) return } + response.ExtraFields.ChunkIndex = response.SequenceNumber if response.Type == schemas.ResponsesStreamResponseTypeCompleted || response.Type == schemas.ResponsesStreamResponseTypeIncomplete { // Set raw request if enabled diff --git a/docs/mcp/connecting-to-servers.mdx b/docs/mcp/connecting-to-servers.mdx index d3fc4274cb..119b46f32f 100644 --- a/docs/mcp/connecting-to-servers.mdx +++ b/docs/mcp/connecting-to-servers.mdx @@ -450,6 +450,191 @@ Environment variables are: --- +## Forwarding Request Headers to MCP Servers + + +Header Forwarding is available in **v1.5.0-prerelease1 and above**. + + +By default, Bifrost does not forward incoming request headers to MCP servers during tool execution. The `allowed_extra_headers` field lets you define a per-client allowlist of headers that callers may inject at request time and have forwarded to that MCP server when tools are executed. + +This is separate from the static `headers` field used for authentication: + +| Field | Purpose | When sent | +|-------|---------|-----------| +| `headers` | Static auth credentials (API keys, tokens) | Always, on every tool call | +| `allowed_extra_headers` | Dynamic per-request headers from callers | Only when the caller provides them, and only if they match the allowlist | + +**Common use cases:** +- Forwarding a user's auth token to an MCP server that enforces per-user authorization +- Passing a tenant or org ID to a multi-tenant MCP server +- Propagating trace or correlation IDs for end-to-end observability + +### How It Works + +1. An incoming request carries one or more headers matching a client's `allowed_extra_headers` pattern +2. Bifrost captures those headers from the request (using the union of all clients' allowlists) +3. At tool execution time, each client **re-checks** the header against its own allowlist — so the same header can be forwarded to one MCP server but not another + + +Headers are matched case-insensitively. The only wildcard supported is a standalone `"*"` (allow all headers) — partial patterns like `x-tenant-*` are not supported. If `"*"` is used, it must be the only entry in the list. + + + + + +**Configure:** Navigate to **MCP Gateway**, open the configuration sheet for an HTTP or SSE client, and set the **Allowed Extra Headers** field: + + + Allowed Extra Headers configuration in the MCP client edit sheet + + +**Send headers:** Include the allowed headers in any inference request to the LLM gateway: + +```bash +curl -X POST http://localhost:8080/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "x-user-token: eyJhbGci..." \ + -H "x-tenant-id: acme-corp" \ + -d '{ + "model": "openai/gpt-4o", + "messages": [{"role": "user", "content": "Look up my account details"}] + }' +``` + + + + +**Configure:** Include `allowed_extra_headers` when creating or updating a client: + +```bash +curl -X POST http://localhost:8080/api/mcp/client \ + -H "Content-Type: application/json" \ + -d '{ + "name": "my_api", + "connection_type": "http", + "connection_string": "https://mcp.example.com/mcp", + "auth_type": "headers", + "headers": { + "Authorization": "Bearer service-token" + }, + "allowed_extra_headers": ["x-user-token", "x-tenant-id", "x-request-id"], + "tools_to_execute": ["*"] + }' +``` + +**Send headers:** Include the allowed headers in any inference request: + +```bash +curl -X POST http://localhost:8080/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "x-user-token: eyJhbGci..." \ + -H "x-tenant-id: acme-corp" \ + -d '{ + "model": "openai/gpt-4o", + "messages": [{"role": "user", "content": "Look up my account details"}] + }' +``` + + + + +**Configure:** + +```json +{ + "mcp": { + "client_configs": [ + { + "name": "my_api", + "connection_type": "http", + "connection_string": "https://mcp.example.com/mcp", + "auth_type": "headers", + "headers": { + "Authorization": "Bearer service-token" + }, + "allowed_extra_headers": ["x-user-token", "x-tenant-id", "x-request-id"], + "tools_to_execute": ["*"] + } + ] + } +} +``` + +**Send headers:** Include the allowed headers in any inference request: + +```bash +curl -X POST http://localhost:8080/v1/chat/completions \ + -H "Content-Type: application/json" \ + -H "x-user-token: eyJhbGci..." \ + -H "x-tenant-id: acme-corp" \ + -d '{ + "model": "openai/gpt-4o", + "messages": [{"role": "user", "content": "Look up my account details"}] + }' +``` + + + + +**Configure** the client as above (Web UI, Management API, or config.json). + +**Send headers:** When an external MCP client (e.g., Claude Desktop, Cursor) connects to Bifrost's `/mcp` endpoint, include the allowed headers in that HTTP request. Bifrost forwards them during any tool call made within that session: + +```json +{ + "mcpServers": { + "bifrost": { + "url": "http://localhost:8080/mcp", + "headers": { + "x-user-token": "eyJhbGci...", + "x-tenant-id": "acme-corp" + } + } + } +} +``` + + +Header support in MCP client config varies by client. The above JSON format applies to clients that support custom headers (e.g., Claude Desktop, Cursor). Check your MCP client's documentation for the exact configuration syntax. + + + + + +**Configure:** + +```go +schemas.MCPClientConfig{ + Name: "my_api", + ConnectionType: schemas.MCPConnectionTypeHTTP, + ConnectionString: bifrost.Ptr("https://mcp.example.com/mcp"), + AuthType: schemas.MCPAuthTypeHeaders, + Headers: map[string]schemas.EnvVar{ + "Authorization": {Value: "Bearer service-token"}, + }, + AllowedExtraHeaders: schemas.WhiteList{"x-user-token", "x-tenant-id", "x-request-id"}, + ToolsToExecute: []string{"*"}, +} +``` + +**Send headers:** Set `BifrostContextKeyMCPExtraHeaders` on the context before calling `ChatCompletionRequest` or `ExecuteChatMCPTool`: + +```go +bifrostCtx := schemas.NewBifrostContext(context.Background(), schemas.NoDeadline) +bifrostCtx.SetValue(schemas.BifrostContextKeyMCPExtraHeaders, map[string][]string{ + "x-user-token": {"eyJhbGci..."}, + "x-tenant-id": {"acme-corp"}, +}) + +response, err := client.ChatCompletionRequest(bifrostCtx, request) +``` + + + + +--- + ## Client State Management ### Connection States diff --git a/docs/media/ui-mcp-allowed-extra-headers.png b/docs/media/ui-mcp-allowed-extra-headers.png new file mode 100644 index 0000000000..a1c162ee3a Binary files /dev/null and b/docs/media/ui-mcp-allowed-extra-headers.png differ diff --git a/docs/openapi/openapi.json b/docs/openapi/openapi.json index 4374fb7c54..1043039a1f 100644 --- a/docs/openapi/openapi.json +++ b/docs/openapi/openapi.json @@ -134736,7 +134736,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -134921,7 +134922,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135005,7 +135007,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135089,7 +135092,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135212,7 +135216,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135296,7 +135301,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135380,7 +135386,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135498,7 +135505,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135582,7 +135590,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135666,7 +135675,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135808,7 +135818,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135892,7 +135903,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -135976,7 +135988,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -136115,7 +136128,93 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + }, + "404": { + "description": "User not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" ] }, "model_requested": { @@ -136199,7 +136298,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -136342,7 +136442,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -136426,7 +136527,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -136510,7 +136612,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -136612,6 +136715,14 @@ }, "limit": { "type": "integer" + }, + "total_pages": { + "type": "integer", + "description": "Total number of pages" + }, + "has_more": { + "type": "boolean", + "description": "Whether more pages are available" } } } @@ -136686,7 +136797,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -136817,7 +136929,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -136901,7 +137014,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -136985,7 +137099,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -137124,7 +137239,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -137208,7 +137324,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -137250,13 +137367,10 @@ "application/json": { "schema": { "type": "object", - "required": [ - "name" - ], "properties": { - "name": { + "description": { "type": "string", - "description": "Team name (must be unique)" + "description": "Updated team description" } } } @@ -137350,7 +137464,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -137434,7 +137549,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -137518,7 +137634,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -137639,7 +137756,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -137723,7 +137841,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -137863,7 +137982,93 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + }, + "404": { + "description": "Team not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" ] }, "model_requested": { @@ -137947,7 +138152,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -138087,7 +138293,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -138171,7 +138378,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -138255,7 +138463,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -138387,7 +138596,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -138471,7 +138681,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -142407,6 +142618,17 @@ "type": "number", "description": "Weight for load balancing" }, + "aliases": { + "type": "object", + "propertyNames": { + "minLength": 1 + }, + "additionalProperties": { + "type": "string", + "minLength": 1 + }, + "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" + }, "azure_key_config": { "type": "object", "description": "Azure-specific key configuration", @@ -142426,12 +142648,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "api_version": { "type": "object", "description": "Environment variable configuration", @@ -142564,12 +142780,6 @@ "type": "boolean" } } - }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } } } }, @@ -142652,12 +142862,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "batch_s3_config": { "type": "object", "properties": { @@ -142682,18 +142886,6 @@ } } }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, "vllm_key_config": { "type": "object", "description": "VLLM-specific key configuration", @@ -142769,6 +142961,16 @@ "url" ] }, + "replicate_key_config": { + "type": "object", + "description": "Replicate-specific key configuration", + "properties": { + "use_deployments_endpoint": { + "type": "boolean", + "description": "Whether to use the deployments endpoint instead of the models endpoint" + } + } + }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" @@ -143124,6 +143326,17 @@ "type": "number", "description": "Weight for load balancing" }, + "aliases": { + "type": "object", + "propertyNames": { + "minLength": 1 + }, + "additionalProperties": { + "type": "string", + "minLength": 1 + }, + "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" + }, "azure_key_config": { "type": "object", "description": "Azure-specific key configuration", @@ -143143,12 +143356,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "api_version": { "type": "object", "description": "Environment variable configuration", @@ -143281,12 +143488,6 @@ "type": "boolean" } } - }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } } } }, @@ -143369,12 +143570,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "batch_s3_config": { "type": "object", "properties": { @@ -143399,18 +143594,6 @@ } } }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, "vllm_key_config": { "type": "object", "description": "VLLM-specific key configuration", @@ -143486,6 +143669,16 @@ "url" ] }, + "replicate_key_config": { + "type": "object", + "description": "Replicate-specific key configuration", + "properties": { + "use_deployments_endpoint": { + "type": "boolean", + "description": "Whether to use the deployments endpoint instead of the models endpoint" + } + } + }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" @@ -143561,6 +143754,17 @@ "type": "number", "description": "Weight for load balancing" }, + "aliases": { + "type": "object", + "propertyNames": { + "minLength": 1 + }, + "additionalProperties": { + "type": "string", + "minLength": 1 + }, + "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" + }, "azure_key_config": { "type": "object", "description": "Azure-specific key configuration", @@ -143580,12 +143784,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "api_version": { "type": "object", "description": "Environment variable configuration", @@ -143718,12 +143916,6 @@ "type": "boolean" } } - }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } } } }, @@ -143806,12 +143998,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "batch_s3_config": { "type": "object", "properties": { @@ -143836,18 +144022,6 @@ } } }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, "vllm_key_config": { "type": "object", "description": "VLLM-specific key configuration", @@ -143923,6 +144097,16 @@ "url" ] }, + "replicate_key_config": { + "type": "object", + "description": "Replicate-specific key configuration", + "properties": { + "use_deployments_endpoint": { + "type": "boolean", + "description": "Whether to use the deployments endpoint instead of the models endpoint" + } + } + }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" @@ -144369,6 +144553,17 @@ "type": "number", "description": "Weight for load balancing" }, + "aliases": { + "type": "object", + "propertyNames": { + "minLength": 1 + }, + "additionalProperties": { + "type": "string", + "minLength": 1 + }, + "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" + }, "azure_key_config": { "type": "object", "description": "Azure-specific key configuration", @@ -144388,12 +144583,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "api_version": { "type": "object", "description": "Environment variable configuration", @@ -144526,12 +144715,6 @@ "type": "boolean" } } - }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } } } }, @@ -144614,12 +144797,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "batch_s3_config": { "type": "object", "properties": { @@ -144644,18 +144821,6 @@ } } }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, "vllm_key_config": { "type": "object", "description": "VLLM-specific key configuration", @@ -144731,6 +144896,16 @@ "url" ] }, + "replicate_key_config": { + "type": "object", + "description": "Replicate-specific key configuration", + "properties": { + "use_deployments_endpoint": { + "type": "boolean", + "description": "Whether to use the deployments endpoint instead of the models endpoint" + } + } + }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" @@ -145089,6 +145264,17 @@ "type": "number", "description": "Weight for load balancing" }, + "aliases": { + "type": "object", + "propertyNames": { + "minLength": 1 + }, + "additionalProperties": { + "type": "string", + "minLength": 1 + }, + "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" + }, "azure_key_config": { "type": "object", "description": "Azure-specific key configuration", @@ -145108,12 +145294,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "api_version": { "type": "object", "description": "Environment variable configuration", @@ -145246,12 +145426,6 @@ "type": "boolean" } } - }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } } } }, @@ -145334,12 +145508,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "batch_s3_config": { "type": "object", "properties": { @@ -145364,18 +145532,6 @@ } } }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, "vllm_key_config": { "type": "object", "description": "VLLM-specific key configuration", @@ -145451,6 +145607,16 @@ "url" ] }, + "replicate_key_config": { + "type": "object", + "description": "Replicate-specific key configuration", + "properties": { + "use_deployments_endpoint": { + "type": "boolean", + "description": "Whether to use the deployments endpoint instead of the models endpoint" + } + } + }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" @@ -145526,6 +145692,17 @@ "type": "number", "description": "Weight for load balancing" }, + "aliases": { + "type": "object", + "propertyNames": { + "minLength": 1 + }, + "additionalProperties": { + "type": "string", + "minLength": 1 + }, + "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" + }, "azure_key_config": { "type": "object", "description": "Azure-specific key configuration", @@ -145545,12 +145722,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "api_version": { "type": "object", "description": "Environment variable configuration", @@ -145683,12 +145854,6 @@ "type": "boolean" } } - }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } } } }, @@ -145771,12 +145936,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "batch_s3_config": { "type": "object", "properties": { @@ -145801,18 +145960,6 @@ } } }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, "vllm_key_config": { "type": "object", "description": "VLLM-specific key configuration", @@ -145888,6 +146035,16 @@ "url" ] }, + "replicate_key_config": { + "type": "object", + "description": "Replicate-specific key configuration", + "properties": { + "use_deployments_endpoint": { + "type": "boolean", + "description": "Whether to use the deployments endpoint instead of the models endpoint" + } + } + }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" @@ -146247,6 +146404,17 @@ "type": "number", "description": "Weight for load balancing" }, + "aliases": { + "type": "object", + "propertyNames": { + "minLength": 1 + }, + "additionalProperties": { + "type": "string", + "minLength": 1 + }, + "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" + }, "azure_key_config": { "type": "object", "description": "Azure-specific key configuration", @@ -146266,12 +146434,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "api_version": { "type": "object", "description": "Environment variable configuration", @@ -146404,12 +146566,6 @@ "type": "boolean" } } - }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } } } }, @@ -146492,12 +146648,6 @@ } } }, - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - }, "batch_s3_config": { "type": "object", "properties": { @@ -146522,18 +146672,6 @@ } } }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "deployments": { - "type": "object", - "additionalProperties": { - "type": "string" - } - } - } - }, "vllm_key_config": { "type": "object", "description": "VLLM-specific key configuration", @@ -146609,6 +146747,16 @@ "url" ] }, + "replicate_key_config": { + "type": "object", + "description": "Replicate-specific key configuration", + "properties": { + "use_deployments_endpoint": { + "type": "boolean", + "description": "Whether to use the deployments endpoint instead of the models endpoint" + } + } + }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" @@ -146892,51 +147040,84 @@ } } }, - "/api/providers/{provider}/keys": { + "/api/keys": { "get": { - "operationId": "listProviderKeys", - "summary": "List keys for a provider", - "description": "Returns all keys configured for a specific provider.", + "operationId": "listKeys", + "summary": "List all keys", + "description": "Returns a list of all configured API keys across all providers.", "tags": [ "Providers" ], - "parameters": [ - { - "name": "provider", - "in": "path", - "required": true, - "description": "Provider name", - "schema": { - "type": "string" - } - } - ], "responses": { "200": { "description": "Successful response", "content": { "application/json": { "schema": { - "type": "object", - "description": "Response for listing keys for a provider", - "properties": { - "keys": { - "type": "array", - "items": { + "type": "array", + "items": { + "type": "object", + "description": "API key configuration", + "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the key" + }, + "name": { + "type": "string", + "description": "Name of the key" + }, + "value": { "type": "object", - "description": "API key configuration", + "description": "API key value (redacted in responses)", "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the key" + "value": { + "type": "string" }, - "name": { - "type": "string", - "description": "Name of the key" + "env_var": { + "type": "string" }, - "value": { + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of models this key can access (whitelist)" + }, + "blacklisted_models": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of models this key cannot access (blacklist)" + }, + "weight": { + "type": "number", + "description": "Weight for load balancing" + }, + "aliases": { + "type": "object", + "propertyNames": { + "minLength": 1 + }, + "additionalProperties": { + "type": "string", + "minLength": 1 + }, + "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" + }, + "azure_key_config": { + "type": "object", + "description": "Azure-specific key configuration", + "properties": { + "endpoint": { "type": "object", - "description": "API key value (redacted in responses)", + "description": "Environment variable configuration", "properties": { "value": { "type": "string" @@ -146949,410 +147130,357 @@ } } }, - "models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key can access (whitelist)" - }, - "blacklisted_models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key cannot access (blacklist)" - }, - "weight": { - "type": "number", - "description": "Weight for load balancing" - }, - "aliases": { - "type": "object", - "propertyNames": { - "minLength": 1 - }, - "additionalProperties": { - "type": "string", - "minLength": 1 - }, - "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" - }, - "azure_key_config": { + "api_version": { "type": "object", - "description": "Azure-specific key configuration", + "description": "Environment variable configuration", "properties": { - "endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "value": { + "type": "string" }, - "client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "env_var": { + "type": "string" }, - "client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "from_env": { + "type": "boolean" + } + } + }, + "client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "env_var": { + "type": "string" }, - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of scopes to use for authentication" + "from_env": { + "type": "boolean" } } }, - "vertex_key_config": { + "client_secret": { "type": "object", - "description": "Vertex-specific key configuration", + "description": "Environment variable configuration", "properties": { - "project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "value": { + "type": "string" }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "env_var": { + "type": "string" }, - "auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "from_env": { + "type": "boolean" } } }, - "bedrock_key_config": { + "tenant_id": { "type": "object", - "description": "AWS Bedrock-specific key configuration", + "description": "Environment variable configuration", "properties": { - "access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "value": { + "type": "string" }, - "session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "env_var": { + "type": "string" }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "from_env": { + "type": "boolean" + } + } + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of scopes to use for authentication" + } + } + }, + "vertex_key_config": { + "type": "object", + "description": "Vertex-specific key configuration", + "properties": { + "project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "env_var": { + "type": "string" }, - "batch_s3_config": { - "type": "object", - "properties": { - "buckets": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "is_default": { - "type": "boolean" - } - } - } - } - } + "from_env": { + "type": "boolean" } } }, - "vllm_key_config": { + "project_number": { "type": "object", - "description": "VLLM-specific key configuration", + "description": "Environment variable configuration", "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "value": { + "type": "string" }, - "model_name": { + "env_var": { "type": "string" + }, + "from_env": { + "type": "boolean" } - }, - "required": [ - "url" - ] + } }, - "ollama_key_config": { + "region": { "type": "object", - "description": "Ollama-specific key configuration", + "description": "Environment variable configuration", "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" } - }, - "required": [ - "url" - ] + } }, - "sgl_key_config": { + "auth_credentials": { "type": "object", - "description": "SGLang-specific key configuration", + "description": "Environment variable configuration", "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" } - }, - "required": [ - "url" - ] + } + } + } + }, + "bedrock_key_config": { + "type": "object", + "description": "AWS Bedrock-specific key configuration", + "properties": { + "access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } }, - "replicate_key_config": { + "secret_key": { "type": "object", - "description": "Replicate-specific key configuration", + "description": "Environment variable configuration", "properties": { - "use_deployments_endpoint": { - "type": "boolean", - "description": "Whether to use the deployments endpoint instead of the models endpoint" + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" } } }, - "enabled": { - "type": "boolean", - "description": "Whether the key is active (defaults to true)" + "session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } }, - "use_for_batch_api": { - "type": "boolean", - "description": "Whether this key can be used for batch API operations" + "region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } }, - "config_hash": { - "type": "string", - "description": "Hash of config.json version, used for change detection" + "arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } }, - "status": { - "type": "string", - "description": "Status of key (e.g., success, list_models_failed)" + "batch_s3_config": { + "type": "object", + "properties": { + "buckets": { + "type": "array", + "items": { + "type": "object", + "properties": { + "bucket_name": { + "type": "string" + }, + "prefix": { + "type": "string" + }, + "is_default": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "vllm_key_config": { + "type": "object", + "description": "VLLM-specific key configuration", + "properties": { + "url": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } }, - "description": { - "type": "string", - "description": "Error or status description for the key" + "model_name": { + "type": "string" + } + }, + "required": [ + "url" + ] + }, + "ollama_key_config": { + "type": "object", + "description": "Ollama-specific key configuration", + "properties": { + "url": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + } + }, + "required": [ + "url" + ] + }, + "sgl_key_config": { + "type": "object", + "description": "SGLang-specific key configuration", + "properties": { + "url": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + } + }, + "required": [ + "url" + ] + }, + "replicate_key_config": { + "type": "object", + "description": "Replicate-specific key configuration", + "properties": { + "use_deployments_endpoint": { + "type": "boolean", + "description": "Whether to use the deployments endpoint instead of the models endpoint" } } + }, + "enabled": { + "type": "boolean", + "description": "Whether the key is active (defaults to true)" + }, + "use_for_batch_api": { + "type": "boolean", + "description": "Whether this key can be used for batch API operations" + }, + "config_hash": { + "type": "string", + "description": "Hash of config.json version, used for change detection" + }, + "status": { + "type": "string", + "description": "Status of key (e.g., success, list_models_failed)" + }, + "description": { + "type": "string", + "description": "Error or status description for the key" } - }, - "total": { - "type": "integer" } } } } } }, - "400": { - "description": "Bad request", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { @@ -147419,7 +147547,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -147434,85 +147563,99 @@ } } } + } + } + } + }, + "/api/models": { + "get": { + "operationId": "listModelsManagement", + "summary": "List models", + "description": "Lists available models with optional filtering by query, provider, or keys.\n", + "tags": [ + "Providers" + ], + "parameters": [ + { + "name": "query", + "in": "query", + "description": "Filter models by name (case-insensitive partial match)", + "schema": { + "type": "string" + } }, - "404": { - "description": "Provider not found", + { + "name": "provider", + "in": "query", + "description": "Filter by specific provider name", + "schema": { + "type": "string" + } + }, + { + "name": "keys", + "in": "query", + "description": "Comma-separated list of key IDs to filter models accessible by those keys", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "limit", + "in": "query", + "description": "Maximum number of results to return (default 5)", + "schema": { + "type": "integer", + "default": 5 + } + }, + { + "name": "unfiltered", + "in": "query", + "description": "If true, return all models including those filtered out by provider-level restrictions", + "schema": { + "type": "boolean", + "default": false + } + } + ], + "responses": { + "200": { + "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", - "description": "Error response from Bifrost", + "description": "List models response", "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" + "models": { + "type": "array", + "items": { + "type": "object", + "description": "Model information", + "properties": { + "name": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "accessible_by_keys": { + "type": "array", + "items": { + "type": "string" + } + } } } }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } + "total": { + "type": "integer" } } } @@ -147587,7 +147730,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -147604,921 +147748,179 @@ } } } - }, - "post": { - "operationId": "createProviderKey", - "summary": "Create a key for a provider", - "description": "Creates a new API key for the specified provider. The key `id` is auto-generated\nif omitted. `enabled` defaults to `true` if omitted. `value` is required and must\nnot be empty. Keys cannot be created on keyless providers.\n", + } + }, + "/api/models/details": { + "get": { + "operationId": "listModelDetailsManagement", + "summary": "List model details", + "description": "Lists available models with capability metadata, when available from the model catalog, with optional filtering by query, provider, or keys.\n", "tags": [ "Providers" ], "parameters": [ + { + "name": "query", + "in": "query", + "description": "Filter models by name (case-insensitive partial match)", + "schema": { + "type": "string" + } + }, { "name": "provider", - "in": "path", - "required": true, - "description": "Provider name", + "in": "query", + "description": "Filter by specific provider name", "schema": { "type": "string" } + }, + { + "name": "keys", + "in": "query", + "description": "Comma-separated list of key IDs to filter models accessible by those keys", + "style": "form", + "explode": false, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "limit", + "in": "query", + "description": "Maximum number of results to return (default 20)", + "schema": { + "type": "integer", + "default": 20 + } + }, + { + "name": "unfiltered", + "in": "query", + "description": "If true, return all models including those filtered out by provider-level restrictions", + "schema": { + "type": "boolean", + "default": false + } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "API key configuration", - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the key" - }, - "name": { - "type": "string", - "description": "Name of the key" - }, - "value": { - "type": "object", - "description": "API key value (redacted in responses)", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key can access (whitelist)" - }, - "blacklisted_models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key cannot access (blacklist)" - }, - "weight": { - "type": "number", - "description": "Weight for load balancing" - }, - "aliases": { - "type": "object", - "propertyNames": { - "minLength": 1 - }, - "additionalProperties": { - "type": "string", - "minLength": 1 - }, - "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" - }, - "azure_key_config": { - "type": "object", - "description": "Azure-specific key configuration", - "properties": { - "endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of scopes to use for authentication" - } - } - }, - "vertex_key_config": { - "type": "object", - "description": "Vertex-specific key configuration", - "properties": { - "project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - } - }, - "bedrock_key_config": { - "type": "object", - "description": "AWS Bedrock-specific key configuration", - "properties": { - "access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "session_token": { + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "List model details response", + "properties": { + "models": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", + "description": "Model details with capability metadata", "properties": { - "value": { - "type": "string" - }, - "env_var": { + "name": { "type": "string" }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "provider": { "type": "string" }, - "env_var": { - "type": "string" + "context_length": { + "type": "integer" }, - "from_env": { - "type": "boolean" - } - } - }, - "arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "max_input_tokens": { + "type": "integer" }, - "env_var": { - "type": "string" + "max_output_tokens": { + "type": "integer" }, - "from_env": { - "type": "boolean" - } - } - }, - "batch_s3_config": { - "type": "object", - "properties": { - "buckets": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bucket_name": { + "architecture": { + "type": "object", + "properties": { + "modality": { + "type": "string" + }, + "tokenizer": { + "type": "string" + }, + "instruct_type": { + "type": "string" + }, + "input_modalities": { + "type": "array", + "items": { "type": "string" - }, - "prefix": { + } + }, + "output_modalities": { + "type": "array", + "items": { "type": "string" - }, - "is_default": { - "type": "boolean" } } } - } - } - } - } - }, - "vllm_key_config": { - "type": "object", - "description": "VLLM-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "model_name": { - "type": "string" - } - }, - "required": [ - "url" - ] - }, - "ollama_key_config": { - "type": "object", - "description": "Ollama-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, - "sgl_key_config": { - "type": "object", - "description": "SGLang-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" }, - "from_env": { - "type": "boolean" + "accessible_by_keys": { + "type": "array", + "items": { + "type": "string" + } } } } }, - "required": [ - "url" - ] - }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "use_deployments_endpoint": { - "type": "boolean", - "description": "Whether to use the deployments endpoint instead of the models endpoint" - } + "total": { + "type": "integer" } - }, - "enabled": { - "type": "boolean", - "description": "Whether the key is active (defaults to true)" - }, - "use_for_batch_api": { - "type": "boolean", - "description": "Whether this key can be used for batch API operations" - }, - "config_hash": { - "type": "string", - "description": "Hash of config.json version, used for change detection" - }, - "status": { - "type": "string", - "description": "Status of key (e.g., success, list_models_failed)" - }, - "description": { - "type": "string", - "description": "Error or status description for the key" } } } } - } - }, - "responses": { - "200": { - "description": "Key created successfully", + }, + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { "type": "object", - "description": "API key configuration", + "description": "Error response from Bifrost", "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the key" + "event_id": { + "type": "string" }, - "name": { - "type": "string", - "description": "Name of the key" + "type": { + "type": "string" }, - "value": { + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { "type": "object", - "description": "API key value (redacted in responses)", "properties": { - "value": { + "type": { "type": "string" }, - "env_var": { + "code": { "type": "string" }, - "from_env": { - "type": "boolean" + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" } } }, - "models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key can access (whitelist)" - }, - "blacklisted_models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key cannot access (blacklist)" - }, - "weight": { - "type": "number", - "description": "Weight for load balancing" - }, - "aliases": { - "type": "object", - "propertyNames": { - "minLength": 1 - }, - "additionalProperties": { - "type": "string", - "minLength": 1 - }, - "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" - }, - "azure_key_config": { - "type": "object", - "description": "Azure-specific key configuration", - "properties": { - "endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of scopes to use for authentication" - } - } - }, - "vertex_key_config": { - "type": "object", - "description": "Vertex-specific key configuration", - "properties": { - "project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - } - }, - "bedrock_key_config": { - "type": "object", - "description": "AWS Bedrock-specific key configuration", - "properties": { - "access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "batch_s3_config": { - "type": "object", - "properties": { - "buckets": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "is_default": { - "type": "boolean" - } - } - } - } - } - } - } - }, - "vllm_key_config": { - "type": "object", - "description": "VLLM-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "model_name": { - "type": "string" - } - }, - "required": [ - "url" - ] - }, - "ollama_key_config": { - "type": "object", - "description": "Ollama-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, - "sgl_key_config": { - "type": "object", - "description": "SGLang-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "use_deployments_endpoint": { - "type": "boolean", - "description": "Whether to use the deployments endpoint instead of the models endpoint" - } - } - }, - "enabled": { - "type": "boolean", - "description": "Whether the key is active (defaults to true)" - }, - "use_for_batch_api": { - "type": "boolean", - "description": "Whether this key can be used for batch API operations" - }, - "config_hash": { - "type": "string", - "description": "Hash of config.json version, used for change detection" - }, - "status": { - "type": "string", - "description": "Status of key (e.g., success, list_models_failed)" - }, - "description": { - "type": "string", - "description": "Error or status description for the key" - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { + "extra_fields": { "type": "object", "properties": { "provider": { @@ -148546,7 +147948,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -148561,9 +147964,32 @@ } } } + } + } + } + }, + "/api/models/parameters": { + "get": { + "operationId": "getModelParameters", + "summary": "Get model parameters", + "description": "Returns the available parameter definitions for models.", + "tags": [ + "Providers" + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true + } + } + } }, - "404": { - "description": "Provider not found", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { @@ -148630,7 +148056,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -148645,9 +148072,58 @@ } } } + } + } + } + }, + "/api/models/base": { + "get": { + "operationId": "listBaseModels", + "summary": "List base models", + "description": "Returns a list of base models from the model catalog.", + "tags": [ + "Providers" + ], + "parameters": [ + { + "name": "query", + "in": "query", + "description": "Filter models by name", + "schema": { + "type": "string" + } + }, + { + "name": "provider", + "in": "query", + "description": "Filter by provider", + "schema": { + "type": "string" + } + }, + { + "name": "limit", + "in": "query", + "description": "Maximum number of results to return", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "additionalProperties": true + } + } + } }, - "409": { - "description": "Key ID already exists", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { @@ -148714,7 +148190,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -148729,23 +148206,173 @@ } } } - }, - "500": { - "description": "Internal server error", + } + } + } + }, + "/api/plugins": { + "get": { + "operationId": "listPlugins", + "summary": "List all plugins", + "description": "Returns a list of all plugins with their configurations and status.\nThe `actualName` field contains the plugin name from `GetName()` (used as the map key),\nwhile `name` contains the display name from the configuration.\nThe `types` array in the status shows which interfaces the plugin implements (llm, mcp, http).\n", + "tags": [ + "Plugins" + ], + "responses": { + "200": { + "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", - "description": "Error response from Bifrost", + "description": "List plugins response", "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" + "plugins": { + "type": "array", + "items": { + "type": "object", + "description": "Plugin configuration", + "properties": { + "id": { + "type": "integer", + "description": "Plugin ID (auto-generated)" + }, + "name": { + "type": "string", + "description": "Display name of the plugin (from config)" + }, + "actualName": { + "type": "string", + "description": "Actual plugin name from GetName() (used as map key in plugin status). Only populated for active plugins." + }, + "enabled": { + "type": "boolean" + }, + "config": { + "type": "object", + "additionalProperties": true + }, + "isCustom": { + "type": "boolean" + }, + "path": { + "type": "string" + }, + "status": { + "type": "object", + "description": "Current plugin status including types array (only populated for active plugins)", + "properties": { + "name": { + "type": "string", + "description": "Display name of the plugin" + }, + "status": { + "type": "string", + "enum": [ + "active", + "error", + "disabled", + "loading", + "uninitialized", + "unloaded", + "loaded" + ] + }, + "logs": { + "type": "array", + "items": { + "type": "string" + } + }, + "types": { + "type": "array", + "description": "Plugin types indicating which interfaces the plugin implements", + "items": { + "type": "string", + "enum": [ + "llm", + "mcp", + "http", + "observability" + ] + } + } + }, + "example": { + "name": "my_custom_plugin", + "status": "active", + "logs": [ + "plugin my_custom_plugin initialized successfully" + ], + "types": [ + "llm", + "http" + ] + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "integer", + "format": "int16" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string" + } + }, + "example": { + "name": "my_custom_plugin", + "actualName": "MyCustomPlugin", + "enabled": true, + "config": { + "api_key": "xxx" + }, + "isCustom": true, + "path": "/plugins/my_custom_plugin.so", + "status": { + "name": "my_custom_plugin", + "status": "active", + "logs": [ + "plugin my_custom_plugin initialized successfully" + ], + "types": [ + "llm", + "http" + ] + } + } + } + }, + "count": { + "type": "integer" + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" }, "status_code": { "type": "integer" @@ -148798,7 +148425,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -148815,466 +148443,351 @@ } } } - } - }, - "/api/providers/{provider}/keys/{key_id}": { - "get": { - "operationId": "getProviderKey", - "summary": "Get a specific key for a provider", - "description": "Returns a single key for the specified provider.", + }, + "post": { + "operationId": "createPlugin", + "summary": "Create a new plugin", + "description": "Creates a new plugin with the specified configuration.", "tags": [ - "Providers" + "Plugins" ], - "parameters": [ - { - "name": "provider", - "in": "path", - "required": true, - "description": "Provider name", - "schema": { - "type": "string" - } - }, - { - "name": "key_id", - "in": "path", - "required": true, - "description": "Key ID", - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Create plugin request", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "enabled": { + "type": "boolean" + }, + "config": { + "type": "object", + "additionalProperties": true + }, + "path": { + "type": "string" + } + } + } } } - ], + }, "responses": { - "200": { - "description": "Successful response", + "201": { + "description": "Plugin created successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "API key configuration", + "description": "Plugin operation response", "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the key" - }, - "name": { - "type": "string", - "description": "Name of the key" + "message": { + "type": "string" }, - "value": { + "plugin": { "type": "object", - "description": "API key value (redacted in responses)", + "description": "Plugin configuration", "properties": { - "value": { - "type": "string" + "id": { + "type": "integer", + "description": "Plugin ID (auto-generated)" }, - "env_var": { - "type": "string" + "name": { + "type": "string", + "description": "Display name of the plugin (from config)" }, - "from_env": { + "actualName": { + "type": "string", + "description": "Actual plugin name from GetName() (used as map key in plugin status). Only populated for active plugins." + }, + "enabled": { "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key can access (whitelist)" - }, - "blacklisted_models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key cannot access (blacklist)" - }, - "weight": { - "type": "number", - "description": "Weight for load balancing" - }, - "aliases": { - "type": "object", - "propertyNames": { - "minLength": 1 - }, - "additionalProperties": { - "type": "string", - "minLength": 1 - }, - "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" - }, - "azure_key_config": { - "type": "object", - "description": "Azure-specific key configuration", - "properties": { - "endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } }, - "api_version": { + "config": { "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "additionalProperties": true }, - "client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "isCustom": { + "type": "boolean" }, - "client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "path": { + "type": "string" }, - "tenant_id": { + "status": { "type": "object", - "description": "Environment variable configuration", + "description": "Current plugin status including types array (only populated for active plugins)", "properties": { - "value": { - "type": "string" + "name": { + "type": "string", + "description": "Display name of the plugin" }, - "env_var": { - "type": "string" + "status": { + "type": "string", + "enum": [ + "active", + "error", + "disabled", + "loading", + "uninitialized", + "unloaded", + "loaded" + ] }, - "from_env": { - "type": "boolean" + "logs": { + "type": "array", + "items": { + "type": "string" + } + }, + "types": { + "type": "array", + "description": "Plugin types indicating which interfaces the plugin implements", + "items": { + "type": "string", + "enum": [ + "llm", + "mcp", + "http", + "observability" + ] + } } + }, + "example": { + "name": "my_custom_plugin", + "status": "active", + "logs": [ + "plugin my_custom_plugin initialized successfully" + ], + "types": [ + "llm", + "http" + ] } }, - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of scopes to use for authentication" + "created_at": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "integer", + "format": "int16" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string" + } + }, + "example": { + "name": "my_custom_plugin", + "actualName": "MyCustomPlugin", + "enabled": true, + "config": { + "api_key": "xxx" + }, + "isCustom": true, + "path": "/plugins/my_custom_plugin.so", + "status": { + "name": "my_custom_plugin", + "status": "active", + "logs": [ + "plugin my_custom_plugin initialized successfully" + ], + "types": [ + "llm", + "http" + ] } } + } + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" }, - "vertex_key_config": { + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { "type": "object", - "description": "Vertex-specific key configuration", "properties": { - "project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "type": { + "type": "string" }, - "project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "code": { + "type": "string" }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "message": { + "type": "string" }, - "auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "param": { + "type": "string" + }, + "event_id": { + "type": "string" } } }, - "bedrock_key_config": { + "extra_fields": { "type": "object", - "description": "AWS Bedrock-specific key configuration", "properties": { - "access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] }, - "arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "model_requested": { + "type": "string" }, - "batch_s3_config": { - "type": "object", - "properties": { - "buckets": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "is_default": { - "type": "boolean" - } - } - } - } - } + "request_type": { + "type": "string" } } + } + } + } + } + } + }, + "409": { + "description": "Plugin already exists", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" }, - "vllm_key_config": { - "type": "object", - "description": "VLLM-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "model_name": { - "type": "string" - } - }, - "required": [ - "url" - ] + "type": { + "type": "string" }, - "ollama_key_config": { - "type": "object", - "description": "Ollama-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] + "is_bifrost_error": { + "type": "boolean" }, - "sgl_key_config": { + "status_code": { + "type": "integer" + }, + "error": { "type": "object", - "description": "SGLang-specific key configuration", "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" } - }, - "required": [ - "url" - ] + } }, - "replicate_key_config": { + "extra_fields": { "type": "object", - "description": "Replicate-specific key configuration", "properties": { - "use_deployments_endpoint": { - "type": "boolean", - "description": "Whether to use the deployments endpoint instead of the models endpoint" + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" } } - }, - "enabled": { - "type": "boolean", - "description": "Whether the key is active (defaults to true)" - }, - "use_for_batch_api": { - "type": "boolean", - "description": "Whether this key can be used for batch API operations" - }, - "config_hash": { - "type": "string", - "description": "Hash of config.json version, used for change detection" - }, - "status": { - "type": "string", - "description": "Status of key (e.g., success, list_models_failed)" - }, - "description": { - "type": "string", - "description": "Error or status description for the key" } } } } } }, - "400": { - "description": "Bad request", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { @@ -149341,7 +148854,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -149356,9 +148870,158 @@ } } } + } + } + } + }, + "/api/plugins/{name}": { + "get": { + "operationId": "getPlugin", + "summary": "Get a specific plugin", + "description": "Returns the configuration for a specific plugin.\nThe response includes the plugin status with types array showing which interfaces\nthe plugin implements (llm, mcp, http). The `actualName` field shows the plugin name\nfrom GetName() (used as the map key), which may differ from the display name (`name`).\n", + "tags": [ + "Plugins" + ], + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "description": "Plugin display name (the config field `name`, not the internal `actualName` from GetName())", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Plugin configuration", + "properties": { + "id": { + "type": "integer", + "description": "Plugin ID (auto-generated)" + }, + "name": { + "type": "string", + "description": "Display name of the plugin (from config)" + }, + "actualName": { + "type": "string", + "description": "Actual plugin name from GetName() (used as map key in plugin status). Only populated for active plugins." + }, + "enabled": { + "type": "boolean" + }, + "config": { + "type": "object", + "additionalProperties": true + }, + "isCustom": { + "type": "boolean" + }, + "path": { + "type": "string" + }, + "status": { + "type": "object", + "description": "Current plugin status including types array (only populated for active plugins)", + "properties": { + "name": { + "type": "string", + "description": "Display name of the plugin" + }, + "status": { + "type": "string", + "enum": [ + "active", + "error", + "disabled", + "loading", + "uninitialized", + "unloaded", + "loaded" + ] + }, + "logs": { + "type": "array", + "items": { + "type": "string" + } + }, + "types": { + "type": "array", + "description": "Plugin types indicating which interfaces the plugin implements", + "items": { + "type": "string", + "enum": [ + "llm", + "mcp", + "http", + "observability" + ] + } + } + }, + "example": { + "name": "my_custom_plugin", + "status": "active", + "logs": [ + "plugin my_custom_plugin initialized successfully" + ], + "types": [ + "llm", + "http" + ] + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "integer", + "format": "int16" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string" + } + }, + "example": { + "name": "my_custom_plugin", + "actualName": "MyCustomPlugin", + "enabled": true, + "config": { + "api_key": "xxx" + }, + "isCustom": true, + "path": "/plugins/my_custom_plugin.so", + "status": { + "name": "my_custom_plugin", + "status": "active", + "logs": [ + "plugin my_custom_plugin initialized successfully" + ], + "types": [ + "llm", + "http" + ] + } + } + } + } + } }, - "404": { - "description": "Provider or key not found", + "400": { + "description": "Bad request", "content": { "application/json": { "schema": { @@ -149425,7 +149088,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -149441,8 +149105,8 @@ } } }, - "500": { - "description": "Internal server error", + "404": { + "description": "Plugin not found", "content": { "application/json": { "schema": { @@ -149509,7 +149173,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -149524,457 +149189,129 @@ } } } - } - } - }, - "put": { - "operationId": "updateProviderKey", - "summary": "Update a key for a provider", - "description": "Updates an existing key. Send the full key object. Redacted values sent back\nunchanged are automatically preserved (the server merges them with the stored\nraw values).\n", - "tags": [ - "Providers" - ], - "parameters": [ - { - "name": "provider", - "in": "path", - "required": true, - "description": "Provider name", - "schema": { - "type": "string" - } }, - { - "name": "key_id", - "in": "path", - "required": true, - "description": "Key ID", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "API key configuration", - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the key" - }, - "name": { - "type": "string", - "description": "Name of the key" - }, - "value": { - "type": "object", - "description": "API key value (redacted in responses)", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { "type": "string" }, - "description": "List of models this key can access (whitelist)" - }, - "blacklisted_models": { - "type": "array", - "items": { + "type": { "type": "string" }, - "description": "List of models this key cannot access (blacklist)" - }, - "weight": { - "type": "number", - "description": "Weight for load balancing" - }, - "aliases": { - "type": "object", - "propertyNames": { - "minLength": 1 + "is_bifrost_error": { + "type": "boolean" }, - "additionalProperties": { - "type": "string", - "minLength": 1 + "status_code": { + "type": "integer" }, - "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" - }, - "azure_key_config": { - "type": "object", - "description": "Azure-specific key configuration", - "properties": { - "endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "scopes": { - "type": "array", - "items": { + "error": { + "type": "object", + "properties": { + "type": { "type": "string" }, - "description": "List of scopes to use for authentication" - } - } - }, - "vertex_key_config": { - "type": "object", - "description": "Vertex-specific key configuration", - "properties": { - "project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - } - }, - "bedrock_key_config": { - "type": "object", - "description": "AWS Bedrock-specific key configuration", - "properties": { - "access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "batch_s3_config": { - "type": "object", - "properties": { - "buckets": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "is_default": { - "type": "boolean" - } - } - } - } - } - } - } - }, - "vllm_key_config": { - "type": "object", - "description": "VLLM-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "model_name": { - "type": "string" - } - }, - "required": [ - "url" - ] - }, - "ollama_key_config": { - "type": "object", - "description": "Ollama-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" } } }, - "required": [ - "url" - ] - }, - "sgl_key_config": { - "type": "object", - "description": "SGLang-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" } } - }, - "required": [ - "url" - ] - }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "use_deployments_endpoint": { - "type": "boolean", - "description": "Whether to use the deployments endpoint instead of the models endpoint" - } } - }, + } + } + } + } + } + } + }, + "put": { + "operationId": "updatePlugin", + "summary": "Update a plugin", + "description": "Updates a plugin's configuration. Will reload or stop the plugin based on enabled status.\nThe response `actualName` field shows the plugin name from GetName() (used as the map key),\nwhich may differ from the display name (`name`).\n", + "tags": [ + "Plugins" + ], + "parameters": [ + { + "name": "name", + "in": "path", + "required": true, + "description": "Plugin display name (the config field `name`, not the internal `actualName` from GetName())", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Update plugin request", + "properties": { "enabled": { - "type": "boolean", - "description": "Whether the key is active (defaults to true)" - }, - "use_for_batch_api": { - "type": "boolean", - "description": "Whether this key can be used for batch API operations" - }, - "config_hash": { - "type": "string", - "description": "Hash of config.json version, used for change detection" + "type": "boolean" }, - "status": { - "type": "string", - "description": "Status of key (e.g., success, list_models_failed)" + "config": { + "type": "object", + "additionalProperties": true }, - "description": { - "type": "string", - "description": "Error or status description for the key" + "path": { + "type": "string" } } } @@ -149983,426 +149320,134 @@ }, "responses": { "200": { - "description": "Key updated successfully", + "description": "Plugin updated successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "API key configuration", + "description": "Plugin operation response", "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the key" - }, - "name": { - "type": "string", - "description": "Name of the key" - }, - "value": { - "type": "object", - "description": "API key value (redacted in responses)", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key can access (whitelist)" - }, - "blacklisted_models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key cannot access (blacklist)" - }, - "weight": { - "type": "number", - "description": "Weight for load balancing" - }, - "aliases": { - "type": "object", - "propertyNames": { - "minLength": 1 - }, - "additionalProperties": { - "type": "string", - "minLength": 1 - }, - "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" - }, - "azure_key_config": { - "type": "object", - "description": "Azure-specific key configuration", - "properties": { - "endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of scopes to use for authentication" - } - } + "message": { + "type": "string" }, - "vertex_key_config": { + "plugin": { "type": "object", - "description": "Vertex-specific key configuration", + "description": "Plugin configuration", "properties": { - "project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "id": { + "type": "integer", + "description": "Plugin ID (auto-generated)" }, - "project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "name": { + "type": "string", + "description": "Display name of the plugin (from config)" }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "actualName": { + "type": "string", + "description": "Actual plugin name from GetName() (used as map key in plugin status). Only populated for active plugins." }, - "auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - } - }, - "bedrock_key_config": { - "type": "object", - "description": "AWS Bedrock-specific key configuration", - "properties": { - "access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "enabled": { + "type": "boolean" }, - "secret_key": { + "config": { "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "additionalProperties": true }, - "session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "isCustom": { + "type": "boolean" }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "path": { + "type": "string" }, - "arn": { + "status": { "type": "object", - "description": "Environment variable configuration", + "description": "Current plugin status including types array (only populated for active plugins)", "properties": { - "value": { - "type": "string" + "name": { + "type": "string", + "description": "Display name of the plugin" }, - "env_var": { - "type": "string" + "status": { + "type": "string", + "enum": [ + "active", + "error", + "disabled", + "loading", + "uninitialized", + "unloaded", + "loaded" + ] }, - "from_env": { - "type": "boolean" - } - } - }, - "batch_s3_config": { - "type": "object", - "properties": { - "buckets": { + "logs": { "type": "array", "items": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "is_default": { - "type": "boolean" - } - } + "type": "string" } - } - } - } - } - }, - "vllm_key_config": { - "type": "object", - "description": "VLLM-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" }, - "from_env": { - "type": "boolean" + "types": { + "type": "array", + "description": "Plugin types indicating which interfaces the plugin implements", + "items": { + "type": "string", + "enum": [ + "llm", + "mcp", + "http", + "observability" + ] + } } + }, + "example": { + "name": "my_custom_plugin", + "status": "active", + "logs": [ + "plugin my_custom_plugin initialized successfully" + ], + "types": [ + "llm", + "http" + ] } }, - "model_name": { + "created_at": { + "type": "string", + "format": "date-time" + }, + "version": { + "type": "integer", + "format": "int16" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { "type": "string" } }, - "required": [ - "url" - ] - }, - "ollama_key_config": { - "type": "object", - "description": "Ollama-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, - "sgl_key_config": { - "type": "object", - "description": "SGLang-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "use_deployments_endpoint": { - "type": "boolean", - "description": "Whether to use the deployments endpoint instead of the models endpoint" + "example": { + "name": "my_custom_plugin", + "actualName": "MyCustomPlugin", + "enabled": true, + "config": { + "api_key": "xxx" + }, + "isCustom": true, + "path": "/plugins/my_custom_plugin.so", + "status": { + "name": "my_custom_plugin", + "status": "active", + "logs": [ + "plugin my_custom_plugin initialized successfully" + ], + "types": [ + "llm", + "http" + ] } } - }, - "enabled": { - "type": "boolean", - "description": "Whether the key is active (defaults to true)" - }, - "use_for_batch_api": { - "type": "boolean", - "description": "Whether this key can be used for batch API operations" - }, - "config_hash": { - "type": "string", - "description": "Hash of config.json version, used for change detection" - }, - "status": { - "type": "string", - "description": "Status of key (e.g., success, list_models_failed)" - }, - "description": { - "type": "string", - "description": "Error or status description for the key" } } } @@ -150477,7 +149522,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -150494,7 +149540,7 @@ } }, "404": { - "description": "Provider or key not found", + "description": "Plugin not found", "content": { "application/json": { "schema": { @@ -150561,7 +149607,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -150645,7 +149692,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -150664,27 +149712,18 @@ } }, "delete": { - "operationId": "deleteProviderKey", - "summary": "Delete a key from a provider", - "description": "Deletes a key from the specified provider. Returns the deleted key.", + "operationId": "deletePlugin", + "summary": "Delete a plugin", + "description": "Removes a plugin from the configuration and stops it if running.", "tags": [ - "Providers" + "Plugins" ], "parameters": [ { - "name": "provider", - "in": "path", - "required": true, - "description": "Provider name", - "schema": { - "type": "string" - } - }, - { - "name": "key_id", + "name": "name", "in": "path", "required": true, - "description": "Key ID", + "description": "Plugin display name (the config field `name`, not the internal `actualName` from GetName())", "schema": { "type": "string" } @@ -150692,426 +149731,15 @@ ], "responses": { "200": { - "description": "Key deleted successfully", + "description": "Plugin deleted successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "API key configuration", + "description": "Simple message response", "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the key" - }, - "name": { - "type": "string", - "description": "Name of the key" - }, - "value": { - "type": "object", - "description": "API key value (redacted in responses)", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key can access (whitelist)" - }, - "blacklisted_models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key cannot access (blacklist)" - }, - "weight": { - "type": "number", - "description": "Weight for load balancing" - }, - "aliases": { - "type": "object", - "propertyNames": { - "minLength": 1 - }, - "additionalProperties": { - "type": "string", - "minLength": 1 - }, - "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" - }, - "azure_key_config": { - "type": "object", - "description": "Azure-specific key configuration", - "properties": { - "endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of scopes to use for authentication" - } - } - }, - "vertex_key_config": { - "type": "object", - "description": "Vertex-specific key configuration", - "properties": { - "project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - } - }, - "bedrock_key_config": { - "type": "object", - "description": "AWS Bedrock-specific key configuration", - "properties": { - "access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "batch_s3_config": { - "type": "object", - "properties": { - "buckets": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "is_default": { - "type": "boolean" - } - } - } - } - } - } - } - }, - "vllm_key_config": { - "type": "object", - "description": "VLLM-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "model_name": { - "type": "string" - } - }, - "required": [ - "url" - ] - }, - "ollama_key_config": { - "type": "object", - "description": "Ollama-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, - "sgl_key_config": { - "type": "object", - "description": "SGLang-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "use_deployments_endpoint": { - "type": "boolean", - "description": "Whether to use the deployments endpoint instead of the models endpoint" - } - } - }, - "enabled": { - "type": "boolean", - "description": "Whether the key is active (defaults to true)" - }, - "use_for_batch_api": { - "type": "boolean", - "description": "Whether this key can be used for batch API operations" - }, - "config_hash": { - "type": "string", - "description": "Hash of config.json version, used for change detection" - }, - "status": { - "type": "string", - "description": "Status of key (e.g., success, list_models_failed)" - }, - "description": { - "type": "string", - "description": "Error or status description for the key" + "message": { + "type": "string" } } } @@ -151186,7 +149814,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -151203,7 +149832,7 @@ } }, "404": { - "description": "Provider or key not found", + "description": "Plugin not found", "content": { "application/json": { "schema": { @@ -151270,7 +149899,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -151354,7 +149984,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -151373,327 +150004,376 @@ } } }, - "/api/keys": { - "get": { - "operationId": "listKeys", - "summary": "List all keys", - "description": "Returns a list of all configured API keys across all providers.", + "/v1/mcp/tool/execute": { + "post": { + "operationId": "executeMCPTool", + "summary": "Execute MCP tool", + "description": "Executes an MCP tool and returns the result.", "tags": [ - "Providers" + "MCP" ], - "responses": { - "200": { - "description": "Successful response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { + "parameters": [ + { + "name": "format", + "in": "query", + "required": false, + "description": "Format of the tool execution request/response.\n", + "schema": { + "type": "string", + "enum": [ + "chat", + "responses" + ], + "default": "chat" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "oneOf": [ + { "type": "object", - "description": "API key configuration", + "required": [ + "function" + ], "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the key" + "index": { + "type": "integer" }, - "name": { - "type": "string", - "description": "Name of the key" + "type": { + "type": "string" }, - "value": { + "id": { + "type": "string" + }, + "function": { "type": "object", - "description": "API key value (redacted in responses)", "properties": { - "value": { + "name": { "type": "string" }, - "env_var": { + "arguments": { "type": "string" - }, - "from_env": { - "type": "boolean" } } + } + }, + "title": "Chat (Default)", + "description": "Chat format - uses ChatAssistantMessageToolCall schema" + }, + { + "type": "object", + "description": "Responses format - uses ResponsesToolMessage schema", + "required": [ + "name" + ], + "properties": { + "call_id": { + "type": "string", + "description": "Common call ID for tool calls and outputs" }, - "models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key can access (whitelist)" + "name": { + "type": "string", + "description": "Tool function name (required for execution)" }, - "blacklisted_models": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of models this key cannot access (blacklist)" + "arguments": { + "type": "string", + "description": "Tool function arguments as JSON string" }, - "weight": { - "type": "number", - "description": "Weight for load balancing" + "output": { + "type": "object", + "description": "Tool execution output", + "additionalProperties": true }, - "aliases": { + "action": { "type": "object", - "propertyNames": { - "minLength": 1 - }, - "additionalProperties": { + "description": "Tool action configuration", + "additionalProperties": true + }, + "error": { + "type": "string", + "description": "Error message if tool execution failed" + } + }, + "title": "Responses" + } + ], + "description": "MCP tool execution request. The schema depends on the `format` query parameter:\n- `format=chat` or empty (default): Use `ChatAssistantMessageToolCall` schema\n- `format=responses`: Use `ResponsesToolMessage` schema\n" + }, + "examples": { + "chat": { + "summary": "Chat format example", + "value": { + "id": "call_123", + "type": "function", + "function": { + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" + } + } + }, + "responses": { + "summary": "Responses format example", + "value": { + "call_id": "call_123", + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Tool executed successfully", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "required": [ + "role" + ], + "properties": { + "role": { "type": "string", - "minLength": 1 + "enum": [ + "assistant", + "user", + "system", + "tool", + "developer" + ] }, - "description": "Model alias mappings — maps a user-facing model name to a provider-specific identifier (deployment name, inference profile ID, fine-tuned model ID, etc.)" - }, - "azure_key_config": { - "type": "object", - "description": "Azure-specific key configuration", - "properties": { - "endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" + "name": { + "type": "string" + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "text", + "image_url", + "input_audio", + "file", + "refusal" + ] + }, + "text": { + "type": "string" + }, + "refusal": { + "type": "string" + }, + "image_url": { + "type": "object", + "required": [ + "url" + ], + "properties": { + "url": { + "type": "string" + }, + "detail": { + "type": "string", + "enum": [ + "low", + "high", + "auto" + ] + } + } + }, + "input_audio": { + "type": "object", + "required": [ + "data" + ], + "properties": { + "data": { + "type": "string" + }, + "format": { + "type": "string" + } + } + }, + "file": { + "type": "object", + "properties": { + "file_data": { + "type": "string" + }, + "file_id": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "file_type": { + "type": "string" + } + } + }, + "cache_control": { + "type": "object", + "description": "Cache control settings for content blocks", + "properties": { + "type": { + "type": "string", + "enum": [ + "ephemeral" + ] + }, + "ttl": { + "type": "string", + "description": "Time to live (e.g., \"1m\", \"1h\")" + } + } + } + } } } - }, - "scopes": { - "type": "array", - "items": { + ], + "description": "Message content - can be a string or array of content blocks" + }, + "tool_call_id": { + "type": "string", + "description": "For tool messages" + }, + "refusal": { + "type": "string" + }, + "audio": { + "type": "object", + "properties": { + "id": { "type": "string" }, - "description": "List of scopes to use for authentication" + "data": { + "type": "string" + }, + "expires_at": { + "type": "integer" + }, + "transcript": { + "type": "string" + } } - } - }, - "vertex_key_config": { - "type": "object", - "description": "Vertex-specific key configuration", - "properties": { - "project_id": { + }, + "reasoning": { + "type": "string" + }, + "reasoning_details": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", "properties": { - "value": { - "type": "string" - }, - "env_var": { + "id": { "type": "string" }, - "from_env": { - "type": "boolean" - } - } - }, - "project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "index": { + "type": "integer" }, - "env_var": { - "type": "string" + "type": { + "type": "string", + "enum": [ + "reasoning.summary", + "reasoning.encrypted", + "reasoning.text" + ] }, - "from_env": { - "type": "boolean" - } - } - }, - "region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "summary": { "type": "string" }, - "env_var": { + "text": { "type": "string" }, - "from_env": { - "type": "boolean" - } - } - }, - "auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "signature": { "type": "string" }, - "env_var": { + "data": { "type": "string" - }, - "from_env": { - "type": "boolean" } } } - } - }, - "bedrock_key_config": { - "type": "object", - "description": "AWS Bedrock-specific key configuration", - "properties": { - "access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "session_token": { + }, + "annotations": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", "properties": { - "value": { - "type": "string" - }, - "env_var": { + "type": { "type": "string" }, - "from_env": { - "type": "boolean" + "url_citation": { + "type": "object", + "properties": { + "start_index": { + "type": "integer" + }, + "end_index": { + "type": "integer" + }, + "title": { + "type": "string" + }, + "url": { + "type": "string" + }, + "sources": { + "type": "object" + }, + "type": { + "type": "string" + } + } } } - }, - "region": { + } + }, + "tool_calls": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", + "required": [ + "function" + ], "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" + "index": { + "type": "integer" }, - "from_env": { - "type": "boolean" - } - } - }, - "arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "type": { "type": "string" }, - "env_var": { + "id": { "type": "string" }, - "from_env": { - "type": "boolean" - } - } - }, - "batch_s3_config": { - "type": "object", - "properties": { - "buckets": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bucket_name": { - "type": "string" - }, - "prefix": { - "type": "string" - }, - "is_default": { - "type": "boolean" - } + "function": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "arguments": { + "type": "string" } } } @@ -151701,119 +150381,329 @@ } } }, - "replicate_key_config": { - "type": "object", - "description": "Replicate-specific key configuration", - "properties": { - "use_deployments_endpoint": { - "type": "boolean", - "description": "Whether to use the deployments endpoint instead of the models endpoint" - } - } - }, - "vllm_key_config": { - "type": "object", - "description": "VLLM-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" + "title": "Chat (Default)", + "description": "Chat format response" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "type": { + "type": "string", + "enum": [ + "message", + "file_search_call", + "computer_call", + "computer_call_output", + "web_search_call", + "web_fetch_call", + "function_call", + "function_call_output", + "code_interpreter_call", + "local_shell_call", + "local_shell_call_output", + "mcp_call", + "custom_tool_call", + "custom_tool_call_output", + "image_generation_call", + "mcp_list_tools", + "mcp_approval_request", + "mcp_approval_responses", + "reasoning", + "item_reference", + "refusal" + ] + }, + "status": { + "type": "string", + "enum": [ + "in_progress", + "completed", + "incomplete", + "interpreting", + "failed" + ] + }, + "role": { + "type": "string", + "enum": [ + "assistant", + "user", + "system", + "developer" + ] + }, + "content": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "input_text", + "input_image", + "input_file", + "input_audio", + "output_text", + "refusal", + "reasoning_text" + ] + }, + "file_id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "signature": { + "type": "string" + }, + "image_url": { + "type": "string" + }, + "detail": { + "type": "string" + }, + "file_data": { + "type": "string" + }, + "file_url": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "file_type": { + "type": "string" + }, + "input_audio": { + "type": "object", + "required": [ + "format", + "data" + ], + "properties": { + "format": { + "type": "string", + "enum": [ + "mp3", + "wav" + ] + }, + "data": { + "type": "string" + } + } + }, + "annotations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "file_citation", + "url_citation", + "container_file_citation", + "file_path" + ] + }, + "index": { + "type": "integer" + }, + "file_id": { + "type": "string" + }, + "text": { + "type": "string" + }, + "start_index": { + "type": "integer" + }, + "end_index": { + "type": "integer" + }, + "filename": { + "type": "string" + }, + "title": { + "type": "string" + }, + "url": { + "type": "string" + }, + "container_id": { + "type": "string" + } + } + } + }, + "logprobs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "bytes": { + "type": "array", + "items": { + "type": "integer" + } + }, + "logprob": { + "type": "number" + }, + "token": { + "type": "string" + }, + "top_logprobs": { + "type": "array", + "items": { + "type": "object", + "properties": { + "bytes": { + "type": "array", + "items": { + "type": "integer" + } + }, + "logprob": { + "type": "number" + }, + "token": { + "type": "string" + } + } + } + } + } + } + }, + "refusal": { + "type": "string" + }, + "cache_control": { + "type": "object", + "description": "Cache control settings for content blocks", + "properties": { + "type": { + "type": "string", + "enum": [ + "ephemeral" + ] + }, + "ttl": { + "type": "string", + "description": "Time to live (e.g., \"1m\", \"1h\")" + } + } + } + } } } - }, - "model_name": { + ] + }, + "call_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "arguments": { + "type": "string" + }, + "output": { + "type": "object" + }, + "action": { + "type": "object" + }, + "error": { + "type": "string" + }, + "queries": { + "type": "array", + "items": { "type": "string" } }, - "required": [ - "url" - ] - }, - "ollama_key_config": { - "type": "object", - "description": "Ollama-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "results": { + "type": "array", + "items": { + "type": "object" } }, - "required": [ - "url" - ] - }, - "sgl_key_config": { - "type": "object", - "description": "SGLang-specific key configuration", - "properties": { - "url": { + "summary": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", + "required": [ + "type", + "text" + ], "properties": { - "value": { - "type": "string" + "type": { + "type": "string", + "enum": [ + "summary_text" + ] }, - "env_var": { + "text": { "type": "string" - }, - "from_env": { - "type": "boolean" } } } }, - "required": [ - "url" - ] - }, - "enabled": { - "type": "boolean", - "description": "Whether the key is active (defaults to true)" - }, - "use_for_batch_api": { - "type": "boolean", - "description": "Whether this key can be used for batch API operations" - }, - "config_hash": { - "type": "string", - "description": "Hash of config.json version, used for change detection" - }, - "status": { - "type": "string", - "description": "Status of key (e.g., success, list_models_failed)" + "encrypted_content": { + "type": "string" + } }, - "description": { - "type": "string", - "description": "Error or status description for the key" - } + "title": "Responses", + "description": "Responses format response" + } + ], + "description": "MCP tool execution response.\n" + }, + "examples": { + "chat": { + "summary": "Chat format response", + "value": { + "name": "get_weather", + "role": "tool", + "tool_call_id": "call_123", + "content": "The weather in San Francisco is 72°F and sunny." + } + }, + "responses": { + "summary": "Responses format response", + "value": { + "id": "msg_123", + "type": "function_call_output", + "status": "completed", + "role": "assistant", + "call_id": "call_123", + "name": "get_weather", + "arguments": "{\"location\": \"San Francisco\"}", + "content": "The weather in San Francisco is 72°F and sunny." } } } } } }, - "500": { - "description": "Internal server error", + "400": { + "description": "Bad request", "content": { "application/json": { "schema": { @@ -151896,104 +150786,6 @@ } } } - } - } - } - }, - "/api/models": { - "get": { - "operationId": "listModelsManagement", - "summary": "List models", - "description": "Lists available models with optional filtering by query, provider, or keys.\n", - "tags": [ - "Providers" - ], - "parameters": [ - { - "name": "query", - "in": "query", - "description": "Filter models by name (case-insensitive partial match)", - "schema": { - "type": "string" - } - }, - { - "name": "provider", - "in": "query", - "description": "Filter by specific provider name", - "schema": { - "type": "string" - } - }, - { - "name": "keys", - "in": "query", - "description": "Comma-separated list of key IDs to filter models accessible by those keys", - "style": "form", - "explode": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum number of results to return (default 5)", - "schema": { - "type": "integer", - "default": 5 - } - }, - { - "name": "unfiltered", - "in": "query", - "description": "If true, return all models including those filtered out by provider-level restrictions", - "schema": { - "type": "boolean", - "default": false - } - } - ], - "responses": { - "200": { - "description": "Successful response", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "List models response", - "properties": { - "models": { - "type": "array", - "items": { - "type": "object", - "description": "Model information", - "properties": { - "name": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "accessible_by_keys": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "total": { - "type": "integer" - } - } - } - } - } }, "500": { "description": "Internal server error", @@ -152083,62 +150875,13 @@ } } }, - "/api/models/details": { + "/api/mcp/clients": { "get": { - "operationId": "listModelDetailsManagement", - "summary": "List model details", - "description": "Lists available models with capability metadata, when available from the model catalog, with optional filtering by query, provider, or keys.\n", + "operationId": "getMCPClients", + "summary": "List MCP clients", + "description": "Returns a list of all configured MCP clients with their tools and connection state.", "tags": [ - "Providers" - ], - "parameters": [ - { - "name": "query", - "in": "query", - "description": "Filter models by name (case-insensitive partial match)", - "schema": { - "type": "string" - } - }, - { - "name": "provider", - "in": "query", - "description": "Filter by specific provider name", - "schema": { - "type": "string" - } - }, - { - "name": "keys", - "in": "query", - "description": "Comma-separated list of key IDs to filter models accessible by those keys", - "style": "form", - "explode": false, - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum number of results to return (default 20)", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "unfiltered", - "in": "query", - "description": "If true, return all models including those filtered out by provider-level restrictions", - "schema": { - "type": "boolean", - "default": false - } - } + "MCP" ], "responses": { "200": { @@ -152146,314 +150889,176 @@ "content": { "application/json": { "schema": { - "type": "object", - "description": "List model details response", - "properties": { - "models": { - "type": "array", - "items": { + "type": "array", + "items": { + "type": "object", + "description": "Connected MCP client with its tools", + "properties": { + "config": { "type": "object", - "description": "Model details with capability metadata", + "description": "Full MCP client configuration (used in responses)", "properties": { - "name": { - "type": "string" + "client_id": { + "type": "string", + "description": "Unique identifier for the MCP client" }, - "provider": { - "type": "string" + "name": { + "type": "string", + "description": "Display name for the MCP client" }, - "context_length": { - "type": "integer" + "is_code_mode_client": { + "type": "boolean", + "description": "Whether this client is available in code mode" }, - "max_input_tokens": { - "type": "integer" + "connection_type": { + "type": "string", + "enum": [ + "http", + "stdio", + "sse", + "inprocess" + ], + "description": "Connection type for MCP client" }, - "max_output_tokens": { - "type": "integer" + "connection_string": { + "type": "string", + "description": "HTTP or SSE URL (required for HTTP or SSE connections)" }, - "architecture": { + "stdio_config": { "type": "object", + "description": "STDIO configuration for MCP client", "properties": { - "modality": { - "type": "string" - }, - "tokenizer": { - "type": "string" - }, - "instruct_type": { - "type": "string" + "command": { + "type": "string", + "description": "Executable command to run" }, - "input_modalities": { + "args": { "type": "array", "items": { "type": "string" - } + }, + "description": "Command line arguments" }, - "output_modalities": { + "envs": { "type": "array", "items": { "type": "string" - } + }, + "description": "Environment variables required" } } }, - "accessible_by_keys": { + "auth_type": { + "type": "string", + "enum": [ + "none", + "headers", + "oauth", + "per_user_oauth" + ], + "description": "Authentication type for the MCP connection" + }, + "oauth_config_id": { + "type": "string", + "description": "OAuth config ID for OAuth authentication.\nReferences the oauth_configs table.\nOnly set when auth_type is \"oauth\".\n" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" + }, + "tools_to_execute": { "type": "array", "items": { "type": "string" - } + }, + "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" + }, + "tools_to_auto_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" + }, + "tool_pricing": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + }, + "description": "Per-tool cost in USD for execution.\nKey is the tool name, value is the cost per execution.\nExample: {\"read_file\": 0.001, \"write_file\": 0.002}\n" + }, + "allow_on_all_virtual_keys": { + "type": "boolean", + "default": false, + "description": "When true, this MCP client's tools are accessible to all virtual keys without requiring\nexplicit per-key assignment. All tools are allowed by default. If a virtual key has an\nexplicit MCP config for this client, that config takes precedence and overrides this behaviour.\n" } } - } - }, - "total": { - "type": "integer" - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - }, - "/api/models/parameters": { - "get": { - "operationId": "getModelParameters", - "summary": "Get model parameters", - "description": "Returns the available parameter definitions for models.", - "tags": [ - "Providers" - ], - "responses": { - "200": { - "description": "Successful response", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": true - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" + }, + "tools": { + "type": "array", + "items": { + "type": "object", + "description": "Tool function definition", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "parameters": { + "type": "object", + "additionalProperties": true + }, + "strict": { + "type": "boolean" + } + } } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" + }, + "state": { + "type": "string", + "enum": [ + "connected", + "disconnected", + "error" + ], + "description": "Connection state of an MCP client" + }, + "vk_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Per-virtual-key tool access configuration as returned in list/get responses", + "properties": { + "virtual_key_id": { + "type": "string", + "description": "ID of the virtual key" + }, + "virtual_key_name": { + "type": "string", + "description": "Display name of the virtual key" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Tools this virtual key is allowed to call on this MCP client.\n[\"*\"] => all tools allowed\n[\"tool1\", \"tool2\"] => only the specified tools\n" + } + } }, - "request_type": { - "type": "string" - } + "description": "Virtual key assignments for this MCP client" } } } } } } - } - } - } - }, - "/api/models/base": { - "get": { - "operationId": "listBaseModels", - "summary": "List base models", - "description": "Returns a list of base models from the model catalog.", - "tags": [ - "Providers" - ], - "parameters": [ - { - "name": "query", - "in": "query", - "description": "Filter models by name", - "schema": { - "type": "string" - } - }, - { - "name": "provider", - "in": "query", - "description": "Filter by provider", - "schema": { - "type": "string" - } - }, - { - "name": "limit", - "in": "query", - "description": "Maximum number of results to return", - "schema": { - "type": "integer" - } - } - ], - "responses": { - "200": { - "description": "Successful response", - "content": { - "application/json": { - "schema": { - "type": "object", - "additionalProperties": true - } - } - } }, "500": { "description": "Internal server error", @@ -152543,155 +151148,468 @@ } } }, - "/api/plugins": { - "get": { - "operationId": "listPlugins", - "summary": "List all plugins", - "description": "Returns a list of all plugins with their configurations and status.\nThe `actualName` field contains the plugin name from `GetName()` (used as the map key),\nwhile `name` contains the display name from the configuration.\nThe `types` array in the status shows which interfaces the plugin implements (llm, mcp, http).\n", + "/api/mcp/client": { + "post": { + "operationId": "addMCPClient", + "summary": "Add MCP client", + "description": "Adds a new MCP client with the specified configuration.\nNote: tool_pricing is not available when creating a new client as tools are fetched after client creation.\n", "tags": [ - "Plugins" + "MCP" ], - "responses": { - "200": { - "description": "Successful response", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "List plugins response", - "properties": { - "plugins": { - "type": "array", - "items": { + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "allOf": [ + { "type": "object", - "description": "Plugin configuration", + "required": [ + "name", + "connection_type" + ], "properties": { - "id": { - "type": "integer", - "description": "Plugin ID (auto-generated)" - }, - "name": { + "client_id": { "type": "string", - "description": "Display name of the plugin (from config)" + "description": "Unique identifier for the MCP client (optional, auto-generated if not provided)" }, - "actualName": { + "name": { "type": "string", - "description": "Actual plugin name from GetName() (used as map key in plugin status). Only populated for active plugins." + "description": "Display name for the MCP client" }, - "enabled": { + "is_code_mode_client": { "type": "boolean" }, - "config": { - "type": "object", - "additionalProperties": true + "is_ping_available": { + "type": "boolean", + "default": true, + "description": "Whether the MCP server supports ping for health checks.\nIf true, uses lightweight ping method for health checks.\nIf false, uses listTools method for health checks instead.\n" }, - "isCustom": { - "type": "boolean" + "connection_type": { + "type": "string", + "enum": [ + "http", + "stdio", + "sse", + "inprocess" + ], + "description": "Connection type for MCP client" }, - "path": { - "type": "string" + "auth_type": { + "type": "string", + "enum": [ + "none", + "headers", + "oauth", + "per_user_oauth" + ], + "description": "Authentication type for the MCP connection" }, - "status": { + "oauth_config_id": { + "type": "string", + "description": "OAuth config ID for OAuth authentication.\nSet after OAuth flow is completed. References the oauth_configs table.\nOnly relevant when auth_type is \"oauth\".\n" + }, + "headers": { "type": "object", - "description": "Current plugin status including types array (only populated for active plugins)", + "additionalProperties": { + "type": "string" + }, + "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" + }, + "oauth_config": { + "type": "object", + "description": "OAuth configuration for initiating OAuth flow.\nOnly include this when creating a client with auth_type \"oauth\".\nThis will trigger the OAuth flow and return an authorization URL.\n", "properties": { - "name": { + "client_id": { "type": "string", - "description": "Display name of the plugin" + "description": "OAuth client ID. Optional if client supports dynamic client registration (RFC 7591).\nIf not provided, the server_url must be set for OAuth discovery and dynamic registration.\n" }, - "status": { + "client_secret": { "type": "string", - "enum": [ - "active", - "error", - "disabled", - "loading", - "uninitialized", - "unloaded", - "loaded" - ] + "description": "OAuth client secret. Optional for public clients using PKCE or clients obtained via dynamic registration.\n" }, - "logs": { + "authorize_url": { + "type": "string", + "description": "OAuth authorization endpoint URL. Optional - will be discovered from server_url if not provided.\n" + }, + "token_url": { + "type": "string", + "description": "OAuth token endpoint URL. Optional - will be discovered from server_url if not provided.\n" + }, + "registration_url": { + "type": "string", + "description": "Dynamic client registration endpoint URL (RFC 7591). Optional - will be discovered from server_url if not provided.\n" + }, + "scopes": { "type": "array", "items": { "type": "string" - } + }, + "description": "OAuth scopes requested. Optional - can be discovered from server_url if not provided.\nExample: [\"read\", \"write\"]\n" + } + } + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" + }, + "tools_to_auto_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" + }, + "allow_on_all_virtual_keys": { + "type": "boolean", + "default": false, + "description": "When true, this MCP client's tools are available to all virtual keys by default,\nwithout requiring an explicit virtual key assignment.\nAn explicit virtual key config always overrides this setting for that key.\n" + } + } + }, + { + "type": "object", + "required": [ + "connection_string" + ], + "properties": { + "connection_type": { + "type": "string", + "enum": [ + "http" + ] + }, + "connection_string": { + "type": "string", + "description": "HTTP URL (required for HTTP connection type)" + } + } + } + ] + }, + { + "allOf": [ + { + "type": "object", + "required": [ + "name", + "connection_type" + ], + "properties": { + "client_id": { + "type": "string", + "description": "Unique identifier for the MCP client (optional, auto-generated if not provided)" + }, + "name": { + "type": "string", + "description": "Display name for the MCP client" + }, + "is_code_mode_client": { + "type": "boolean" + }, + "is_ping_available": { + "type": "boolean", + "default": true, + "description": "Whether the MCP server supports ping for health checks.\nIf true, uses lightweight ping method for health checks.\nIf false, uses listTools method for health checks instead.\n" + }, + "connection_type": { + "type": "string", + "enum": [ + "http", + "stdio", + "sse", + "inprocess" + ], + "description": "Connection type for MCP client" + }, + "auth_type": { + "type": "string", + "enum": [ + "none", + "headers", + "oauth", + "per_user_oauth" + ], + "description": "Authentication type for the MCP connection" + }, + "oauth_config_id": { + "type": "string", + "description": "OAuth config ID for OAuth authentication.\nSet after OAuth flow is completed. References the oauth_configs table.\nOnly relevant when auth_type is \"oauth\".\n" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" + }, + "oauth_config": { + "type": "object", + "description": "OAuth configuration for initiating OAuth flow.\nOnly include this when creating a client with auth_type \"oauth\".\nThis will trigger the OAuth flow and return an authorization URL.\n", + "properties": { + "client_id": { + "type": "string", + "description": "OAuth client ID. Optional if client supports dynamic client registration (RFC 7591).\nIf not provided, the server_url must be set for OAuth discovery and dynamic registration.\n" }, - "types": { + "client_secret": { + "type": "string", + "description": "OAuth client secret. Optional for public clients using PKCE or clients obtained via dynamic registration.\n" + }, + "authorize_url": { + "type": "string", + "description": "OAuth authorization endpoint URL. Optional - will be discovered from server_url if not provided.\n" + }, + "token_url": { + "type": "string", + "description": "OAuth token endpoint URL. Optional - will be discovered from server_url if not provided.\n" + }, + "registration_url": { + "type": "string", + "description": "Dynamic client registration endpoint URL (RFC 7591). Optional - will be discovered from server_url if not provided.\n" + }, + "scopes": { "type": "array", - "description": "Plugin types indicating which interfaces the plugin implements", "items": { - "type": "string", - "enum": [ - "llm", - "mcp", - "http", - "observability" - ] - } + "type": "string" + }, + "description": "OAuth scopes requested. Optional - can be discovered from server_url if not provided.\nExample: [\"read\", \"write\"]\n" } - }, - "example": { - "name": "my_custom_plugin", - "status": "active", - "logs": [ - "plugin my_custom_plugin initialized successfully" - ], - "types": [ - "llm", - "http" - ] } }, - "created_at": { - "type": "string", - "format": "date-time" + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" }, - "version": { - "type": "integer", - "format": "int16" + "tools_to_auto_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" }, - "updated_at": { + "allow_on_all_virtual_keys": { + "type": "boolean", + "default": false, + "description": "When true, this MCP client's tools are available to all virtual keys by default,\nwithout requiring an explicit virtual key assignment.\nAn explicit virtual key config always overrides this setting for that key.\n" + } + } + }, + { + "type": "object", + "required": [ + "connection_string" + ], + "properties": { + "connection_type": { "type": "string", - "format": "date-time" + "enum": [ + "sse" + ] }, - "config_hash": { - "type": "string" + "connection_string": { + "type": "string", + "description": "SSE URL (required for SSE connection type)" } - }, - "example": { - "name": "my_custom_plugin", - "actualName": "MyCustomPlugin", - "enabled": true, - "config": { - "api_key": "xxx" + } + } + ] + }, + { + "allOf": [ + { + "type": "object", + "required": [ + "name", + "connection_type" + ], + "properties": { + "client_id": { + "type": "string", + "description": "Unique identifier for the MCP client (optional, auto-generated if not provided)" }, - "isCustom": true, - "path": "/plugins/my_custom_plugin.so", - "status": { - "name": "my_custom_plugin", - "status": "active", - "logs": [ - "plugin my_custom_plugin initialized successfully" + "name": { + "type": "string", + "description": "Display name for the MCP client" + }, + "is_code_mode_client": { + "type": "boolean" + }, + "is_ping_available": { + "type": "boolean", + "default": true, + "description": "Whether the MCP server supports ping for health checks.\nIf true, uses lightweight ping method for health checks.\nIf false, uses listTools method for health checks instead.\n" + }, + "connection_type": { + "type": "string", + "enum": [ + "http", + "stdio", + "sse", + "inprocess" ], - "types": [ - "llm", - "http" + "description": "Connection type for MCP client" + }, + "auth_type": { + "type": "string", + "enum": [ + "none", + "headers", + "oauth", + "per_user_oauth" + ], + "description": "Authentication type for the MCP connection" + }, + "oauth_config_id": { + "type": "string", + "description": "OAuth config ID for OAuth authentication.\nSet after OAuth flow is completed. References the oauth_configs table.\nOnly relevant when auth_type is \"oauth\".\n" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" + }, + "oauth_config": { + "type": "object", + "description": "OAuth configuration for initiating OAuth flow.\nOnly include this when creating a client with auth_type \"oauth\".\nThis will trigger the OAuth flow and return an authorization URL.\n", + "properties": { + "client_id": { + "type": "string", + "description": "OAuth client ID. Optional if client supports dynamic client registration (RFC 7591).\nIf not provided, the server_url must be set for OAuth discovery and dynamic registration.\n" + }, + "client_secret": { + "type": "string", + "description": "OAuth client secret. Optional for public clients using PKCE or clients obtained via dynamic registration.\n" + }, + "authorize_url": { + "type": "string", + "description": "OAuth authorization endpoint URL. Optional - will be discovered from server_url if not provided.\n" + }, + "token_url": { + "type": "string", + "description": "OAuth token endpoint URL. Optional - will be discovered from server_url if not provided.\n" + }, + "registration_url": { + "type": "string", + "description": "Dynamic client registration endpoint URL (RFC 7591). Optional - will be discovered from server_url if not provided.\n" + }, + "scopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "OAuth scopes requested. Optional - can be discovered from server_url if not provided.\nExample: [\"read\", \"write\"]\n" + } + } + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" + }, + "tools_to_auto_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" + }, + "allow_on_all_virtual_keys": { + "type": "boolean", + "default": false, + "description": "When true, this MCP client's tools are available to all virtual keys by default,\nwithout requiring an explicit virtual key assignment.\nAn explicit virtual key config always overrides this setting for that key.\n" + } + } + }, + { + "type": "object", + "required": [ + "stdio_config" + ], + "properties": { + "connection_type": { + "type": "string", + "enum": [ + "stdio" ] + }, + "stdio_config": { + "type": "object", + "description": "STDIO configuration (required for STDIO connection type)", + "properties": { + "command": { + "type": "string", + "description": "Executable command to run" + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Command line arguments" + }, + "envs": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Environment variables required" + } + } } } } + ] + } + ], + "discriminator": { + "propertyName": "connection_type", + "mapping": { + "http": "#/MCPClientCreateRequestHTTP", + "sse": "#/MCPClientCreateRequestSSE", + "stdio": "#/MCPClientCreateRequestSTDIO" + } + }, + "description": "MCP client configuration for creating a new client (tool_pricing not available at creation).\nThe schema varies based on connection_type:\n- HTTP/SSE: connection_string is required\n- STDIO: stdio_config is required\n- InProcess: server instance must be provided programmatically (Go package only)\n" + } + } + } + }, + "responses": { + "200": { + "description": "MCP client added successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Generic success response", + "properties": { + "status": { + "type": "string", + "example": "success" }, - "count": { - "type": "integer" + "message": { + "type": "string", + "example": "Operation completed successfully" } } } } } }, - "500": { - "description": "Internal server error", + "400": { + "description": "Bad request", "content": { "application/json": { "schema": { @@ -152774,209 +151692,35 @@ } } } - } - } - }, - "post": { - "operationId": "createPlugin", - "summary": "Create a new plugin", - "description": "Creates a new plugin with the specified configuration.", - "tags": [ - "Plugins" - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Create plugin request", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "enabled": { - "type": "boolean" - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "path": { - "type": "string" - } - } - } - } - } - }, - "responses": { - "201": { - "description": "Plugin created successfully", + }, + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { "type": "object", - "description": "Plugin operation response", + "description": "Error response from Bifrost", "properties": { - "message": { + "event_id": { "type": "string" }, - "plugin": { + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { "type": "object", - "description": "Plugin configuration", "properties": { - "id": { - "type": "integer", - "description": "Plugin ID (auto-generated)" - }, - "name": { - "type": "string", - "description": "Display name of the plugin (from config)" + "type": { + "type": "string" }, - "actualName": { - "type": "string", - "description": "Actual plugin name from GetName() (used as map key in plugin status). Only populated for active plugins." - }, - "enabled": { - "type": "boolean" - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "isCustom": { - "type": "boolean" - }, - "path": { - "type": "string" - }, - "status": { - "type": "object", - "description": "Current plugin status including types array (only populated for active plugins)", - "properties": { - "name": { - "type": "string", - "description": "Display name of the plugin" - }, - "status": { - "type": "string", - "enum": [ - "active", - "error", - "disabled", - "loading", - "uninitialized", - "unloaded", - "loaded" - ] - }, - "logs": { - "type": "array", - "items": { - "type": "string" - } - }, - "types": { - "type": "array", - "description": "Plugin types indicating which interfaces the plugin implements", - "items": { - "type": "string", - "enum": [ - "llm", - "mcp", - "http", - "observability" - ] - } - } - }, - "example": { - "name": "my_custom_plugin", - "status": "active", - "logs": [ - "plugin my_custom_plugin initialized successfully" - ], - "types": [ - "llm", - "http" - ] - } - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "version": { - "type": "integer", - "format": "int16" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string" - } - }, - "example": { - "name": "my_custom_plugin", - "actualName": "MyCustomPlugin", - "enabled": true, - "config": { - "api_key": "xxx" - }, - "isCustom": true, - "path": "/plugins/my_custom_plugin.so", - "status": { - "name": "my_custom_plugin", - "status": "active", - "logs": [ - "plugin my_custom_plugin initialized successfully" - ], - "types": [ - "llm", - "http" - ] - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" + "code": { + "type": "string" }, "message": { "type": "string" @@ -153033,9 +151777,189 @@ } } } + } + } + } + }, + "/api/mcp/client/{id}": { + "put": { + "operationId": "editMCPClient", + "summary": "Edit MCP client", + "description": "Updates an existing MCP client's configuration.\nUnlike client creation, tool_pricing can be included to set per-tool execution costs since tools are already fetched.\nOptionally provide vk_configs to manage which virtual keys have access to this MCP server and with which tools. When provided, this fully replaces all existing VK assignments in a single atomic transaction.\n", + "tags": [ + "MCP" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "MCP client ID", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "MCP client configuration for updating an existing client (includes tool_pricing)", + "properties": { + "client_id": { + "type": "string", + "description": "Unique identifier for the MCP client" + }, + "name": { + "type": "string", + "description": "Display name for the MCP client" + }, + "is_code_mode_client": { + "type": "boolean", + "description": "Whether this client is available in code mode" + }, + "connection_type": { + "type": "string", + "enum": [ + "http", + "stdio", + "sse", + "inprocess" + ], + "description": "Connection type for MCP client" + }, + "connection_string": { + "type": "string", + "description": "HTTP or SSE URL (required for HTTP or SSE connections)" + }, + "stdio_config": { + "type": "object", + "description": "STDIO configuration for MCP client", + "properties": { + "command": { + "type": "string", + "description": "Executable command to run" + }, + "args": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Command line arguments" + }, + "envs": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Environment variables required" + } + } + }, + "auth_type": { + "type": "string", + "enum": [ + "none", + "headers", + "oauth", + "per_user_oauth" + ], + "description": "Authentication type for the MCP connection" + }, + "oauth_config_id": { + "type": "string", + "description": "OAuth config ID for OAuth authentication.\nReferences the oauth_configs table.\nOnly relevant when auth_type is \"oauth\".\n" + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" + }, + "tools_to_auto_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" + }, + "tool_pricing": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + }, + "description": "Per-tool cost in USD for execution.\nKey is the tool name, value is the cost per execution.\nExample: {\"read_file\": 0.001, \"write_file\": 0.002}\nNote: Only available when updating an existing client after tools have been fetched.\n" + }, + "allow_on_all_virtual_keys": { + "type": "boolean", + "default": false, + "description": "When true, this MCP client's tools are accessible to all virtual keys without requiring\nexplicit per-key assignment. All tools are allowed by default. If a virtual key has an\nexplicit MCP config for this client, that config takes precedence and overrides this behaviour.\n" + }, + "vk_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Per-virtual-key tool access configuration for an MCP client", + "required": [ + "virtual_key_id", + "tools_to_execute" + ], + "properties": { + "virtual_key_id": { + "type": "string", + "description": "ID of the virtual key" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Tools this virtual key is allowed to call on this MCP server.\n[\"*\"] => all tools allowed\n[\"tool1\", \"tool2\"] => only the specified tools\n" + } + } + }, + "description": "When provided, replaces all virtual key assignments for this MCP client.\nEach entry specifies a virtual key and the tools it is allowed to call.\nTo remove all VK access, provide an empty array [].\nOmit this field to leave existing VK assignments unchanged.\n" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "MCP client updated successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Generic success response", + "properties": { + "status": { + "type": "string", + "example": "success" + }, + "message": { + "type": "string", + "example": "Operation completed successfully" + } + } + } + } + } }, - "409": { - "description": "Plugin already exists", + "400": { + "description": "Bad request", "content": { "application/json": { "schema": { @@ -153205,22 +152129,20 @@ } } } - } - }, - "/api/plugins/{name}": { - "get": { - "operationId": "getPlugin", - "summary": "Get a specific plugin", - "description": "Returns the configuration for a specific plugin.\nThe response includes the plugin status with types array showing which interfaces\nthe plugin implements (llm, mcp, http). The `actualName` field shows the plugin name\nfrom GetName() (used as the map key), which may differ from the display name (`name`).\n", + }, + "delete": { + "operationId": "removeMCPClient", + "summary": "Remove MCP client", + "description": "Removes an MCP client from the configuration.", "tags": [ - "Plugins" + "MCP" ], "parameters": [ { - "name": "name", + "name": "id", "in": "path", "required": true, - "description": "Plugin display name (the config field `name`, not the internal `actualName` from GetName())", + "description": "MCP client ID", "schema": { "type": "string" } @@ -153228,125 +152150,20 @@ ], "responses": { "200": { - "description": "Successful response", + "description": "MCP client removed successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "Plugin configuration", + "description": "Generic success response", "properties": { - "id": { - "type": "integer", - "description": "Plugin ID (auto-generated)" - }, - "name": { - "type": "string", - "description": "Display name of the plugin (from config)" - }, - "actualName": { - "type": "string", - "description": "Actual plugin name from GetName() (used as map key in plugin status). Only populated for active plugins." - }, - "enabled": { - "type": "boolean" - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "isCustom": { - "type": "boolean" - }, - "path": { - "type": "string" - }, "status": { - "type": "object", - "description": "Current plugin status including types array (only populated for active plugins)", - "properties": { - "name": { - "type": "string", - "description": "Display name of the plugin" - }, - "status": { - "type": "string", - "enum": [ - "active", - "error", - "disabled", - "loading", - "uninitialized", - "unloaded", - "loaded" - ] - }, - "logs": { - "type": "array", - "items": { - "type": "string" - } - }, - "types": { - "type": "array", - "description": "Plugin types indicating which interfaces the plugin implements", - "items": { - "type": "string", - "enum": [ - "llm", - "mcp", - "http", - "observability" - ] - } - } - }, - "example": { - "name": "my_custom_plugin", - "status": "active", - "logs": [ - "plugin my_custom_plugin initialized successfully" - ], - "types": [ - "llm", - "http" - ] - } - }, - "created_at": { "type": "string", - "format": "date-time" - }, - "version": { - "type": "integer", - "format": "int16" + "example": "success" }, - "updated_at": { + "message": { "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string" - } - }, - "example": { - "name": "my_custom_plugin", - "actualName": "MyCustomPlugin", - "enabled": true, - "config": { - "api_key": "xxx" - }, - "isCustom": true, - "path": "/plugins/my_custom_plugin.so", - "status": { - "name": "my_custom_plugin", - "status": "active", - "logs": [ - "plugin my_custom_plugin initialized successfully" - ], - "types": [ - "llm", - "http" - ] + "example": "Operation completed successfully" } } } @@ -153438,8 +152255,8 @@ } } }, - "404": { - "description": "Plugin not found", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { @@ -153522,9 +152339,53 @@ } } } + } + } + } + }, + "/api/mcp/client/{id}/reconnect": { + "post": { + "operationId": "reconnectMCPClient", + "summary": "Reconnect MCP client", + "description": "Reconnects an MCP client that is in an error or disconnected state.", + "tags": [ + "MCP" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "MCP client ID", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "MCP client reconnected successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Generic success response", + "properties": { + "status": { + "type": "string", + "example": "success" + }, + "message": { + "type": "string", + "example": "Operation completed successfully" + } + } + } + } + } }, - "500": { - "description": "Internal server error", + "400": { + "description": "Bad request", "content": { "application/json": { "schema": { @@ -153607,188 +152468,9 @@ } } } - } - } - }, - "put": { - "operationId": "updatePlugin", - "summary": "Update a plugin", - "description": "Updates a plugin's configuration. Will reload or stop the plugin based on enabled status.\nThe response `actualName` field shows the plugin name from GetName() (used as the map key),\nwhich may differ from the display name (`name`).\n", - "tags": [ - "Plugins" - ], - "parameters": [ - { - "name": "name", - "in": "path", - "required": true, - "description": "Plugin display name (the config field `name`, not the internal `actualName` from GetName())", - "schema": { - "type": "string" - } - } - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Update plugin request", - "properties": { - "enabled": { - "type": "boolean" - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "path": { - "type": "string" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Plugin updated successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Plugin operation response", - "properties": { - "message": { - "type": "string" - }, - "plugin": { - "type": "object", - "description": "Plugin configuration", - "properties": { - "id": { - "type": "integer", - "description": "Plugin ID (auto-generated)" - }, - "name": { - "type": "string", - "description": "Display name of the plugin (from config)" - }, - "actualName": { - "type": "string", - "description": "Actual plugin name from GetName() (used as map key in plugin status). Only populated for active plugins." - }, - "enabled": { - "type": "boolean" - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "isCustom": { - "type": "boolean" - }, - "path": { - "type": "string" - }, - "status": { - "type": "object", - "description": "Current plugin status including types array (only populated for active plugins)", - "properties": { - "name": { - "type": "string", - "description": "Display name of the plugin" - }, - "status": { - "type": "string", - "enum": [ - "active", - "error", - "disabled", - "loading", - "uninitialized", - "unloaded", - "loaded" - ] - }, - "logs": { - "type": "array", - "items": { - "type": "string" - } - }, - "types": { - "type": "array", - "description": "Plugin types indicating which interfaces the plugin implements", - "items": { - "type": "string", - "enum": [ - "llm", - "mcp", - "http", - "observability" - ] - } - } - }, - "example": { - "name": "my_custom_plugin", - "status": "active", - "logs": [ - "plugin my_custom_plugin initialized successfully" - ], - "types": [ - "llm", - "http" - ] - } - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "version": { - "type": "integer", - "format": "int16" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string" - } - }, - "example": { - "name": "my_custom_plugin", - "actualName": "MyCustomPlugin", - "enabled": true, - "config": { - "api_key": "xxx" - }, - "isCustom": true, - "path": "/plugins/my_custom_plugin.so", - "status": { - "name": "my_custom_plugin", - "status": "active", - "logs": [ - "plugin my_custom_plugin initialized successfully" - ], - "types": [ - "llm", - "http" - ] - } - } - } - } - } - } - } }, - "400": { - "description": "Bad request", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { @@ -153871,192 +152553,94 @@ } } } + } + } + } + }, + "/api/oauth/callback": { + "get": { + "operationId": "handleOAuthCallback", + "summary": "OAuth callback endpoint", + "description": "Handles the OAuth provider callback after user authorization.\nThis endpoint processes the authorization code and exchanges it for an access token.\nOn success, displays an HTML page that closes the authorization window.\n", + "tags": [ + "OAuth" + ], + "parameters": [ + { + "name": "state", + "in": "query", + "required": true, + "description": "State parameter for OAuth security (CSRF protection)", + "schema": { + "type": "string" + } }, - "404": { - "description": "Plugin not found", + { + "name": "code", + "in": "query", + "required": true, + "description": "Authorization code from the OAuth provider", + "schema": { + "type": "string" + } + }, + { + "name": "error", + "in": "query", + "required": false, + "description": "Error code if authorization failed", + "schema": { + "type": "string" + } + }, + { + "name": "error_description", + "in": "query", + "required": false, + "description": "Error description if authorization failed", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OAuth authorization successful. Returns HTML page that closes the authorization window.", "content": { - "application/json": { + "text/html": { "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } + "type": "string" } } } }, - "500": { - "description": "Internal server error", + "400": { + "description": "OAuth authorization failed or missing required parameters", "content": { - "application/json": { + "text/html": { "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } + "type": "string" } } } } } - }, - "delete": { - "operationId": "deletePlugin", - "summary": "Delete a plugin", - "description": "Removes a plugin from the configuration and stops it if running.", + } + }, + "/api/oauth/config/{id}/status": { + "get": { + "operationId": "getOAuthConfigStatus", + "summary": "Get OAuth config status", + "description": "Retrieves the current status of an OAuth configuration.\nShows whether the OAuth flow is pending, authorized, or failed,\nand includes token expiration and scopes if authorized.\n", "tags": [ - "Plugins" + "OAuth" ], "parameters": [ { - "name": "name", + "name": "id", "in": "path", "required": true, - "description": "Plugin display name (the config field `name`, not the internal `actualName` from GetName())", + "description": "OAuth config ID", "schema": { "type": "string" } @@ -154064,28 +152648,64 @@ ], "responses": { "200": { - "description": "Plugin deleted successfully", + "description": "OAuth config status retrieved successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "Simple message response", + "description": "Status of an OAuth configuration", "properties": { - "message": { - "type": "string" + "id": { + "type": "string", + "description": "OAuth config ID" + }, + "status": { + "type": "string", + "enum": [ + "pending", + "authorized", + "failed" + ], + "description": "Current status of the OAuth flow:\n- pending: User has not yet authorized\n- authorized: User authorized and token is stored\n- failed: Authorization failed\n" + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "When this OAuth config was created" + }, + "expires_at": { + "type": "string", + "format": "date-time", + "description": "When this OAuth config expires (becomes invalid if not completed)" + }, + "token_id": { + "type": "string", + "description": "ID of the associated OAuth token (only present if status is authorized)" + }, + "token_expires_at": { + "type": "string", + "format": "date-time", + "description": "When the OAuth access token expires (only present if status is authorized)" + }, + "token_scopes": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Scopes granted in the OAuth token (only present if status is authorized)" } } } } } }, - "400": { - "description": "Bad request", + "404": { + "description": "OAuth config not found", "content": { "application/json": { "schema": { "type": "object", - "description": "Error response from Bifrost", + "description": "Error response", "properties": { "event_id": { "type": "string" @@ -154164,8 +152784,8 @@ } } }, - "404": { - "description": "Plugin not found", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { @@ -154248,6 +152868,48 @@ } } } + } + } + }, + "delete": { + "operationId": "revokeOAuthConfig", + "summary": "Revoke OAuth config", + "description": "Revokes an OAuth configuration and its associated access token.\nAfter revocation, the MCP client will no longer be able to use this OAuth token.\n", + "tags": [ + "OAuth" + ], + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "description": "OAuth config ID", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "OAuth token revoked successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Generic success response", + "properties": { + "status": { + "type": "string", + "example": "success" + }, + "message": { + "type": "string", + "example": "Operation completed successfully" + } + } + } + } + } }, "500": { "description": "Internal server error", @@ -154337,783 +152999,505 @@ } } }, - "/v1/mcp/tool/execute": { - "post": { - "operationId": "executeMCPTool", - "summary": "Execute MCP tool", - "description": "Executes an MCP tool and returns the result.", + "/api/governance/virtual-keys": { + "get": { + "operationId": "listVirtualKeys", + "summary": "List virtual keys", + "description": "Returns a list of all virtual keys with their configurations.", "tags": [ - "MCP" + "Governance" ], "parameters": [ { - "name": "format", + "name": "from_memory", "in": "query", - "required": false, - "description": "Format of the tool execution request/response.\n", + "description": "If true, returns virtual keys from in-memory cache instead of database", "schema": { - "type": "string", - "enum": [ - "chat", - "responses" - ], - "default": "chat" + "type": "boolean", + "default": false } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "type": "object", - "required": [ - "function" - ], - "properties": { - "index": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "id": { - "type": "string" - }, - "function": { + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "List virtual keys response", + "properties": { + "virtual_keys": { + "type": "array", + "items": { "type": "object", + "description": "Virtual key configuration", "properties": { + "id": { + "type": "string" + }, "name": { "type": "string" }, - "arguments": { + "value": { "type": "string" - } - } - } - }, - "title": "Chat (Default)", - "description": "Chat format - uses ChatAssistantMessageToolCall schema" - }, - { - "type": "object", - "description": "Responses format - uses ResponsesToolMessage schema", - "required": [ - "name" - ], - "properties": { - "call_id": { - "type": "string", - "description": "Common call ID for tool calls and outputs" - }, - "name": { - "type": "string", - "description": "Tool function name (required for execution)" - }, - "arguments": { - "type": "string", - "description": "Tool function arguments as JSON string" - }, - "output": { - "type": "object", - "description": "Tool execution output", - "additionalProperties": true - }, - "action": { - "type": "object", - "description": "Tool action configuration", - "additionalProperties": true - }, - "error": { - "type": "string", - "description": "Error message if tool execution failed" - } - }, - "title": "Responses" - } - ], - "description": "MCP tool execution request. The schema depends on the `format` query parameter:\n- `format=chat` or empty (default): Use `ChatAssistantMessageToolCall` schema\n- `format=responses`: Use `ResponsesToolMessage` schema\n" - }, - "examples": { - "chat": { - "summary": "Chat format example", - "value": { - "id": "call_123", - "type": "function", - "function": { - "name": "get_weather", - "arguments": "{\"location\": \"San Francisco\"}" - } - } - }, - "responses": { - "summary": "Responses format example", - "value": { - "call_id": "call_123", - "name": "get_weather", - "arguments": "{\"location\": \"San Francisco\"}" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Tool executed successfully", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "type": "object", - "required": [ - "role" - ], - "properties": { - "role": { - "type": "string", - "enum": [ - "assistant", - "user", - "system", - "tool", - "developer" - ] - }, - "name": { - "type": "string" - }, - "content": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "text", - "image_url", - "input_audio", - "file", - "refusal" - ] - }, - "text": { - "type": "string" - }, - "refusal": { + }, + "description": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { "type": "string" - }, - "image_url": { - "type": "object", - "required": [ - "url" - ], - "properties": { - "url": { - "type": "string" - }, - "detail": { - "type": "string", - "enum": [ - "low", - "high", - "auto" - ] - } + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "input_audio": { - "type": "object", - "required": [ - "data" - ], - "properties": { - "data": { - "type": "string" - }, - "format": { - "type": "string" - } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "file": { + } + }, + "keys": { + "type": "array", + "items": { "type": "object", + "description": "Table key configuration", "properties": { - "file_data": { - "type": "string" + "id": { + "type": "integer" }, - "file_id": { + "name": { "type": "string" }, - "filename": { + "provider_id": { + "type": "integer" + }, + "provider": { "type": "string" }, - "file_type": { + "key_id": { "type": "string" - } - } - }, - "cache_control": { - "type": "object", - "description": "Cache control settings for content blocks", - "properties": { - "type": { + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { "type": "string", - "enum": [ - "ephemeral" - ] + "format": "date-time" }, - "ttl": { + "updated_at": { "type": "string", - "description": "Time to live (e.g., \"1m\", \"1h\")" - } - } - } - } - } - } - ], - "description": "Message content - can be a string or array of content blocks" - }, - "tool_call_id": { - "type": "string", - "description": "For tool messages" - }, - "refusal": { - "type": "string" - }, - "audio": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "data": { - "type": "string" - }, - "expires_at": { - "type": "integer" - }, - "transcript": { - "type": "string" - } - } - }, - "reasoning": { - "type": "string" - }, - "reasoning_details": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "index": { - "type": "integer" - }, - "type": { - "type": "string", - "enum": [ - "reasoning.summary", - "reasoning.encrypted", - "reasoning.text" - ] - }, - "summary": { - "type": "string" - }, - "text": { - "type": "string" - }, - "signature": { - "type": "string" - }, - "data": { - "type": "string" - } - } - } - }, - "annotations": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "url_citation": { - "type": "object", - "properties": { - "start_index": { - "type": "integer" - }, - "end_index": { - "type": "integer" - }, - "title": { - "type": "string" - }, - "url": { - "type": "string" - }, - "sources": { - "type": "object" - }, - "type": { - "type": "string" - } - } - } - } - } - }, - "tool_calls": { - "type": "array", - "items": { - "type": "object", - "required": [ - "function" - ], - "properties": { - "index": { - "type": "integer" - }, - "type": { - "type": "string" - }, - "id": { - "type": "string" - }, - "function": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "arguments": { - "type": "string" - } - } - } - } - } - } - }, - "title": "Chat (Default)", - "description": "Chat format response" - }, - { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "type": { - "type": "string", - "enum": [ - "message", - "file_search_call", - "computer_call", - "computer_call_output", - "web_search_call", - "web_fetch_call", - "function_call", - "function_call_output", - "code_interpreter_call", - "local_shell_call", - "local_shell_call_output", - "mcp_call", - "custom_tool_call", - "custom_tool_call_output", - "image_generation_call", - "mcp_list_tools", - "mcp_approval_request", - "mcp_approval_responses", - "reasoning", - "item_reference", - "refusal" - ] - }, - "status": { - "type": "string", - "enum": [ - "in_progress", - "completed", - "incomplete", - "interpreting", - "failed" - ] - }, - "role": { - "type": "string", - "enum": [ - "assistant", - "user", - "system", - "developer" - ] - }, - "content": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "items": { - "type": "object", - "required": [ - "type" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "input_text", - "input_image", - "input_file", - "input_audio", - "output_text", - "refusal", - "reasoning_text" - ] - }, - "file_id": { - "type": "string" - }, - "text": { - "type": "string" - }, - "signature": { - "type": "string" - }, - "image_url": { - "type": "string" - }, - "detail": { - "type": "string" - }, - "file_data": { - "type": "string" - }, - "file_url": { - "type": "string" - }, - "filename": { - "type": "string" - }, - "file_type": { - "type": "string" - }, - "input_audio": { - "type": "object", - "required": [ - "format", - "data" - ], - "properties": { - "format": { + "format": "date-time" + }, + "config_hash": { "type": "string", - "enum": [ - "mp3", - "wav" - ] + "nullable": true }, - "data": { - "type": "string" - } - } - }, - "annotations": { - "type": "array", - "items": { - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "file_citation", - "url_citation", - "container_file_citation", - "file_path" - ] + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "index": { - "type": "integer" + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "file_id": { - "type": "string" + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "text": { - "type": "string" + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "start_index": { - "type": "integer" + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "end_index": { - "type": "integer" + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "filename": { - "type": "string" + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "title": { - "type": "string" + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "url": { - "type": "string" + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "container_id": { - "type": "string" - } - } - } - }, - "logprobs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bytes": { - "type": "array", - "items": { - "type": "integer" + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" } }, - "logprob": { - "type": "number" + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "token": { - "type": "string" + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "top_logprobs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "bytes": { - "type": "array", - "items": { - "type": "integer" - } - }, - "logprob": { - "type": "number" - }, - "token": { - "type": "string" - } - } + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" } - } - } - } - }, - "refusal": { - "type": "string" - }, - "cache_control": { - "type": "object", - "description": "Cache control settings for content blocks", - "properties": { - "type": { - "type": "string", - "enum": [ - "ephemeral" - ] + }, + "nullable": true }, - "ttl": { - "type": "string", - "description": "Time to live (e.g., \"1m\", \"1h\")" + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true } } } } } } - ] - }, - "call_id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "arguments": { - "type": "string" - }, - "output": { - "type": "object" - }, - "action": { - "type": "object" - }, - "error": { - "type": "string" - }, - "queries": { - "type": "array", - "items": { - "type": "string" - } - }, - "results": { - "type": "array", - "items": { - "type": "object" + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } } - }, - "summary": { - "type": "array", - "items": { - "type": "object", - "required": [ - "type", - "text" - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "summary_text" - ] - }, - "text": { - "type": "string" - } - } - } - }, - "encrypted_content": { - "type": "string" - } - }, - "title": "Responses", - "description": "Responses format response" - } - ], - "description": "MCP tool execution response.\n" - }, - "examples": { - "chat": { - "summary": "Chat format response", - "value": { - "name": "get_weather", - "role": "tool", - "tool_call_id": "call_123", - "content": "The weather in San Francisco is 72°F and sunny." - } - }, - "responses": { - "summary": "Responses format response", - "value": { - "id": "msg_123", - "type": "function_call_output", - "status": "completed", - "role": "assistant", - "call_id": "call_123", - "name": "get_weather", - "arguments": "{\"location\": \"San Francisco\"}", - "content": "The weather in San Francisco is 72°F and sunny." - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" } } }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } + "count": { + "type": "integer" } } } @@ -155206,735 +153590,651 @@ } } } - } - }, - "/api/mcp/clients": { - "get": { - "operationId": "getMCPClients", - "summary": "List MCP clients", - "description": "Returns a list of all configured MCP clients with their tools and connection state.", + }, + "post": { + "operationId": "createVirtualKey", + "summary": "Create virtual key", + "description": "Creates a new virtual key with the specified configuration.", "tags": [ - "MCP" + "Governance" ], - "responses": { - "200": { - "description": "Successful response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "type": "object", - "description": "Connected MCP client with its tools", - "properties": { - "config": { - "type": "object", - "description": "Full MCP client configuration (used in responses)", - "properties": { - "client_id": { - "type": "string", - "description": "Unique identifier for the MCP client" - }, - "name": { - "type": "string", - "description": "Display name for the MCP client" - }, - "is_code_mode_client": { - "type": "boolean", - "description": "Whether this client is available in code mode" - }, - "connection_type": { - "type": "string", - "enum": [ - "http", - "stdio", - "sse", - "inprocess" - ], - "description": "Connection type for MCP client" - }, - "connection_string": { - "type": "string", - "description": "HTTP or SSE URL (required for HTTP or SSE connections)" - }, - "stdio_config": { - "type": "object", - "description": "STDIO configuration for MCP client", - "properties": { - "command": { - "type": "string", - "description": "Executable command to run" - }, - "args": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Command line arguments" - }, - "envs": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Environment variables required" - } - } - }, - "auth_type": { - "type": "string", - "enum": [ - "none", - "headers", - "oauth", - "per_user_oauth" - ], - "description": "Authentication type for the MCP connection" - }, - "oauth_config_id": { - "type": "string", - "description": "OAuth config ID for OAuth authentication.\nReferences the oauth_configs table.\nOnly set when auth_type is \"oauth\".\n" - }, - "headers": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" - }, - "tools_to_auto_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" - }, - "tool_pricing": { - "type": "object", - "additionalProperties": { - "type": "number", - "format": "double" - }, - "description": "Per-tool cost in USD for execution.\nKey is the tool name, value is the cost per execution.\nExample: {\"read_file\": 0.001, \"write_file\": 0.002}\n" - }, - "allow_on_all_virtual_keys": { - "type": "boolean", - "default": false, - "description": "When true, this MCP client's tools are accessible to all virtual keys without requiring\nexplicit per-key assignment. All tools are allowed by default. If a virtual key has an\nexplicit MCP config for this client, that config takes precedence and overrides this behaviour.\n" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Create virtual key request", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "provider_configs": { + "type": "array", + "description": "Provider configurations (empty means no providers allowed, deny-by-default)", + "items": { + "type": "object", + "properties": { + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { + "type": "string" } - } - }, - "tools": { - "type": "array", - "items": { + }, + "budget": { "type": "object", - "description": "Tool function definition", + "description": "Create budget request", + "required": [ + "max_limit", + "reset_duration" + ], "properties": { - "name": { - "type": "string" + "max_limit": { + "type": "number" }, - "description": { + "reset_duration": { "type": "string" }, - "parameters": { - "type": "object", - "additionalProperties": true - }, - "strict": { - "type": "boolean" + "calendar_aligned": { + "type": "boolean", + "default": false, + "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" } } - } - }, - "state": { - "type": "string", - "enum": [ - "connected", - "disconnected", - "error" - ], - "description": "Connection state of an MCP client" - }, - "vk_configs": { - "type": "array", - "items": { + }, + "rate_limit": { "type": "object", - "description": "Per-virtual-key tool access configuration as returned in list/get responses", + "description": "Create rate limit request", "properties": { - "virtual_key_id": { - "type": "string", - "description": "ID of the virtual key" + "token_max_limit": { + "type": "integer", + "format": "int64" }, - "virtual_key_name": { - "type": "string", - "description": "Display name of the virtual key" + "token_reset_duration": { + "type": "string" }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Tools this virtual key is allowed to call on this MCP client.\n[\"*\"] => all tools allowed\n[\"tool1\", \"tool2\"] => only the specified tools\n" + "request_max_limit": { + "type": "integer", + "format": "int64" + }, + "request_reset_duration": { + "type": "string" } } }, - "description": "Virtual key assignments for this MCP client" + "key_ids": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "mcp_configs": { + "type": "array", + "description": "MCP configurations (empty means no MCP tools allowed, deny-by-default)", + "items": { + "type": "object", + "properties": { + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "team_id": { + "type": "string" + }, + "customer_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Create budget request", + "required": [ + "max_limit", + "reset_duration" + ], + "properties": { + "max_limit": { + "type": "number" + }, + "reset_duration": { + "type": "string" + }, + "calendar_aligned": { + "type": "boolean", + "default": false, + "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Create rate limit request", + "properties": { + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "request_max_limit": { + "type": "integer", + "format": "int64" + }, + "request_reset_duration": { + "type": "string" } } + }, + "is_active": { + "type": "boolean" } } } } - }, - "500": { - "description": "Internal server error", + } + }, + "responses": { + "200": { + "description": "Virtual key created successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "Error response from Bifrost", + "description": "Virtual key operation response", "properties": { - "event_id": { - "type": "string" - }, - "type": { + "message": { "type": "string" }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { + "virtual_key": { "type": "object", + "description": "Virtual key configuration", "properties": { - "type": { + "id": { "type": "string" }, - "code": { + "name": { "type": "string" }, - "message": { + "value": { "type": "string" }, - "param": { + "description": { "type": "string" }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] + "is_active": { + "type": "boolean" }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - }, - "/api/mcp/client": { - "post": { - "operationId": "addMCPClient", - "summary": "Add MCP client", - "description": "Adds a new MCP client with the specified configuration.\nNote: tool_pricing is not available when creating a new client as tools are fetched after client creation.\n", - "tags": [ - "MCP" - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "allOf": [ - { - "type": "object", - "required": [ - "name", - "connection_type" - ], - "properties": { - "client_id": { - "type": "string", - "description": "Unique identifier for the MCP client (optional, auto-generated if not provided)" - }, - "name": { - "type": "string", - "description": "Display name for the MCP client" - }, - "is_code_mode_client": { - "type": "boolean" - }, - "is_ping_available": { - "type": "boolean", - "default": true, - "description": "Whether the MCP server supports ping for health checks.\nIf true, uses lightweight ping method for health checks.\nIf false, uses listTools method for health checks instead.\n" - }, - "connection_type": { - "type": "string", - "enum": [ - "http", - "stdio", - "sse", - "inprocess" - ], - "description": "Connection type for MCP client" - }, - "auth_type": { - "type": "string", - "enum": [ - "none", - "headers", - "oauth", - "per_user_oauth" - ], - "description": "Authentication type for the MCP connection" - }, - "oauth_config_id": { - "type": "string", - "description": "OAuth config ID for OAuth authentication.\nSet after OAuth flow is completed. References the oauth_configs table.\nOnly relevant when auth_type is \"oauth\".\n" - }, - "headers": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" - }, - "oauth_config": { - "type": "object", - "description": "OAuth configuration for initiating OAuth flow.\nOnly include this when creating a client with auth_type \"oauth\".\nThis will trigger the OAuth flow and return an authorization URL.\n", - "properties": { - "client_id": { - "type": "string", - "description": "OAuth client ID. Optional if client supports dynamic client registration (RFC 7591).\nIf not provided, the server_url must be set for OAuth discovery and dynamic registration.\n" - }, - "client_secret": { - "type": "string", - "description": "OAuth client secret. Optional for public clients using PKCE or clients obtained via dynamic registration.\n" - }, - "authorize_url": { - "type": "string", - "description": "OAuth authorization endpoint URL. Optional - will be discovered from server_url if not provided.\n" - }, - "token_url": { - "type": "string", - "description": "OAuth token endpoint URL. Optional - will be discovered from server_url if not provided.\n" - }, - "registration_url": { - "type": "string", - "description": "Dynamic client registration endpoint URL (RFC 7591). Optional - will be discovered from server_url if not provided.\n" - }, - "scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "OAuth scopes requested. Optional - can be discovered from server_url if not provided.\nExample: [\"read\", \"write\"]\n" - } - } - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" - }, - "tools_to_auto_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" - }, - "allow_on_all_virtual_keys": { - "type": "boolean", - "default": false, - "description": "When true, this MCP client's tools are available to all virtual keys by default,\nwithout requiring an explicit virtual key assignment.\nAn explicit virtual key config always overrides this setting for that key.\n" - } - } - }, - { - "type": "object", - "required": [ - "connection_string" - ], - "properties": { - "connection_type": { - "type": "string", - "enum": [ - "http" - ] - }, - "connection_string": { - "type": "string", - "description": "HTTP URL (required for HTTP connection type)" - } - } - } - ] - }, - { - "allOf": [ - { - "type": "object", - "required": [ - "name", - "connection_type" - ], - "properties": { - "client_id": { - "type": "string", - "description": "Unique identifier for the MCP client (optional, auto-generated if not provided)" - }, - "name": { - "type": "string", - "description": "Display name for the MCP client" - }, - "is_code_mode_client": { - "type": "boolean" - }, - "is_ping_available": { - "type": "boolean", - "default": true, - "description": "Whether the MCP server supports ping for health checks.\nIf true, uses lightweight ping method for health checks.\nIf false, uses listTools method for health checks instead.\n" - }, - "connection_type": { - "type": "string", - "enum": [ - "http", - "stdio", - "sse", - "inprocess" - ], - "description": "Connection type for MCP client" - }, - "auth_type": { - "type": "string", - "enum": [ - "none", - "headers", - "oauth", - "per_user_oauth" - ], - "description": "Authentication type for the MCP connection" - }, - "oauth_config_id": { - "type": "string", - "description": "OAuth config ID for OAuth authentication.\nSet after OAuth flow is completed. References the oauth_configs table.\nOnly relevant when auth_type is \"oauth\".\n" - }, - "headers": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" - }, - "oauth_config": { + "provider_configs": { + "type": "array", + "items": { "type": "object", - "description": "OAuth configuration for initiating OAuth flow.\nOnly include this when creating a client with auth_type \"oauth\".\nThis will trigger the OAuth flow and return an authorization URL.\n", + "description": "Provider configuration for a virtual key", "properties": { - "client_id": { - "type": "string", - "description": "OAuth client ID. Optional if client supports dynamic client registration (RFC 7591).\nIf not provided, the server_url must be set for OAuth discovery and dynamic registration.\n" - }, - "client_secret": { - "type": "string", - "description": "OAuth client secret. Optional for public clients using PKCE or clients obtained via dynamic registration.\n" + "id": { + "type": "integer" }, - "authorize_url": { - "type": "string", - "description": "OAuth authorization endpoint URL. Optional - will be discovered from server_url if not provided.\n" + "virtual_key_id": { + "type": "string" }, - "token_url": { - "type": "string", - "description": "OAuth token endpoint URL. Optional - will be discovered from server_url if not provided.\n" + "provider": { + "type": "string" }, - "registration_url": { - "type": "string", - "description": "Dynamic client registration endpoint URL (RFC 7591). Optional - will be discovered from server_url if not provided.\n" + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." }, - "scopes": { + "allowed_models": { "type": "array", "items": { "type": "string" - }, - "description": "OAuth scopes requested. Optional - can be discovered from server_url if not provided.\nExample: [\"read\", \"write\"]\n" - } - } - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" - }, - "tools_to_auto_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" - }, - "allow_on_all_virtual_keys": { - "type": "boolean", - "default": false, - "description": "When true, this MCP client's tools are available to all virtual keys by default,\nwithout requiring an explicit virtual key assignment.\nAn explicit virtual key config always overrides this setting for that key.\n" - } - } - }, - { - "type": "object", - "required": [ - "connection_string" - ], - "properties": { - "connection_type": { - "type": "string", - "enum": [ - "sse" - ] - }, - "connection_string": { - "type": "string", - "description": "SSE URL (required for SSE connection type)" - } - } - } - ] - }, - { - "allOf": [ - { - "type": "object", - "required": [ - "name", - "connection_type" - ], - "properties": { - "client_id": { - "type": "string", - "description": "Unique identifier for the MCP client (optional, auto-generated if not provided)" - }, - "name": { - "type": "string", - "description": "Display name for the MCP client" - }, - "is_code_mode_client": { - "type": "boolean" - }, - "is_ping_available": { - "type": "boolean", - "default": true, - "description": "Whether the MCP server supports ping for health checks.\nIf true, uses lightweight ping method for health checks.\nIf false, uses listTools method for health checks instead.\n" - }, - "connection_type": { - "type": "string", - "enum": [ - "http", - "stdio", - "sse", - "inprocess" - ], - "description": "Connection type for MCP client" - }, - "auth_type": { - "type": "string", - "enum": [ - "none", - "headers", - "oauth", - "per_user_oauth" - ], - "description": "Authentication type for the MCP connection" - }, - "oauth_config_id": { - "type": "string", - "description": "OAuth config ID for OAuth authentication.\nSet after OAuth flow is completed. References the oauth_configs table.\nOnly relevant when auth_type is \"oauth\".\n" - }, - "headers": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" - }, - "oauth_config": { - "type": "object", - "description": "OAuth configuration for initiating OAuth flow.\nOnly include this when creating a client with auth_type \"oauth\".\nThis will trigger the OAuth flow and return an authorization URL.\n", - "properties": { - "client_id": { - "type": "string", - "description": "OAuth client ID. Optional if client supports dynamic client registration (RFC 7591).\nIf not provided, the server_url must be set for OAuth discovery and dynamic registration.\n" + } }, - "client_secret": { - "type": "string", - "description": "OAuth client secret. Optional for public clients using PKCE or clients obtained via dynamic registration.\n" + "budget_id": { + "type": "string" }, - "authorize_url": { - "type": "string", - "description": "OAuth authorization endpoint URL. Optional - will be discovered from server_url if not provided.\n" + "rate_limit_id": { + "type": "string" }, - "token_url": { - "type": "string", - "description": "OAuth token endpoint URL. Optional - will be discovered from server_url if not provided.\n" + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "registration_url": { - "type": "string", - "description": "Dynamic client registration endpoint URL (RFC 7591). Optional - will be discovered from server_url if not provided.\n" + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "scopes": { + "keys": { "type": "array", "items": { - "type": "string" - }, - "description": "OAuth scopes requested. Optional - can be discovered from server_url if not provided.\nExample: [\"read\", \"write\"]\n" - } - } - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" - }, - "tools_to_auto_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" - }, - "allow_on_all_virtual_keys": { - "type": "boolean", - "default": false, - "description": "When true, this MCP client's tools are available to all virtual keys by default,\nwithout requiring an explicit virtual key assignment.\nAn explicit virtual key config always overrides this setting for that key.\n" - } - } - }, - { - "type": "object", - "required": [ - "stdio_config" - ], - "properties": { - "connection_type": { - "type": "string", - "enum": [ - "stdio" - ] - }, - "stdio_config": { - "type": "object", - "description": "STDIO configuration (required for STDIO connection type)", - "properties": { - "command": { - "type": "string", - "description": "Executable command to run" + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } + } + } + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" }, - "args": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Command line arguments" + "mcp_client_name": { + "type": "string" }, - "envs": { + "tools_to_execute": { "type": "array", "items": { "type": "string" - }, - "description": "Environment variables required" + } } } } } } - ] - } - ], - "discriminator": { - "propertyName": "connection_type", - "mapping": { - "http": "#/MCPClientCreateRequestHTTP", - "sse": "#/MCPClientCreateRequestSSE", - "stdio": "#/MCPClientCreateRequestSTDIO" - } - }, - "description": "MCP client configuration for creating a new client (tool_pricing not available at creation).\nThe schema varies based on connection_type:\n- HTTP/SSE: connection_string is required\n- STDIO: stdio_config is required\n- InProcess: server instance must be provided programmatically (Go package only)\n" - } - } - } - }, - "responses": { - "200": { - "description": "MCP client added successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Generic success response", - "properties": { - "status": { - "type": "string", - "example": "success" - }, - "message": { - "type": "string", - "example": "Operation completed successfully" } } } @@ -156114,185 +154414,515 @@ } } }, - "/api/mcp/client/{id}": { - "put": { - "operationId": "editMCPClient", - "summary": "Edit MCP client", - "description": "Updates an existing MCP client's configuration.\nUnlike client creation, tool_pricing can be included to set per-tool execution costs since tools are already fetched.\nOptionally provide vk_configs to manage which virtual keys have access to this MCP server and with which tools. When provided, this fully replaces all existing VK assignments in a single atomic transaction.\n", + "/api/governance/virtual-keys/{vk_id}": { + "get": { + "operationId": "getVirtualKey", + "summary": "Get virtual key", + "description": "Returns a specific virtual key by ID.", "tags": [ - "MCP" + "Governance" ], "parameters": [ { - "name": "id", + "name": "vk_id", "in": "path", "required": true, - "description": "MCP client ID", + "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 + } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "MCP client configuration for updating an existing client (includes tool_pricing)", - "properties": { - "client_id": { - "type": "string", - "description": "Unique identifier for the MCP client" - }, - "name": { - "type": "string", - "description": "Display name for the MCP client" - }, - "is_code_mode_client": { - "type": "boolean", - "description": "Whether this client is available in code mode" - }, - "connection_type": { - "type": "string", - "enum": [ - "http", - "stdio", - "sse", - "inprocess" - ], - "description": "Connection type for MCP client" - }, - "connection_string": { - "type": "string", - "description": "HTTP or SSE URL (required for HTTP or SSE connections)" - }, - "stdio_config": { - "type": "object", - "description": "STDIO configuration for MCP client", - "properties": { - "command": { - "type": "string", - "description": "Executable command to run" - }, - "args": { - "type": "array", - "items": { + "responses": { + "200": { + "description": "Successful response", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "virtual_key": { + "type": "object", + "description": "Virtual key configuration", + "properties": { + "id": { "type": "string" }, - "description": "Command line arguments" - }, - "envs": { - "type": "array", - "items": { + "name": { "type": "string" }, - "description": "Environment variables required" - } - } - }, - "auth_type": { - "type": "string", - "enum": [ - "none", - "headers", - "oauth", - "per_user_oauth" - ], - "description": "Authentication type for the MCP connection" - }, - "oauth_config_id": { - "type": "string", - "description": "OAuth config ID for OAuth authentication.\nReferences the oauth_configs table.\nOnly relevant when auth_type is \"oauth\".\n" - }, - "headers": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "Custom headers to include in requests.\nOnly used when auth_type is \"headers\".\n" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Include-only list for tools.\n[\"*\"] => all tools are included\n[] => no tools are included\n[\"tool1\", \"tool2\"] => include only the specified tools\n" - }, - "tools_to_auto_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "List of tools that can be auto-executed without user approval.\nMust be a subset of tools_to_execute.\n[\"*\"] => all executable tools can be auto-executed\n[] => no tools are auto-executed\n[\"tool1\", \"tool2\"] => only specified tools can be auto-executed\n" - }, - "tool_pricing": { - "type": "object", - "additionalProperties": { - "type": "number", - "format": "double" - }, - "description": "Per-tool cost in USD for execution.\nKey is the tool name, value is the cost per execution.\nExample: {\"read_file\": 0.001, \"write_file\": 0.002}\nNote: Only available when updating an existing client after tools have been fetched.\n" - }, - "allow_on_all_virtual_keys": { - "type": "boolean", - "default": false, - "description": "When true, this MCP client's tools are accessible to all virtual keys without requiring\nexplicit per-key assignment. All tools are allowed by default. If a virtual key has an\nexplicit MCP config for this client, that config takes precedence and overrides this behaviour.\n" - }, - "vk_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Per-virtual-key tool access configuration for an MCP client", - "required": [ - "virtual_key_id", - "tools_to_execute" - ], - "properties": { - "virtual_key_id": { - "type": "string", - "description": "ID of the virtual key" + "value": { + "type": "string" }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Tools this virtual key is allowed to call on this MCP server.\n[\"*\"] => all tools allowed\n[\"tool1\", \"tool2\"] => only the specified tools\n" + "description": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } + } + } + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } } } - }, - "description": "When provided, replaces all virtual key assignments for this MCP client.\nEach entry specifies a virtual key and the tools it is allowed to call.\nTo remove all VK access, provide an empty array [].\nOmit this field to leave existing VK assignments unchanged.\n" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "MCP client updated successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Generic success response", - "properties": { - "status": { - "type": "string", - "example": "success" - }, - "message": { - "type": "string", - "example": "Operation completed successfully" } } } } } }, - "400": { - "description": "Bad request", + "404": { + "description": "Virtual key not found", "content": { "application/json": { "schema": { @@ -156463,569 +155093,739 @@ } } }, - "delete": { - "operationId": "removeMCPClient", - "summary": "Remove MCP client", - "description": "Removes an MCP client from the configuration.", + "put": { + "operationId": "updateVirtualKey", + "summary": "Update virtual key", + "description": "Updates an existing virtual key's configuration.", "tags": [ - "MCP" + "Governance" ], "parameters": [ { - "name": "id", + "name": "vk_id", "in": "path", "required": true, - "description": "MCP client ID", + "description": "Virtual key ID", "schema": { "type": "string" } } ], - "responses": { - "200": { - "description": "MCP client removed successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Generic success response", - "properties": { - "status": { - "type": "string", - "example": "success" - }, - "message": { - "type": "string", - "example": "Operation completed successfully" - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Update virtual key request", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "provider_configs": { + "type": "array", + "items": { "type": "object", "properties": { - "type": { - "type": "string" + "id": { + "type": "integer" }, - "code": { + "provider": { "type": "string" }, - "message": { - "type": "string" + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for load balancing. Null means excluded from weighted routing." }, - "param": { - "type": "string" + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] + "budget": { + "type": "object", + "description": "Update budget request", + "properties": { + "max_limit": { + "type": "number" + }, + "reset_duration": { + "type": "string" + }, + "calendar_aligned": { + "type": "boolean", + "nullable": true, + "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" + } + } }, - "model_requested": { - "type": "string" + "rate_limit": { + "type": "object", + "description": "Update rate limit request", + "properties": { + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "request_max_limit": { + "type": "integer", + "format": "int64" + }, + "request_reset_duration": { + "type": "string" + } + } }, - "request_type": { - "type": "string" + "key_ids": { + "type": "array", + "items": { + "type": "string" + } } } } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { + }, + "mcp_configs": { + "type": "array", + "items": { "type": "object", "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" + "id": { + "type": "integer" }, - "param": { + "mcp_client_name": { "type": "string" }, - "event_id": { - "type": "string" + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } } } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } + } + }, + "team_id": { + "type": "string" + }, + "customer_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Update budget request", + "properties": { + "max_limit": { + "type": "number" + }, + "reset_duration": { + "type": "string" + }, + "calendar_aligned": { + "type": "boolean", + "nullable": true, + "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Update rate limit request", + "properties": { + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "request_max_limit": { + "type": "integer", + "format": "int64" + }, + "request_reset_duration": { + "type": "string" } } + }, + "is_active": { + "type": "boolean" } } } } } - } - } - }, - "/api/mcp/client/{id}/reconnect": { - "post": { - "operationId": "reconnectMCPClient", - "summary": "Reconnect MCP client", - "description": "Reconnects an MCP client that is in an error or disconnected state.", - "tags": [ - "MCP" - ], - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "description": "MCP client ID", - "schema": { - "type": "string" - } - } - ], + }, "responses": { "200": { - "description": "MCP client reconnected successfully", + "description": "Virtual key updated successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "Generic success response", + "description": "Virtual key operation response", "properties": { - "status": { - "type": "string", - "example": "success" - }, "message": { - "type": "string", - "example": "Operation completed successfully" - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { "type": "string" }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { + "virtual_key": { "type": "object", + "description": "Virtual key configuration", "properties": { - "type": { - "type": "string" - }, - "code": { + "id": { "type": "string" }, - "message": { + "name": { "type": "string" }, - "param": { + "value": { "type": "string" }, - "event_id": { + "description": { "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] }, - "model_requested": { - "type": "string" + "is_active": { + "type": "boolean" }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - }, - "/api/oauth/callback": { - "get": { - "operationId": "handleOAuthCallback", - "summary": "OAuth callback endpoint", - "description": "Handles the OAuth provider callback after user authorization.\nThis endpoint processes the authorization code and exchanges it for an access token.\nOn success, displays an HTML page that closes the authorization window.\n", - "tags": [ - "OAuth" - ], - "parameters": [ - { - "name": "state", - "in": "query", - "required": true, - "description": "State parameter for OAuth security (CSRF protection)", - "schema": { - "type": "string" - } - }, - { - "name": "code", - "in": "query", - "required": true, - "description": "Authorization code from the OAuth provider", - "schema": { - "type": "string" - } - }, - { - "name": "error", - "in": "query", - "required": false, - "description": "Error code if authorization failed", - "schema": { - "type": "string" - } - }, - { - "name": "error_description", - "in": "query", - "required": false, - "description": "Error description if authorization failed", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OAuth authorization successful. Returns HTML page that closes the authorization window.", - "content": { - "text/html": { - "schema": { - "type": "string" + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } + } + } + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } } } } }, "400": { - "description": "OAuth authorization failed or missing required parameters", - "content": { - "text/html": { - "schema": { - "type": "string" - } - } - } - } - } - } - }, - "/api/oauth/config/{id}/status": { - "get": { - "operationId": "getOAuthConfigStatus", - "summary": "Get OAuth config status", - "description": "Retrieves the current status of an OAuth configuration.\nShows whether the OAuth flow is pending, authorized, or failed,\nand includes token expiration and scopes if authorized.\n", - "tags": [ - "OAuth" - ], - "parameters": [ - { - "name": "id", - "in": "path", - "required": true, - "description": "OAuth config ID", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "OAuth config status retrieved successfully", + "description": "Bad request", "content": { "application/json": { "schema": { "type": "object", - "description": "Status of an OAuth configuration", + "description": "Error response from Bifrost", "properties": { - "id": { - "type": "string", - "description": "OAuth config ID" + "event_id": { + "type": "string" }, - "status": { - "type": "string", - "enum": [ - "pending", - "authorized", - "failed" - ], - "description": "Current status of the OAuth flow:\n- pending: User has not yet authorized\n- authorized: User authorized and token is stored\n- failed: Authorization failed\n" - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "When this OAuth config was created" + "type": { + "type": "string" }, - "expires_at": { - "type": "string", - "format": "date-time", - "description": "When this OAuth config expires (becomes invalid if not completed)" + "is_bifrost_error": { + "type": "boolean" }, - "token_id": { - "type": "string", - "description": "ID of the associated OAuth token (only present if status is authorized)" + "status_code": { + "type": "integer" }, - "token_expires_at": { - "type": "string", - "format": "date-time", - "description": "When the OAuth access token expires (only present if status is authorized)" + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } }, - "token_scopes": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Scopes granted in the OAuth token (only present if status is authorized)" + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } } } } @@ -157033,12 +155833,12 @@ } }, "404": { - "description": "OAuth config not found", + "description": "Virtual key not found", "content": { "application/json": { "schema": { "type": "object", - "description": "Error response", + "description": "Error response from Bifrost", "properties": { "event_id": { "type": "string" @@ -157205,18 +156005,18 @@ } }, "delete": { - "operationId": "revokeOAuthConfig", - "summary": "Revoke OAuth config", - "description": "Revokes an OAuth configuration and its associated access token.\nAfter revocation, the MCP client will no longer be able to use this OAuth token.\n", + "operationId": "deleteVirtualKey", + "summary": "Delete virtual key", + "description": "Deletes a virtual key.", "tags": [ - "OAuth" + "Governance" ], "parameters": [ { - "name": "id", + "name": "vk_id", "in": "path", "required": true, - "description": "OAuth config ID", + "description": "Virtual key ID", "schema": { "type": "string" } @@ -157224,20 +156024,100 @@ ], "responses": { "200": { - "description": "OAuth token revoked successfully", + "description": "Virtual key deleted successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "Generic success response", + "description": "Simple message response", "properties": { - "status": { - "type": "string", - "example": "success" - }, "message": { - "type": "string", - "example": "Operation completed successfully" + "type": "string" + } + } + } + } + } + }, + "404": { + "description": "Virtual key not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } } } } @@ -157332,19 +156212,27 @@ } } }, - "/api/governance/virtual-keys": { + "/api/governance/teams": { "get": { - "operationId": "listVirtualKeys", - "summary": "List virtual keys", - "description": "Returns a list of all virtual keys with their configurations.", + "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 virtual keys from in-memory cache instead of database", + "description": "If true, returns teams from in-memory cache instead of database", "schema": { "type": "boolean", "default": false @@ -157358,13 +156246,13 @@ "application/json": { "schema": { "type": "object", - "description": "List virtual keys response", + "description": "List teams response", "properties": { - "virtual_keys": { + "teams": { "type": "array", "items": { "type": "object", - "description": "Virtual key configuration", + "description": "Team configuration", "properties": { "id": { "type": "string" @@ -157372,719 +156260,1230 @@ "name": { "type": "string" }, - "value": { + "customer_id": { "type": "string" }, - "description": { + "budget_id": { "type": "string" }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { + "customer": { + "type": "object", + "description": "Customer configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "budget_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { + } + }, + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Team" + } + }, + "virtual_keys": { + "type": "array", + "items": { "type": "object", - "description": "Budget configuration", + "description": "Virtual key configuration", "properties": { "id": { "type": "string" }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { + "name": { "type": "string" }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { + "value": { "type": "string" }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true + "description": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time" + "is_active": { + "type": "boolean" }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { + "provider_configs": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", + "description": "Provider configuration for a virtual key", "properties": { - "value": { + "id": { + "type": "integer" + }, + "virtual_key_id": { "type": "string" }, - "env_var": { + "provider": { "type": "string" }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } + }, + "budget_id": { "type": "string" }, - "env_var": { + "rate_limit_id": { "type": "string" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "env_var": { - "type": "string" + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "from_env": { - "type": "boolean" + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } } - }, - "nullable": true - }, - "vertex_region": { + } + } + }, + "mcp_configs": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", + "description": "MCP configuration for a virtual key", "properties": { - "value": { - "type": "string" + "id": { + "type": "integer" }, - "env_var": { + "mcp_client_name": { "type": "string" }, - "from_env": { - "type": "boolean" + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true + } + } + } + } + } + }, + "config_hash": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "virtual_keys": { + "type": "array", + "items": { + "type": "object", + "description": "Virtual key configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "description": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" }, - "bedrock_access_key": { + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { "type": "object", - "description": "Environment variable configuration", + "description": "Budget configuration", "properties": { - "value": { + "id": { "type": "string" }, - "env_var": { - "type": "string" + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" }, - "env_var": { - "type": "string" + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "last_reset": { + "type": "string", + "format": "date-time" }, - "env_var": { - "type": "string" + "current_usage": { + "type": "number" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "config_hash": { + "type": "string", + "nullable": true }, - "env_var": { - "type": "string" + "created_at": { + "type": "string", + "format": "date-time" }, - "from_env": { - "type": "boolean" + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "nullable": true + } }, - "bedrock_arn": { + "rate_limit": { "type": "object", - "description": "Environment variable configuration", + "description": "Rate limit configuration", "properties": { - "value": { + "id": { "type": "string" }, - "env_var": { + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { "type": "string" }, - "from_env": { - "type": "boolean" + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "count": { - "type": "integer" - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "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": { - "type": "object", - "description": "Create virtual key request", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "provider_configs": { - "type": "array", - "description": "Provider configurations (empty means no providers allowed, deny-by-default)", - "items": { - "type": "object", - "properties": { - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget": { - "type": "object", - "description": "Create budget request", - "required": [ - "max_limit", - "reset_duration" - ], - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" - }, - "calendar_aligned": { - "type": "boolean", - "default": false, - "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Create rate limit request", - "properties": { - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "request_max_limit": { - "type": "integer", - "format": "int64" - }, - "request_reset_duration": { - "type": "string" - } - } - }, - "key_ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "description": "MCP configurations (empty means no MCP tools allowed, deny-by-default)", - "items": { - "type": "object", - "properties": { - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "team_id": { - "type": "string" - }, - "customer_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Create budget request", - "required": [ - "max_limit", - "reset_duration" - ], - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" - }, - "calendar_aligned": { - "type": "boolean", - "default": false, - "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" + } + }, + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } + } + } + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "profile": { + "type": "object", + "additionalProperties": true + }, + "config": { + "type": "object", + "additionalProperties": true + }, + "claims": { + "type": "object", + "additionalProperties": true + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + } + }, + "count": { + "type": "integer" + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } } } + } + } + } + } + } + } + }, + "post": { + "operationId": "createTeam", + "summary": "Create team", + "description": "Creates a new team.", + "tags": [ + "Governance" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Create team request", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" }, - "rate_limit": { + "customer_id": { + "type": "string" + }, + "budget": { "type": "object", - "description": "Create rate limit request", + "description": "Create budget request", + "required": [ + "max_limit", + "reset_duration" + ], "properties": { - "token_max_limit": { - "type": "integer", - "format": "int64" + "max_limit": { + "type": "number" }, - "token_reset_duration": { + "reset_duration": { "type": "string" }, - "request_max_limit": { - "type": "integer", - "format": "int64" - }, - "request_reset_duration": { - "type": "string" + "calendar_aligned": { + "type": "boolean", + "default": false, + "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" } } - }, - "is_active": { - "type": "boolean" } } } @@ -158093,19 +157492,19 @@ }, "responses": { "200": { - "description": "Virtual key created successfully", + "description": "Team created successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "Virtual key operation response", + "description": "Team operation response", "properties": { "message": { "type": "string" }, - "virtual_key": { + "team": { "type": "object", - "description": "Virtual key configuration", + "description": "Team configuration", "properties": { "id": { "type": "string" @@ -158113,544 +157512,1087 @@ "name": { "type": "string" }, - "value": { + "customer_id": { "type": "string" }, - "description": { + "budget_id": { "type": "string" }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { + "customer": { + "type": "object", + "description": "Customer configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "budget_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { + } + }, + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Team" + } + }, + "virtual_keys": { + "type": "array", + "items": { "type": "object", - "description": "Budget configuration", + "description": "Virtual key configuration", "properties": { "id": { "type": "string" }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { + "name": { "type": "string" }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { + "value": { "type": "string" }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true + "description": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time" + "is_active": { + "type": "boolean" }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { + "provider_configs": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", + "description": "Provider configuration for a virtual key", "properties": { - "value": { - "type": "string" + "id": { + "type": "integer" }, - "env_var": { + "virtual_key_id": { "type": "string" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "provider": { "type": "string" }, - "env_var": { - "type": "string" + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } }, - "env_var": { + "budget_id": { "type": "string" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "rate_limit_id": { "type": "string" }, - "env_var": { - "type": "string" + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } } - }, - "nullable": true - }, - "bedrock_arn": { + } + } + }, + "mcp_configs": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", + "description": "MCP configuration for a virtual key", "properties": { - "value": { - "type": "string" + "id": { + "type": "integer" }, - "env_var": { + "mcp_client_name": { "type": "string" }, - "from_env": { - "type": "boolean" + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } } - }, - "nullable": true + } } } } } + }, + "config_hash": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } } }, - "mcp_configs": { + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "virtual_keys": { "type": "array", "items": { "type": "object", - "description": "MCP configuration for a virtual key", + "description": "Virtual key configuration", "properties": { "id": { - "type": "integer" + "type": "string" }, - "mcp_client_name": { + "name": { "type": "string" }, - "tools_to_execute": { + "value": { + "type": "string" + }, + "description": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "provider_configs": { "type": "array", "items": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } + } + } + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } }, - "model_requested": { - "type": "string" + "profile": { + "type": "object", + "additionalProperties": true }, - "request_type": { - "type": "string" + "config": { + "type": "object", + "additionalProperties": true + }, + "claims": { + "type": "object", + "additionalProperties": true + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } } } @@ -158659,8 +158601,8 @@ } } }, - "500": { - "description": "Internal server error", + "400": { + "description": "Bad request", "content": { "application/json": { "schema": { @@ -158743,524 +158685,14 @@ } } } - } - } - } - }, - "/api/governance/virtual-keys/{vk_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", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { "type": "object", - "properties": { - "virtual_key": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - } - }, - "404": { - "description": "Virtual key not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", + "description": "Error response from Bifrost", "properties": { "event_id": { "type": "string" @@ -159338,280 +158770,49 @@ } } } + } + } + } + }, + "/api/governance/teams/{team_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" + } }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "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", + "name": "from_memory", + "in": "query", + "description": "If true, returns team from in-memory cache instead of database", "schema": { - "type": "string" + "type": "boolean", + "default": false } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Update virtual key request", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget": { - "type": "object", - "description": "Update budget request", - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" - }, - "calendar_aligned": { - "type": "boolean", - "nullable": true, - "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Update rate limit request", - "properties": { - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "request_max_limit": { - "type": "integer", - "format": "int64" - }, - "request_reset_duration": { - "type": "string" - } - } - }, - "key_ids": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - }, - "team_id": { - "type": "string" - }, - "customer_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Update budget request", - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" - }, - "calendar_aligned": { - "type": "boolean", - "nullable": true, - "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Update rate limit request", - "properties": { - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "request_max_limit": { - "type": "integer", - "format": "int64" - }, - "request_reset_duration": { - "type": "string" - } - } - }, - "is_active": { - "type": "boolean" - } - } - } - } - } - }, "responses": { "200": { - "description": "Virtual key updated successfully", + "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", - "description": "Virtual key operation response", "properties": { - "message": { - "type": "string" - }, - "virtual_key": { + "team": { "type": "object", - "description": "Virtual key configuration", + "description": "Team configuration", "properties": { "id": { "type": "string" @@ -159619,714 +158820,1087 @@ "name": { "type": "string" }, - "value": { + "customer_id": { "type": "string" }, - "description": { + "budget_id": { "type": "string" }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { + "customer": { + "type": "object", + "description": "Customer configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "budget_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { + } + }, + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Team" + } + }, + "virtual_keys": { + "type": "array", + "items": { "type": "object", - "description": "Budget configuration", + "description": "Virtual key configuration", "properties": { "id": { "type": "string" }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { + "name": { "type": "string" }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { + "value": { "type": "string" }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true + "description": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time" + "is_active": { + "type": "boolean" }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { + "provider_configs": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", + "description": "Provider configuration for a virtual key", "properties": { - "value": { + "id": { + "type": "integer" + }, + "virtual_key_id": { "type": "string" }, - "env_var": { + "provider": { "type": "string" }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." }, - "env_var": { - "type": "string" + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "budget_id": { "type": "string" }, - "env_var": { + "rate_limit_id": { "type": "string" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "env_var": { - "type": "string" + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "from_env": { - "type": "boolean" + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } } - }, - "nullable": true - }, - "vertex_project_number": { + } + } + }, + "mcp_configs": { + "type": "array", + "items": { "type": "object", - "description": "Environment variable configuration", + "description": "MCP configuration for a virtual key", "properties": { - "value": { - "type": "string" + "id": { + "type": "integer" }, - "env_var": { + "mcp_client_name": { "type": "string" }, - "from_env": { - "type": "boolean" + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } } - }, - "nullable": true - }, - "vertex_region": { + } + } + } + } + } + }, + "config_hash": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "virtual_keys": { + "type": "array", + "items": { + "type": "object", + "description": "Virtual key configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "description": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { "type": "object", - "description": "Environment variable configuration", + "description": "Budget configuration", "properties": { - "value": { + "id": { "type": "string" }, - "env_var": { - "type": "string" + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" }, - "env_var": { - "type": "string" + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "last_reset": { + "type": "string", + "format": "date-time" }, - "env_var": { - "type": "string" + "current_usage": { + "type": "number" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "config_hash": { + "type": "string", + "nullable": true }, - "env_var": { - "type": "string" + "created_at": { + "type": "string", + "format": "date-time" }, - "from_env": { - "type": "boolean" + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "nullable": true + } }, - "bedrock_session_token": { + "rate_limit": { "type": "object", - "description": "Environment variable configuration", + "description": "Rate limit configuration", "properties": { - "value": { + "id": { "type": "string" }, - "env_var": { - "type": "string" + "token_max_limit": { + "type": "integer", + "format": "int64" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "token_reset_duration": { "type": "string" }, - "env_var": { - "type": "string" + "token_current_usage": { + "type": "integer", + "format": "int64" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "token_last_reset": { + "type": "string", + "format": "date-time" }, - "env_var": { - "type": "string" + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true }, - "from_env": { - "type": "boolean" + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "404": { - "description": "Virtual key not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { + } + }, + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } + } + } + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "profile": { + "type": "object", + "additionalProperties": true + }, + "config": { + "type": "object", + "additionalProperties": true + }, + "claims": { + "type": "object", + "additionalProperties": true + }, + "config_hash": { "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] + "nullable": true }, - "model_requested": { - "type": "string" + "created_at": { + "type": "string", + "format": "date-time" }, - "request_type": { - "type": "string" + "updated_at": { + "type": "string", + "format": "date-time" } } } @@ -160334,46 +159908,9 @@ } } } - } - } - }, - "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": { - "type": "object", - "description": "Simple message response", - "properties": { - "message": { - "type": "string" - } - } - } - } - } }, "404": { - "description": "Virtual key not found", + "description": "Team not found", "content": { "application/json": { "schema": { @@ -160543,257 +160080,350 @@ } } } - } - }, - "/api/governance/teams": { - "get": { - "operationId": "listTeams", - "summary": "List teams", - "description": "Returns a list of all teams.", + }, + "put": { + "operationId": "updateTeam", + "summary": "Update team", + "description": "Updates an existing team.", "tags": [ "Governance" ], "parameters": [ { - "name": "customer_id", - "in": "query", - "description": "Filter teams by customer ID", + "name": "team_id", + "in": "path", + "required": true, + "description": "Team 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 - } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Update team request", + "properties": { + "name": { + "type": "string" + }, + "customer_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Update budget request", + "properties": { + "max_limit": { + "type": "number" + }, + "reset_duration": { + "type": "string" + }, + "calendar_aligned": { + "type": "boolean", + "nullable": true, + "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" + } + } + } + } + } + } + } + }, "responses": { "200": { - "description": "Successful response", + "description": "Team updated successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "List teams response", + "description": "Team operation response", "properties": { - "teams": { - "type": "array", - "items": { - "type": "object", - "description": "Team configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "customer_id": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "customer": { - "type": "object", - "description": "Customer configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "budget": { + "message": { + "type": "string" + }, + "team": { + "type": "object", + "description": "Team configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "customer_id": { + "type": "string" + }, + "budget_id": { + "type": "string" + }, + "customer": { + "type": "object", + "description": "Customer configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "budget_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Team" + } + }, + "virtual_keys": { + "type": "array", + "items": { "type": "object", - "description": "Budget configuration", + "description": "Virtual key configuration", "properties": { "id": { "type": "string" }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" + "name": { + "type": "string" }, - "current_usage": { - "type": "number" + "value": { + "type": "string" }, - "config_hash": { - "type": "string", - "nullable": true + "description": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time" + "is_active": { + "type": "boolean" }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "teams": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Team" - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "keys": { + "type": "array", + "items": { "type": "object", - "description": "Budget configuration", + "description": "Table key configuration", "properties": { "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" + "type": "integer" }, - "config_hash": { - "type": "string", - "nullable": true + "name": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time" + "provider_id": { + "type": "integer" }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { + "provider": { "type": "string" }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { + "key_id": { "type": "string" }, - "token_current_usage": { - "type": "integer", - "format": "int64" + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } }, - "token_last_reset": { - "type": "string", - "format": "date-time" + "models": { + "type": "array", + "items": { + "type": "string" + } }, - "request_max_limit": { - "type": "integer", - "format": "int64", + "weight": { + "type": "number", "nullable": true }, - "request_reset_duration": { - "type": "string", + "enabled": { + "type": "boolean", + "default": true, "nullable": true }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", + "use_for_batch_api": { + "type": "boolean", + "default": false, "nullable": true }, "created_at": { @@ -160803,467 +160433,520 @@ "updated_at": { "type": "string", "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "key_id": { - "type": "string" + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" } }, - "models": { - "type": "array", - "items": { + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { "type": "string" + }, + "from_env": { + "type": "boolean" } }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - } + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true } } } } } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } } } } } } } - }, - "config_hash": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" } + }, + "config_hash": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "budget": { + } + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "virtual_keys": { + "type": "array", + "items": { "type": "object", - "description": "Budget configuration", + "description": "Virtual key configuration", "properties": { "id": { "type": "string" }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" + "name": { + "type": "string" }, - "current_usage": { - "type": "number" + "value": { + "type": "string" }, - "config_hash": { - "type": "string", - "nullable": true + "description": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time" + "is_active": { + "type": "boolean" }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "keys": { + "type": "array", + "items": { "type": "object", - "description": "Budget configuration", + "description": "Table key configuration", "properties": { "id": { + "type": "integer" + }, + "name": { "type": "string" }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" + "provider_id": { + "type": "integer" }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + "provider": { + "type": "string" }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false + "key_id": { + "type": "string" }, - "last_reset": { - "type": "string", - "format": "date-time" + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } }, - "current_usage": { - "type": "number" + "models": { + "type": "array", + "items": { + "type": "string" + } }, - "config_hash": { - "type": "string", + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, "nullable": true }, "created_at": { @@ -161273,421 +160956,298 @@ "updated_at": { "type": "string", "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" }, - "token_last_reset": { + "config_hash": { "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", "nullable": true }, - "request_reset_duration": { - "type": "string", + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, "nullable": true }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, "nullable": true }, - "created_at": { - "type": "string", - "format": "date-time" + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "name": { - "type": "string" + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "provider_id": { - "type": "integer" + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "provider": { - "type": "string" + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "key_id": { - "type": "string" + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" } }, - "models": { - "type": "array", - "items": { + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { "type": "string" + }, + "from_env": { + "type": "boolean" } }, - "weight": { - "type": "number", - "nullable": true + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } + "nullable": true } } } } } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } } } } } } } - }, - "profile": { - "type": "object", - "additionalProperties": true - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "claims": { - "type": "object", - "additionalProperties": true - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" } + }, + "profile": { + "type": "object", + "additionalProperties": true + }, + "config": { + "type": "object", + "additionalProperties": true + }, + "claims": { + "type": "object", + "additionalProperties": true + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } } - }, - "count": { - "type": "integer" } } } } } }, - "500": { - "description": "Internal server error", + "400": { + "description": "Bad request", "content": { "application/json": { "schema": { @@ -161770,282 +161330,678 @@ } } } - } - } - }, - "post": { - "operationId": "createTeam", - "summary": "Create team", - "description": "Creates a new team.", - "tags": [ - "Governance" - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Create team request", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "customer_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Create budget request", - "required": [ - "max_limit", - "reset_duration" - ], - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" - }, - "calendar_aligned": { - "type": "boolean", - "default": false, - "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" + }, + "404": { + "description": "Team not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } } } } } } } - } - }, - "responses": { - "200": { - "description": "Team created successfully", + }, + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { "type": "object", - "description": "Team operation response", + "description": "Error response from Bifrost", "properties": { - "message": { + "event_id": { "type": "string" }, - "team": { + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { "type": "object", - "description": "Team configuration", "properties": { - "id": { + "type": { "type": "string" }, - "name": { + "code": { "type": "string" }, - "customer_id": { + "message": { "type": "string" }, - "budget_id": { + "param": { "type": "string" }, - "customer": { - "type": "object", - "description": "Customer configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "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": { + "type": "object", + "description": "Simple message response", + "properties": { + "message": { + "type": "string" + } + } + } + } + } + }, + "404": { + "description": "Team not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/api/governance/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": { + "type": "object", + "description": "List customers response", + "properties": { + "customers": { + "type": "array", + "items": { + "type": "object", + "description": "Customer configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "budget_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Team" + } + }, + "virtual_keys": { + "type": "array", + "items": { + "type": "object", + "description": "Virtual key configuration", + "properties": { + "id": { + "type": "string" }, - "last_reset": { - "type": "string", - "format": "date-time" + "name": { + "type": "string" }, - "current_usage": { - "type": "number" + "value": { + "type": "string" }, - "config_hash": { - "type": "string", - "nullable": true + "description": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time" + "is_active": { + "type": "boolean" }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "teams": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Team" - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "keys": { + "type": "array", + "items": { "type": "object", - "description": "Budget configuration", + "description": "Table key configuration", "properties": { "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" + "type": "integer" }, - "config_hash": { - "type": "string", - "nullable": true + "name": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time" + "provider_id": { + "type": "integer" }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { + "provider": { "type": "string" }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { + "key_id": { "type": "string" }, - "token_current_usage": { - "type": "integer", - "format": "int64" + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } }, - "token_last_reset": { - "type": "string", - "format": "date-time" + "models": { + "type": "array", + "items": { + "type": "string" + } }, - "request_max_limit": { - "type": "integer", - "format": "int64", + "weight": { + "type": "number", "nullable": true }, - "request_reset_duration": { - "type": "string", + "enabled": { + "type": "boolean", + "default": true, "nullable": true }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", + "use_for_batch_api": { + "type": "boolean", + "default": false, "nullable": true }, "created_at": { @@ -162055,343 +162011,445 @@ "updated_at": { "type": "string", "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" } }, - "models": { - "type": "array", - "items": { + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { "type": "string" + }, + "from_env": { + "type": "boolean" } }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "env_var": { + "type": "string" }, - "nullable": true + "from_env": { + "type": "boolean" + } }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" }, - "nullable": true - } + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true } } } } } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } } } } } } } - }, - "config_hash": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" } + }, + "config_hash": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } + } + } + }, + "count": { + "type": "integer" + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "post": { + "operationId": "createCustomer", + "summary": "Create customer", + "description": "Creates a new customer.", + "tags": [ + "Governance" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Create customer request", + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Create budget request", + "required": [ + "max_limit", + "reset_duration" + ], + "properties": { + "max_limit": { + "type": "number" + }, + "reset_duration": { + "type": "string" + }, + "calendar_aligned": { + "type": "boolean", + "default": false, + "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" + } + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Customer created successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Customer operation response", + "properties": { + "message": { + "type": "string" + }, + "customer": { + "type": "object", + "description": "Customer configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "budget_id": { + "type": "string" }, "budget": { "type": "object", @@ -162434,6 +162492,12 @@ } } }, + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Team" + } + }, "virtual_keys": { "type": "array", "items": { @@ -162903,21 +162967,8 @@ } } }, - "profile": { - "type": "object", - "additionalProperties": true - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "claims": { - "type": "object", - "additionalProperties": true - }, "config_hash": { - "type": "string", - "nullable": true + "type": "string" }, "created_at": { "type": "string", @@ -163107,20 +163158,20 @@ } } }, - "/api/governance/teams/{team_id}": { + "/api/governance/customers/{customer_id}": { "get": { - "operationId": "getTeam", - "summary": "Get team", - "description": "Returns a specific team by ID.", + "operationId": "getCustomer", + "summary": "Get customer", + "description": "Returns a specific customer by ID.", "tags": [ "Governance" ], "parameters": [ { - "name": "team_id", + "name": "customer_id", "in": "path", "required": true, - "description": "Team ID", + "description": "Customer ID", "schema": { "type": "string" } @@ -163128,7 +163179,7 @@ { "name": "from_memory", "in": "query", - "description": "If true, returns team from in-memory cache instead of database", + "description": "If true, returns customer from in-memory cache instead of database", "schema": { "type": "boolean", "default": false @@ -163143,9 +163194,9 @@ "schema": { "type": "object", "properties": { - "team": { + "customer": { "type": "object", - "description": "Team configuration", + "description": "Customer configuration", "properties": { "id": { "type": "string" @@ -163153,77 +163204,71 @@ "name": { "type": "string" }, - "customer_id": { - "type": "string" - }, "budget_id": { "type": "string" }, - "customer": { + "budget": { "type": "object", - "description": "Customer configuration", + "description": "Budget configuration", "properties": { "id": { "type": "string" }, - "name": { - "type": "string" + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" }, - "budget_id": { - "type": "string" + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false }, - "teams": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Team" - } + "last_reset": { + "type": "string", + "format": "date-time" }, - "virtual_keys": { - "type": "array", - "items": { + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "teams": { + "type": "array", + "items": { + "type": "object", + "description": "Team configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "customer_id": { + "type": "string" + }, + "budget_id": { + "type": "string" + }, + "customer": { "type": "object", - "description": "Virtual key configuration", + "description": "Customer configuration", "properties": { "id": { "type": "string" @@ -163231,8071 +163276,1546 @@ "name": { "type": "string" }, - "value": { + "budget_id": { "type": "string" }, - "description": { - "type": "string" + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "is_active": { - "type": "boolean" + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Team" + } }, - "provider_configs": { + "virtual_keys": { "type": "array", "items": { "type": "object", - "description": "Provider configuration for a virtual key", + "description": "Virtual key configuration", "properties": { "id": { - "type": "integer" - }, - "virtual_key_id": { "type": "string" }, - "provider": { + "name": { "type": "string" }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { + "value": { "type": "string" }, - "rate_limit_id": { + "description": { "type": "string" }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } + "is_active": { + "type": "boolean" }, - "keys": { + "provider_configs": { "type": "array", "items": { "type": "object", - "description": "Table key configuration", + "description": "Provider configuration for a virtual key", "properties": { "id": { "type": "integer" }, - "name": { + "virtual_key_id": { "type": "string" }, - "provider_id": { - "type": "integer" - }, "provider": { "type": "string" }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." }, - "models": { + "allowed_models": { "type": "array", "items": { "type": "string" } }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" + "budget_id": { + "type": "string" }, - "config_hash": { - "type": "string", - "nullable": true + "rate_limit_id": { + "type": "string" }, - "azure_endpoint": { + "budget": { "type": "object", - "description": "Environment variable configuration", + "description": "Budget configuration", "properties": { - "value": { + "id": { "type": "string" }, - "env_var": { - "type": "string" + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" }, - "env_var": { - "type": "string" + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "last_reset": { + "type": "string", + "format": "date-time" }, - "env_var": { - "type": "string" + "current_usage": { + "type": "number" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "config_hash": { + "type": "string", + "nullable": true }, - "env_var": { - "type": "string" + "created_at": { + "type": "string", + "format": "date-time" }, - "from_env": { - "type": "boolean" + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "nullable": true + } }, - "azure_tenant_id": { + "rate_limit": { "type": "object", - "description": "Environment variable configuration", + "description": "Rate limit configuration", "properties": { - "value": { + "id": { "type": "string" }, - "env_var": { - "type": "string" + "token_max_limit": { + "type": "integer", + "format": "int64" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { + "token_reset_duration": { "type": "string" }, - "env_var": { - "type": "string" + "token_current_usage": { + "type": "integer", + "format": "int64" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "token_last_reset": { + "type": "string", + "format": "date-time" }, - "env_var": { - "type": "string" + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "request_reset_duration": { + "type": "string", + "nullable": true }, - "env_var": { - "type": "string" + "request_current_usage": { + "type": "integer", + "format": "int64" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" + "request_last_reset": { + "type": "string", + "format": "date-time" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "config_hash": { + "type": "string", + "nullable": true }, - "env_var": { - "type": "string" + "created_at": { + "type": "string", + "format": "date-time" }, - "from_env": { - "type": "boolean" + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "nullable": true + } }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } } - }, - "nullable": true + } } } } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" }, - "tools_to_execute": { + "mcp_configs": { "type": "array", "items": { - "type": "string" + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } } } } } + }, + "config_hash": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } } - } - }, - "config_hash": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "provider_configs": { + "virtual_keys": { "type": "array", "items": { "type": "object", - "description": "Provider configuration for a virtual key", + "description": "Virtual key configuration", "properties": { "id": { - "type": "integer" - }, - "virtual_key_id": { "type": "string" }, - "provider": { + "name": { "type": "string" }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { + "value": { "type": "string" }, - "rate_limit_id": { + "description": { "type": "string" }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } + "is_active": { + "type": "boolean" }, - "keys": { + "provider_configs": { "type": "array", "items": { "type": "object", - "description": "Table key configuration", + "description": "Provider configuration for a virtual key", "properties": { "id": { "type": "integer" }, - "name": { + "virtual_key_id": { "type": "string" }, - "provider_id": { - "type": "integer" - }, "provider": { "type": "string" }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." }, - "models": { + "allowed_models": { "type": "array", "items": { "type": "string" } }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true + "budget_id": { + "type": "string" }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true + "rate_limit_id": { + "type": "string" }, - "azure_client_secret": { + "budget": { "type": "object", - "description": "Environment variable configuration", + "description": "Budget configuration", "properties": { - "value": { + "id": { "type": "string" }, - "env_var": { - "type": "string" + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" }, - "env_var": { - "type": "string" + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "last_reset": { + "type": "string", + "format": "date-time" }, - "env_var": { - "type": "string" + "current_usage": { + "type": "number" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "config_hash": { + "type": "string", + "nullable": true }, - "env_var": { - "type": "string" + "created_at": { + "type": "string", + "format": "date-time" }, - "from_env": { - "type": "boolean" + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "nullable": true + } }, - "vertex_region": { + "rate_limit": { "type": "object", - "description": "Environment variable configuration", + "description": "Rate limit configuration", "properties": { - "value": { - "type": "string" - }, - "env_var": { + "id": { "type": "string" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "token_max_limit": { + "type": "integer", + "format": "int64" }, - "env_var": { + "token_reset_duration": { "type": "string" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "token_current_usage": { + "type": "integer", + "format": "int64" }, - "env_var": { - "type": "string" + "token_last_reset": { + "type": "string", + "format": "date-time" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true }, - "env_var": { - "type": "string" + "request_reset_duration": { + "type": "string", + "nullable": true }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "request_current_usage": { + "type": "integer", + "format": "int64" }, - "env_var": { - "type": "string" + "request_last_reset": { + "type": "string", + "format": "date-time" }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" + "config_hash": { + "type": "string", + "nullable": true }, - "env_var": { - "type": "string" + "created_at": { + "type": "string", + "format": "date-time" }, - "from_env": { - "type": "boolean" + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "nullable": true + } }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "profile": { - "type": "object", - "additionalProperties": true - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "claims": { - "type": "object", - "additionalProperties": true - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - } - } - } - } - }, - "404": { - "description": "Team not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "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": { - "type": "object", - "description": "Update team request", - "properties": { - "name": { - "type": "string" - }, - "customer_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Update budget request", - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" - }, - "calendar_aligned": { - "type": "boolean", - "nullable": true, - "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" - } - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Team updated successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Team operation response", - "properties": { - "message": { - "type": "string" - }, - "team": { - "type": "object", - "description": "Team configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "customer_id": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "customer": { - "type": "object", - "description": "Customer configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "teams": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Team" - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "config_hash": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "profile": { - "type": "object", - "additionalProperties": true - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "claims": { - "type": "object", - "additionalProperties": true - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "404": { - "description": "Team not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "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": { - "type": "object", - "description": "Simple message response", - "properties": { - "message": { - "type": "string" - } - } - } - } - } - }, - "404": { - "description": "Team not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - }, - "/api/governance/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": { - "type": "object", - "description": "List customers response", - "properties": { - "customers": { - "type": "array", - "items": { - "type": "object", - "description": "Customer configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "teams": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Team" - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "config_hash": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - }, - "count": { - "type": "integer" - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "post": { - "operationId": "createCustomer", - "summary": "Create customer", - "description": "Creates a new customer.", - "tags": [ - "Governance" - ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Create customer request", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Create budget request", - "required": [ - "max_limit", - "reset_duration" - ], - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" - }, - "calendar_aligned": { - "type": "boolean", - "default": false, - "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" - } - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Customer created successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Customer operation response", - "properties": { - "message": { - "type": "string" - }, - "customer": { - "type": "object", - "description": "Customer configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "teams": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Team" - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "config_hash": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - }, - "/api/governance/customers/{customer_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": { - "type": "object", - "description": "Customer configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "teams": { - "type": "array", - "items": { - "type": "object", - "description": "Team configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "customer_id": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "customer": { - "type": "object", - "description": "Customer configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "teams": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Team" - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "config_hash": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "profile": { - "type": "object", - "additionalProperties": true - }, - "config": { - "type": "object", - "additionalProperties": true - }, - "claims": { - "type": "object", - "additionalProperties": true - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "config_hash": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - } - } - } - } - }, - "404": { - "description": "Customer not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "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": { - "type": "object", - "description": "Update customer request", - "properties": { - "name": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Update budget request", - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" - }, - "calendar_aligned": { - "type": "boolean", - "nullable": true, - "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" - } - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Customer updated successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Customer operation response", - "properties": { - "message": { - "type": "string" - }, - "customer": { - "type": "object", - "description": "Customer configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "budget_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "teams": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Team" - } - }, - "virtual_keys": { - "type": "array", - "items": { - "type": "object", - "description": "Virtual key configuration", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "value": { - "type": "string" - }, - "description": { - "type": "string" - }, - "is_active": { - "type": "boolean" - }, - "provider_configs": { - "type": "array", - "items": { - "type": "object", - "description": "Provider configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "virtual_key_id": { - "type": "string" - }, - "provider": { - "type": "string" - }, - "weight": { - "type": "number", - "nullable": true, - "description": "Weight for provider load balancing. Null means excluded from weighted routing." - }, - "allowed_models": { - "type": "array", - "items": { - "type": "string" - } - }, - "budget_id": { - "type": "string" - }, - "rate_limit_id": { - "type": "string" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "keys": { - "type": "array", - "items": { - "type": "object", - "description": "Table key configuration", - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "provider_id": { - "type": "integer" - }, - "provider": { - "type": "string" - }, - "key_id": { - "type": "string" - }, - "value": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "models": { - "type": "array", - "items": { - "type": "string" - } - }, - "weight": { - "type": "number", - "nullable": true - }, - "enabled": { - "type": "boolean", - "default": true, - "nullable": true - }, - "use_for_batch_api": { - "type": "boolean", - "default": false, - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "azure_endpoint": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_api_version": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_client_secret": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "azure_tenant_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_id": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_project_number": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "vertex_auth_credentials": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_access_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_secret_key": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_session_token": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_region": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - }, - "bedrock_arn": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - }, - "nullable": true - } - } - } - } - } - } - }, - "mcp_configs": { - "type": "array", - "items": { - "type": "object", - "description": "MCP configuration for a virtual key", - "properties": { - "id": { - "type": "integer" - }, - "mcp_client_name": { - "type": "string" - }, - "tools_to_execute": { - "type": "array", - "items": { - "type": "string" - } - } - } - } - } - } - } - }, - "config_hash": { - "type": "string" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "404": { - "description": "Customer not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "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": { - "type": "object", - "description": "Simple message response", - "properties": { - "message": { - "type": "string" - } - } - } - } - } - }, - "404": { - "description": "Customer not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - }, - "/api/governance/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": { - "type": "object", - "description": "List budgets response", - "properties": { - "budgets": { - "type": "array", - "items": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - }, - "count": { - "type": "integer" - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - }, - "/api/governance/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": { - "type": "object", - "description": "List rate limits response", - "properties": { - "rate_limits": { - "type": "array", - "items": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - }, - "count": { - "type": "integer" - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - }, - "/api/governance/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": { - "type": "object", - "description": "Response containing list of routing rules", - "properties": { - "rules": { - "type": "array", - "items": { - "type": "object", - "description": "CEL-based routing rule for intelligent request routing", - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the routing rule" - }, - "name": { - "type": "string", - "description": "Name of the routing rule" - }, - "description": { - "type": "string", - "description": "Description of what the rule does" - }, - "enabled": { - "type": "boolean", - "description": "Whether the rule is enabled and active" - }, - "cel_expression": { - "type": "string", - "description": "CEL (Common Expression Language) expression for matching" - }, - "targets": { - "type": "array", - "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", - "items": { - "type": "object", - "description": "A single weighted routing target within a routing rule", - "required": [ - "weight" - ], - "dependentRequired": { - "key_id": [ - "provider" - ] - }, - "properties": { - "provider": { - "type": "string", - "description": "Target provider (omit or empty to use the incoming request provider)", - "nullable": true - }, - "model": { - "type": "string", - "description": "Target model (omit or empty to use the incoming request model)", - "nullable": true - }, - "key_id": { - "type": "string", - "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", - "nullable": true - }, - "weight": { - "type": "number", - "format": "double", - "exclusiveMinimum": 0, - "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", - "example": 0.5 - } - } - } - }, - "fallbacks": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Fallback providers in format \"provider/model\"" - }, - "scope": { - "type": "string", - "enum": [ - "global", - "team", - "customer", - "virtual_key" - ], - "description": "Scope level for the rule" - }, - "scope_id": { - "type": "string", - "description": "ID for the scope (empty for global scope)", - "nullable": true - }, - "priority": { - "type": "integer", - "description": "Priority for rule evaluation (lower number = higher priority)" - }, - "query": { - "type": "object", - "description": "Visual rule tree structure from query builder", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - }, - "oneOf": [ - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "global" - ] - } - }, - "required": [ - "scope" - ], - "description": "Global scope routing rule" - }, - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "team", - "customer", - "virtual_key" - ] - }, - "scope_id": { - "type": "string" - } - }, - "required": [ - "scope", - "scope_id" - ], - "description": "Scoped routing rule (requires scope_id)" - } - ] - } - }, - "count": { - "type": "integer", - "description": "Number of routing rules returned" - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "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": { - "type": "object", - "description": "Request to create a routing rule", - "required": [ - "name", - "cel_expression", - "scope", - "priority", - "targets" - ], - "properties": { - "name": { - "type": "string", - "description": "Name of the routing rule" - }, - "description": { - "type": "string", - "description": "Optional description" - }, - "enabled": { - "type": "boolean", - "description": "Whether the rule is enabled" - }, - "cel_expression": { - "type": "string", - "description": "CEL expression for matching" - }, - "targets": { - "type": "array", - "minItems": 1, - "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", - "items": { - "type": "object", - "description": "A single weighted routing target within a routing rule", - "required": [ - "weight" - ], - "dependentRequired": { - "key_id": [ - "provider" - ] - }, - "properties": { - "provider": { - "type": "string", - "description": "Target provider (omit or empty to use the incoming request provider)", - "nullable": true - }, - "model": { - "type": "string", - "description": "Target model (omit or empty to use the incoming request model)", - "nullable": true - }, - "key_id": { - "type": "string", - "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", - "nullable": true - }, - "weight": { - "type": "number", - "format": "double", - "exclusiveMinimum": 0, - "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", - "example": 0.5 - } - } - } - }, - "fallbacks": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Fallback providers in format \"provider/model\"" - }, - "scope": { - "type": "string", - "enum": [ - "global", - "team", - "customer", - "virtual_key" - ], - "description": "Scope level for the rule" - }, - "scope_id": { - "type": "string", - "description": "ID for the scope (required if scope is not global)", - "nullable": true - }, - "priority": { - "type": "integer", - "description": "Priority for rule evaluation (lower number = higher priority)" - }, - "query": { - "type": "object", - "description": "Visual rule tree structure", - "nullable": true - } - }, - "oneOf": [ - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "global" - ] - } - }, - "required": [ - "scope" - ], - "description": "Global scope routing rule" - }, - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "team", - "customer", - "virtual_key" - ] - }, - "scope_id": { - "type": "string" - } - }, - "required": [ - "scope", - "scope_id" - ], - "description": "Scoped routing rule (requires scope_id)" - } - ] - } - } - } - }, - "responses": { - "200": { - "description": "Routing rule created successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Response containing created/updated routing rule", - "properties": { - "message": { - "type": "string" - }, - "rule": { - "type": "object", - "description": "CEL-based routing rule for intelligent request routing", - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the routing rule" - }, - "name": { - "type": "string", - "description": "Name of the routing rule" - }, - "description": { - "type": "string", - "description": "Description of what the rule does" - }, - "enabled": { - "type": "boolean", - "description": "Whether the rule is enabled and active" - }, - "cel_expression": { - "type": "string", - "description": "CEL (Common Expression Language) expression for matching" - }, - "targets": { - "type": "array", - "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", - "items": { - "type": "object", - "description": "A single weighted routing target within a routing rule", - "required": [ - "weight" - ], - "dependentRequired": { - "key_id": [ - "provider" - ] - }, - "properties": { - "provider": { - "type": "string", - "description": "Target provider (omit or empty to use the incoming request provider)", - "nullable": true + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } + } + } + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } }, - "model": { + "profile": { + "type": "object", + "additionalProperties": true + }, + "config": { + "type": "object", + "additionalProperties": true + }, + "claims": { + "type": "object", + "additionalProperties": true + }, + "config_hash": { "type": "string", - "description": "Target model (omit or empty to use the incoming request model)", "nullable": true }, - "key_id": { + "created_at": { "type": "string", - "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", - "nullable": true + "format": "date-time" }, - "weight": { - "type": "number", - "format": "double", - "exclusiveMinimum": 0, - "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", - "example": 0.5 + "updated_at": { + "type": "string", + "format": "date-time" } } } }, - "fallbacks": { + "virtual_keys": { "type": "array", "items": { - "type": "string" - }, - "description": "Fallback providers in format \"provider/model\"" - }, - "scope": { - "type": "string", - "enum": [ - "global", - "team", - "customer", - "virtual_key" - ], - "description": "Scope level for the rule" - }, - "scope_id": { - "type": "string", - "description": "ID for the scope (empty for global scope)", - "nullable": true - }, - "priority": { - "type": "integer", - "description": "Priority for rule evaluation (lower number = higher priority)" + "type": "object", + "description": "Virtual key configuration", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "value": { + "type": "string" + }, + "description": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } + } + } + } + }, + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } }, - "query": { - "type": "object", - "description": "Visual rule tree structure from query builder", - "nullable": true + "config_hash": { + "type": "string" }, "created_at": { "type": "string", @@ -171305,58 +164825,20 @@ "type": "string", "format": "date-time" } - }, - "oneOf": [ - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "global" - ] - } - }, - "required": [ - "scope" - ], - "description": "Global scope routing rule" - }, - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "team", - "customer", - "virtual_key" - ] - }, - "scope_id": { - "type": "string" - } - }, - "required": [ - "scope", - "scope_id" - ], - "description": "Scoped routing rule (requires scope_id)" - } - ] + } } } } } } }, - "400": { - "description": "Bad request", + "404": { + "description": "Customer not found", "content": { "application/json": { "schema": { "type": "object", - "description": "Error response from Bifrost", + "description": "Error response", "properties": { "event_id": { "type": "string" @@ -171521,129 +165003,601 @@ } } } - } - }, - "/api/governance/routing-rules/{rule_id}": { - "get": { - "operationId": "getRoutingRule", - "summary": "Get routing rule", - "description": "Returns a specific routing rule by ID.", + }, + "put": { + "operationId": "updateCustomer", + "summary": "Update customer", + "description": "Updates an existing customer.", "tags": [ "Governance" ], "parameters": [ { - "name": "rule_id", + "name": "customer_id", "in": "path", "required": true, - "description": "Routing rule ID", + "description": "Customer ID", "schema": { "type": "string" } } ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Update customer request", + "properties": { + "name": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Update budget request", + "properties": { + "max_limit": { + "type": "number" + }, + "reset_duration": { + "type": "string" + }, + "calendar_aligned": { + "type": "boolean", + "nullable": true, + "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" + } + } + } + } + } + } + } + }, "responses": { "200": { - "description": "Successful response", + "description": "Customer updated successfully", "content": { "application/json": { "schema": { "type": "object", + "description": "Customer operation response", "properties": { - "rule": { + "message": { + "type": "string" + }, + "customer": { "type": "object", - "description": "CEL-based routing rule for intelligent request routing", + "description": "Customer configuration", "properties": { "id": { - "type": "string", - "description": "Unique identifier for the routing rule" + "type": "string" }, "name": { - "type": "string", - "description": "Name of the routing rule" + "type": "string" }, - "description": { - "type": "string", - "description": "Description of what the rule does" + "budget_id": { + "type": "string" }, - "enabled": { - "type": "boolean", - "description": "Whether the rule is enabled and active" + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } }, - "cel_expression": { - "type": "string", - "description": "CEL (Common Expression Language) expression for matching" + "teams": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Team" + } }, - "targets": { + "virtual_keys": { "type": "array", - "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", "items": { "type": "object", - "description": "A single weighted routing target within a routing rule", - "required": [ - "weight" - ], - "dependentRequired": { - "key_id": [ - "provider" - ] - }, + "description": "Virtual key configuration", "properties": { - "provider": { - "type": "string", - "description": "Target provider (omit or empty to use the incoming request provider)", - "nullable": true + "id": { + "type": "string" }, - "model": { - "type": "string", - "description": "Target model (omit or empty to use the incoming request model)", - "nullable": true + "name": { + "type": "string" }, - "key_id": { - "type": "string", - "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", - "nullable": true + "value": { + "type": "string" + }, + "description": { + "type": "string" + }, + "is_active": { + "type": "boolean" + }, + "provider_configs": { + "type": "array", + "items": { + "type": "object", + "description": "Provider configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "virtual_key_id": { + "type": "string" + }, + "provider": { + "type": "string" + }, + "weight": { + "type": "number", + "nullable": true, + "description": "Weight for provider load balancing. Null means excluded from weighted routing." + }, + "allowed_models": { + "type": "array", + "items": { + "type": "string" + } + }, + "budget_id": { + "type": "string" + }, + "rate_limit_id": { + "type": "string" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "keys": { + "type": "array", + "items": { + "type": "object", + "description": "Table key configuration", + "properties": { + "id": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "provider_id": { + "type": "integer" + }, + "provider": { + "type": "string" + }, + "key_id": { + "type": "string" + }, + "value": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + } + }, + "models": { + "type": "array", + "items": { + "type": "string" + } + }, + "weight": { + "type": "number", + "nullable": true + }, + "enabled": { + "type": "boolean", + "default": true, + "nullable": true + }, + "use_for_batch_api": { + "type": "boolean", + "default": false, + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "azure_endpoint": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_api_version": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_client_secret": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "azure_tenant_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_id": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_project_number": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "vertex_auth_credentials": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_access_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_secret_key": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_session_token": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_region": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + }, + "bedrock_arn": { + "type": "object", + "description": "Environment variable configuration", + "properties": { + "value": { + "type": "string" + }, + "env_var": { + "type": "string" + }, + "from_env": { + "type": "boolean" + } + }, + "nullable": true + } + } + } + } + } + } }, - "weight": { - "type": "number", - "format": "double", - "exclusiveMinimum": 0, - "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", - "example": 0.5 + "mcp_configs": { + "type": "array", + "items": { + "type": "object", + "description": "MCP configuration for a virtual key", + "properties": { + "id": { + "type": "integer" + }, + "mcp_client_name": { + "type": "string" + }, + "tools_to_execute": { + "type": "array", + "items": { + "type": "string" + } + } + } + } } } } }, - "fallbacks": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Fallback providers in format \"provider/model\"" - }, - "scope": { - "type": "string", - "enum": [ - "global", - "team", - "customer", - "virtual_key" - ], - "description": "Scope level for the rule" - }, - "scope_id": { - "type": "string", - "description": "ID for the scope (empty for global scope)", - "nullable": true - }, - "priority": { - "type": "integer", - "description": "Priority for rule evaluation (lower number = higher priority)" - }, - "query": { - "type": "object", - "description": "Visual rule tree structure from query builder", - "nullable": true + "config_hash": { + "type": "string" }, "created_at": { "type": "string", @@ -171653,129 +165607,6 @@ "type": "string", "format": "date-time" } - }, - "oneOf": [ - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "global" - ] - } - }, - "required": [ - "scope" - ], - "description": "Global scope routing rule" - }, - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "team", - "customer", - "virtual_key" - ] - }, - "scope_id": { - "type": "string" - } - }, - "required": [ - "scope", - "scope_id" - ], - "description": "Scoped routing rule (requires scope_id)" - } - ] - } - } - } - } - } - }, - "404": { - "description": "Routing rule not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } } } } @@ -171783,8 +165614,8 @@ } } }, - "500": { - "description": "Internal server error", + "400": { + "description": "Bad request", "content": { "application/json": { "schema": { @@ -171867,268 +165698,94 @@ } } } - } - } - }, - "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": { - "type": "object", - "description": "Request to update a routing rule (all fields optional; providing `targets` replaces all existing targets)", - "properties": { - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "enabled": { - "type": "boolean" - }, - "cel_expression": { - "type": "string" - }, - "targets": { - "type": "array", - "minItems": 1, - "description": "Replaces all existing targets when provided; weights must sum to 1", - "items": { - "type": "object", - "description": "A single weighted routing target within a routing rule", - "required": [ - "weight" - ], - "dependentRequired": { - "key_id": [ - "provider" - ] - }, - "properties": { - "provider": { - "type": "string", - "description": "Target provider (omit or empty to use the incoming request provider)", - "nullable": true - }, - "model": { - "type": "string", - "description": "Target model (omit or empty to use the incoming request model)", - "nullable": true - }, - "key_id": { - "type": "string", - "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", - "nullable": true - }, - "weight": { - "type": "number", - "format": "double", - "exclusiveMinimum": 0, - "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", - "example": 0.5 - } - } - } - }, - "fallbacks": { - "type": "array", - "items": { - "type": "string" - } - }, - "priority": { - "type": "integer" - }, - "query": { - "type": "object", - "nullable": true - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Routing rule updated successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Response containing created/updated routing rule", - "properties": { - "message": { - "type": "string" - }, - "rule": { - "type": "object", - "description": "CEL-based routing rule for intelligent request routing", - "properties": { - "id": { - "type": "string", - "description": "Unique identifier for the routing rule" - }, - "name": { - "type": "string", - "description": "Name of the routing rule" - }, - "description": { - "type": "string", - "description": "Description of what the rule does" - }, - "enabled": { - "type": "boolean", - "description": "Whether the rule is enabled and active" - }, - "cel_expression": { - "type": "string", - "description": "CEL (Common Expression Language) expression for matching" - }, - "targets": { - "type": "array", - "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", - "items": { - "type": "object", - "description": "A single weighted routing target within a routing rule", - "required": [ - "weight" - ], - "dependentRequired": { - "key_id": [ - "provider" - ] - }, - "properties": { - "provider": { - "type": "string", - "description": "Target provider (omit or empty to use the incoming request provider)", - "nullable": true - }, - "model": { - "type": "string", - "description": "Target model (omit or empty to use the incoming request model)", - "nullable": true - }, - "key_id": { - "type": "string", - "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", - "nullable": true - }, - "weight": { - "type": "number", - "format": "double", - "exclusiveMinimum": 0, - "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", - "example": 0.5 - } - } - } - }, - "fallbacks": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Fallback providers in format \"provider/model\"" - }, - "scope": { - "type": "string", - "enum": [ - "global", - "team", - "customer", - "virtual_key" - ], - "description": "Scope level for the rule" + }, + "404": { + "description": "Customer not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" }, - "scope_id": { - "type": "string", - "description": "ID for the scope (empty for global scope)", - "nullable": true + "code": { + "type": "string" }, - "priority": { - "type": "integer", - "description": "Priority for rule evaluation (lower number = higher priority)" + "message": { + "type": "string" }, - "query": { - "type": "object", - "description": "Visual rule tree structure from query builder", - "nullable": true + "param": { + "type": "string" }, - "created_at": { + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { "type": "string", - "format": "date-time" + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] }, - "updated_at": { - "type": "string", - "format": "date-time" - } - }, - "oneOf": [ - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "global" - ] - } - }, - "required": [ - "scope" - ], - "description": "Global scope routing rule" + "model_requested": { + "type": "string" }, - { - "type": "object", - "properties": { - "scope": { - "type": "string", - "enum": [ - "team", - "customer", - "virtual_key" - ] - }, - "scope_id": { - "type": "string" - } - }, - "required": [ - "scope", - "scope_id" - ], - "description": "Scoped routing rule (requires scope_id)" + "request_type": { + "type": "string" } - ] + } } } } } } }, - "400": { - "description": "Bad request", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { @@ -172211,14 +165868,51 @@ } } } + } + } + }, + "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": { + "type": "object", + "description": "Simple message response", + "properties": { + "message": { + "type": "string" + } + } + } + } + } }, "404": { - "description": "Routing rule not found", + "description": "Customer not found", "content": { "application/json": { "schema": { "type": "object", - "description": "Error response from Bifrost", + "description": "Error response", "properties": { "event_id": { "type": "string" @@ -172383,44 +166077,90 @@ } } } - }, - "delete": { - "operationId": "deleteRoutingRule", - "summary": "Delete routing rule", - "description": "Deletes a routing rule.", + } + }, + "/api/governance/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": "rule_id", - "in": "path", - "required": true, - "description": "Routing rule ID", + "name": "from_memory", + "in": "query", + "description": "If true, returns budgets from in-memory cache instead of database", "schema": { - "type": "string" + "type": "boolean", + "default": false } } ], "responses": { "200": { - "description": "Routing rule deleted successfully", + "description": "Successful response", "content": { "application/json": { "schema": { "type": "object", - "description": "Simple message response", + "description": "List budgets response", "properties": { - "message": { - "type": "string" + "budgets": { + "type": "array", + "items": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + } + }, + "count": { + "type": "integer" } } } } } }, - "404": { - "description": "Routing rule not found", + "500": { + "description": "Internal server error", "content": { "application/json": { "schema": { @@ -172503,6 +166243,101 @@ } } } + } + } + } + }, + "/api/governance/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": { + "type": "object", + "description": "List rate limits response", + "properties": { + "rate_limits": { + "type": "array", + "items": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + } + }, + "count": { + "type": "integer" + } + } + } + } + } }, "500": { "description": "Internal server error", @@ -172592,14 +166427,32 @@ } } }, - "/api/governance/model-configs": { + "/api/governance/routing-rules": { "get": { - "operationId": "listModelConfigs", - "summary": "List model configs", - "description": "Returns a list of all model configurations with their budget and rate limit settings.", + "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", @@ -172607,136 +166460,157 @@ "application/json": { "schema": { "type": "object", - "description": "Response containing list of model configs", + "description": "Response containing list of routing rules", "properties": { - "model_configs": { + "rules": { "type": "array", "items": { "type": "object", - "description": "Model configuration with budget and rate limit settings", + "description": "CEL-based routing rule for intelligent request routing", "properties": { "id": { "type": "string", - "description": "Unique identifier for the model config" + "description": "Unique identifier for the routing rule" }, - "model_name": { + "name": { "type": "string", - "description": "Name of the model" + "description": "Name of the routing rule" }, - "provider": { + "description": { "type": "string", - "description": "Provider name (optional - applies to all providers if not specified)" + "description": "Description of what the rule does" }, - "budget": { - "type": "object", - "description": "Budget configuration for this model", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } + "enabled": { + "type": "boolean", + "description": "Whether the rule is enabled and active" }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration for this model", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" + "cel_expression": { + "type": "string", + "description": "CEL (Common Expression Language) expression for matching" + }, + "targets": { + "type": "array", + "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", + "items": { + "type": "object", + "description": "A single weighted routing target within a routing rule", + "required": [ + "weight" + ], + "dependentRequired": { + "key_id": [ + "provider" + ] }, - "updated_at": { - "type": "string", - "format": "date-time" + "properties": { + "provider": { + "type": "string", + "description": "Target provider (omit or empty to use the incoming request provider)", + "nullable": true + }, + "model": { + "type": "string", + "description": "Target model (omit or empty to use the incoming request model)", + "nullable": true + }, + "key_id": { + "type": "string", + "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", + "nullable": true + }, + "weight": { + "type": "number", + "format": "double", + "exclusiveMinimum": 0, + "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", + "example": 0.5 + } } } }, + "fallbacks": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Fallback providers in format \"provider/model\"" + }, + "scope": { + "type": "string", + "enum": [ + "global", + "team", + "customer", + "virtual_key" + ], + "description": "Scope level for the rule" + }, + "scope_id": { + "type": "string", + "description": "ID for the scope (empty for global scope)", + "nullable": true + }, + "priority": { + "type": "integer", + "description": "Priority for rule evaluation (lower number = higher priority)" + }, + "query": { + "type": "object", + "description": "Visual rule tree structure from query builder", + "nullable": true + }, "created_at": { "type": "string", - "format": "date-time", - "description": "When this model config was created" + "format": "date-time" }, "updated_at": { "type": "string", - "format": "date-time", - "description": "When this model config was last updated" + "format": "date-time" } - } + }, + "oneOf": [ + { + "type": "object", + "properties": { + "scope": { + "type": "string", + "enum": [ + "global" + ] + } + }, + "required": [ + "scope" + ], + "description": "Global scope routing rule" + }, + { + "type": "object", + "properties": { + "scope": { + "type": "string", + "enum": [ + "team", + "customer", + "virtual_key" + ] + }, + "scope_id": { + "type": "string" + } + }, + "required": [ + "scope", + "scope_id" + ], + "description": "Scoped routing rule (requires scope_id)" + } + ] } }, "count": { "type": "integer", - "description": "Number of model configs returned" + "description": "Number of routing rules returned" } } } @@ -172831,9 +166705,9 @@ } }, "post": { - "operationId": "createModelConfig", - "summary": "Create model config", - "description": "Creates a new model configuration with budget and rate limit settings.", + "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" ], @@ -172843,198 +166717,300 @@ "application/json": { "schema": { "type": "object", - "description": "Request to create a new model config", + "description": "Request to create a routing rule", "required": [ - "model_name" + "name", + "cel_expression", + "scope", + "priority", + "targets" ], "properties": { - "model_name": { + "name": { "type": "string", - "description": "Name of the model (required)" + "description": "Name of the routing rule" }, - "provider": { + "description": { "type": "string", - "description": "Provider name (optional - applies to all providers if not specified)" + "description": "Optional description" }, - "budget": { - "type": "object", - "description": "Budget configuration", - "required": [ - "max_limit", - "reset_duration" - ], - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" + "enabled": { + "type": "boolean", + "description": "Whether the rule is enabled" + }, + "cel_expression": { + "type": "string", + "description": "CEL expression for matching" + }, + "targets": { + "type": "array", + "minItems": 1, + "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", + "items": { + "type": "object", + "description": "A single weighted routing target within a routing rule", + "required": [ + "weight" + ], + "dependentRequired": { + "key_id": [ + "provider" + ] }, - "calendar_aligned": { - "type": "boolean", - "default": false, - "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" + "properties": { + "provider": { + "type": "string", + "description": "Target provider (omit or empty to use the incoming request provider)", + "nullable": true + }, + "model": { + "type": "string", + "description": "Target model (omit or empty to use the incoming request model)", + "nullable": true + }, + "key_id": { + "type": "string", + "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", + "nullable": true + }, + "weight": { + "type": "number", + "format": "double", + "exclusiveMinimum": 0, + "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", + "example": 0.5 + } } } }, - "rate_limit": { + "fallbacks": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Fallback providers in format \"provider/model\"" + }, + "scope": { + "type": "string", + "enum": [ + "global", + "team", + "customer", + "virtual_key" + ], + "description": "Scope level for the rule" + }, + "scope_id": { + "type": "string", + "description": "ID for the scope (required if scope is not global)", + "nullable": true + }, + "priority": { + "type": "integer", + "description": "Priority for rule evaluation (lower number = higher priority)" + }, + "query": { + "type": "object", + "description": "Visual rule tree structure", + "nullable": true + } + }, + "oneOf": [ + { "type": "object", - "description": "Rate limit configuration", "properties": { - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "request_max_limit": { - "type": "integer", - "format": "int64" + "scope": { + "type": "string", + "enum": [ + "global" + ] + } + }, + "required": [ + "scope" + ], + "description": "Global scope routing rule" + }, + { + "type": "object", + "properties": { + "scope": { + "type": "string", + "enum": [ + "team", + "customer", + "virtual_key" + ] }, - "request_reset_duration": { + "scope_id": { "type": "string" } - } + }, + "required": [ + "scope", + "scope_id" + ], + "description": "Scoped routing rule (requires scope_id)" } - } + ] } } } }, "responses": { "200": { - "description": "Model config created successfully", + "description": "Routing rule created successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "Response containing a created/updated model config", + "description": "Response containing created/updated routing rule", "properties": { "message": { "type": "string" }, - "model_config": { + "rule": { "type": "object", - "description": "Model configuration with budget and rate limit settings", + "description": "CEL-based routing rule for intelligent request routing", "properties": { "id": { "type": "string", - "description": "Unique identifier for the model config" + "description": "Unique identifier for the routing rule" }, - "model_name": { + "name": { "type": "string", - "description": "Name of the model" + "description": "Name of the routing rule" }, - "provider": { + "description": { "type": "string", - "description": "Provider name (optional - applies to all providers if not specified)" + "description": "Description of what the rule does" }, - "budget": { - "type": "object", - "description": "Budget configuration for this model", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" + "enabled": { + "type": "boolean", + "description": "Whether the rule is enabled and active" + }, + "cel_expression": { + "type": "string", + "description": "CEL (Common Expression Language) expression for matching" + }, + "targets": { + "type": "array", + "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", + "items": { + "type": "object", + "description": "A single weighted routing target within a routing rule", + "required": [ + "weight" + ], + "dependentRequired": { + "key_id": [ + "provider" + ] }, - "updated_at": { - "type": "string", - "format": "date-time" + "properties": { + "provider": { + "type": "string", + "description": "Target provider (omit or empty to use the incoming request provider)", + "nullable": true + }, + "model": { + "type": "string", + "description": "Target model (omit or empty to use the incoming request model)", + "nullable": true + }, + "key_id": { + "type": "string", + "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", + "nullable": true + }, + "weight": { + "type": "number", + "format": "double", + "exclusiveMinimum": 0, + "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", + "example": 0.5 + } } } }, - "rate_limit": { + "fallbacks": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Fallback providers in format \"provider/model\"" + }, + "scope": { + "type": "string", + "enum": [ + "global", + "team", + "customer", + "virtual_key" + ], + "description": "Scope level for the rule" + }, + "scope_id": { + "type": "string", + "description": "ID for the scope (empty for global scope)", + "nullable": true + }, + "priority": { + "type": "integer", + "description": "Priority for rule evaluation (lower number = higher priority)" + }, + "query": { "type": "object", - "description": "Rate limit configuration for this model", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } + "description": "Visual rule tree structure from query builder", + "nullable": true }, "created_at": { "type": "string", - "format": "date-time", - "description": "When this model config was created" + "format": "date-time" }, "updated_at": { "type": "string", - "format": "date-time", - "description": "When this model config was last updated" + "format": "date-time" } - } + }, + "oneOf": [ + { + "type": "object", + "properties": { + "scope": { + "type": "string", + "enum": [ + "global" + ] + } + }, + "required": [ + "scope" + ], + "description": "Global scope routing rule" + }, + { + "type": "object", + "properties": { + "scope": { + "type": "string", + "enum": [ + "team", + "customer", + "virtual_key" + ] + }, + "scope_id": { + "type": "string" + } + }, + "required": [ + "scope", + "scope_id" + ], + "description": "Scoped routing rule (requires scope_id)" + } + ] } } } @@ -173214,20 +167190,20 @@ } } }, - "/api/governance/model-configs/{mc_id}": { + "/api/governance/routing-rules/{rule_id}": { "get": { - "operationId": "getModelConfig", - "summary": "Get model config", - "description": "Returns a specific model configuration by ID.", + "operationId": "getRoutingRule", + "summary": "Get routing rule", + "description": "Returns a specific routing rule by ID.", "tags": [ "Governance" ], "parameters": [ { - "name": "mc_id", + "name": "rule_id", "in": "path", "required": true, - "description": "Model config ID", + "description": "Routing rule ID", "schema": { "type": "string" } @@ -173241,127 +167217,148 @@ "schema": { "type": "object", "properties": { - "model_config": { + "rule": { "type": "object", - "description": "Model configuration with budget and rate limit settings", + "description": "CEL-based routing rule for intelligent request routing", "properties": { "id": { "type": "string", - "description": "Unique identifier for the model config" + "description": "Unique identifier for the routing rule" + }, + "name": { + "type": "string", + "description": "Name of the routing rule" + }, + "description": { + "type": "string", + "description": "Description of what the rule does" + }, + "enabled": { + "type": "boolean", + "description": "Whether the rule is enabled and active" + }, + "cel_expression": { + "type": "string", + "description": "CEL (Common Expression Language) expression for matching" + }, + "targets": { + "type": "array", + "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", + "items": { + "type": "object", + "description": "A single weighted routing target within a routing rule", + "required": [ + "weight" + ], + "dependentRequired": { + "key_id": [ + "provider" + ] + }, + "properties": { + "provider": { + "type": "string", + "description": "Target provider (omit or empty to use the incoming request provider)", + "nullable": true + }, + "model": { + "type": "string", + "description": "Target model (omit or empty to use the incoming request model)", + "nullable": true + }, + "key_id": { + "type": "string", + "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", + "nullable": true + }, + "weight": { + "type": "number", + "format": "double", + "exclusiveMinimum": 0, + "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", + "example": 0.5 + } + } + } + }, + "fallbacks": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Fallback providers in format \"provider/model\"" + }, + "scope": { + "type": "string", + "enum": [ + "global", + "team", + "customer", + "virtual_key" + ], + "description": "Scope level for the rule" }, - "model_name": { + "scope_id": { "type": "string", - "description": "Name of the model" + "description": "ID for the scope (empty for global scope)", + "nullable": true }, - "provider": { + "priority": { + "type": "integer", + "description": "Priority for rule evaluation (lower number = higher priority)" + }, + "query": { + "type": "object", + "description": "Visual rule tree structure from query builder", + "nullable": true + }, + "created_at": { "type": "string", - "description": "Provider name (optional - applies to all providers if not specified)" + "format": "date-time" }, - "budget": { + "updated_at": { + "type": "string", + "format": "date-time" + } + }, + "oneOf": [ + { "type": "object", - "description": "Budget configuration for this model", "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { + "scope": { "type": "string", - "format": "date-time" + "enum": [ + "global" + ] } - } + }, + "required": [ + "scope" + ], + "description": "Global scope routing rule" }, - "rate_limit": { + { "type": "object", - "description": "Rate limit configuration for this model", "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { + "scope": { "type": "string", - "format": "date-time" + "enum": [ + "team", + "customer", + "virtual_key" + ] }, - "updated_at": { - "type": "string", - "format": "date-time" + "scope_id": { + "type": "string" } - } - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "When this model config was created" - }, - "updated_at": { - "type": "string", - "format": "date-time", - "description": "When this model config was last updated" + }, + "required": [ + "scope", + "scope_id" + ], + "description": "Scoped routing rule (requires scope_id)" } - } + ] } } } @@ -173369,7 +167366,7 @@ } }, "404": { - "description": "Model config not found", + "description": "Routing rule not found", "content": { "application/json": { "schema": { @@ -173541,18 +167538,18 @@ } }, "put": { - "operationId": "updateModelConfig", - "summary": "Update model config", - "description": "Updates an existing model configuration's budget and rate limit settings.", + "operationId": "updateRoutingRule", + "summary": "Update routing rule", + "description": "Updates an existing routing rule's configuration.", "tags": [ "Governance" ], "parameters": [ { - "name": "mc_id", + "name": "rule_id", "in": "path", "required": true, - "description": "Model config ID", + "description": "Routing rule ID", "schema": { "type": "string" } @@ -173564,52 +167561,73 @@ "application/json": { "schema": { "type": "object", - "description": "Request to update an existing model config", + "description": "Request to update a routing rule (all fields optional; providing `targets` replaces all existing targets)", "properties": { - "model_name": { - "type": "string", - "description": "Name of the model" + "name": { + "type": "string" }, - "provider": { - "type": "string", - "description": "Provider name" + "description": { + "type": "string" }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" + "enabled": { + "type": "boolean" + }, + "cel_expression": { + "type": "string" + }, + "targets": { + "type": "array", + "minItems": 1, + "description": "Replaces all existing targets when provided; weights must sum to 1", + "items": { + "type": "object", + "description": "A single weighted routing target within a routing rule", + "required": [ + "weight" + ], + "dependentRequired": { + "key_id": [ + "provider" + ] }, - "calendar_aligned": { - "type": "boolean", - "nullable": true, - "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" + "properties": { + "provider": { + "type": "string", + "description": "Target provider (omit or empty to use the incoming request provider)", + "nullable": true + }, + "model": { + "type": "string", + "description": "Target model (omit or empty to use the incoming request model)", + "nullable": true + }, + "key_id": { + "type": "string", + "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", + "nullable": true + }, + "weight": { + "type": "number", + "format": "double", + "exclusiveMinimum": 0, + "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", + "example": 0.5 + } } } }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "request_max_limit": { - "type": "integer", - "format": "int64" - }, - "request_reset_duration": { - "type": "string" - } + "fallbacks": { + "type": "array", + "items": { + "type": "string" } + }, + "priority": { + "type": "integer" + }, + "query": { + "type": "object", + "nullable": true } } } @@ -173618,137 +167636,158 @@ }, "responses": { "200": { - "description": "Model config updated successfully", + "description": "Routing rule updated successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "Response containing a created/updated model config", + "description": "Response containing created/updated routing rule", "properties": { "message": { "type": "string" }, - "model_config": { + "rule": { "type": "object", - "description": "Model configuration with budget and rate limit settings", + "description": "CEL-based routing rule for intelligent request routing", "properties": { "id": { "type": "string", - "description": "Unique identifier for the model config" + "description": "Unique identifier for the routing rule" }, - "model_name": { + "name": { "type": "string", - "description": "Name of the model" + "description": "Name of the routing rule" }, - "provider": { + "description": { "type": "string", - "description": "Provider name (optional - applies to all providers if not specified)" + "description": "Description of what the rule does" }, - "budget": { - "type": "object", - "description": "Budget configuration for this model", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" + "enabled": { + "type": "boolean", + "description": "Whether the rule is enabled and active" + }, + "cel_expression": { + "type": "string", + "description": "CEL (Common Expression Language) expression for matching" + }, + "targets": { + "type": "array", + "description": "Weighted routing targets; weights must sum to 1; target is selected probabilistically at request time", + "items": { + "type": "object", + "description": "A single weighted routing target within a routing rule", + "required": [ + "weight" + ], + "dependentRequired": { + "key_id": [ + "provider" + ] }, - "updated_at": { - "type": "string", - "format": "date-time" + "properties": { + "provider": { + "type": "string", + "description": "Target provider (omit or empty to use the incoming request provider)", + "nullable": true + }, + "model": { + "type": "string", + "description": "Target model (omit or empty to use the incoming request model)", + "nullable": true + }, + "key_id": { + "type": "string", + "description": "UUID of the API key to pin for this target (omit for load-balanced key selection)", + "nullable": true + }, + "weight": { + "type": "number", + "format": "double", + "exclusiveMinimum": 0, + "description": "Probability weight for this target (must be > 0; all target weights in a rule must sum to 1, e.g. 0.7 + 0.3 = 1.0)", + "example": 0.5 + } } } }, - "rate_limit": { + "fallbacks": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Fallback providers in format \"provider/model\"" + }, + "scope": { + "type": "string", + "enum": [ + "global", + "team", + "customer", + "virtual_key" + ], + "description": "Scope level for the rule" + }, + "scope_id": { + "type": "string", + "description": "ID for the scope (empty for global scope)", + "nullable": true + }, + "priority": { + "type": "integer", + "description": "Priority for rule evaluation (lower number = higher priority)" + }, + "query": { "type": "object", - "description": "Rate limit configuration for this model", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } + "description": "Visual rule tree structure from query builder", + "nullable": true }, "created_at": { "type": "string", - "format": "date-time", - "description": "When this model config was created" + "format": "date-time" }, "updated_at": { "type": "string", - "format": "date-time", - "description": "When this model config was last updated" + "format": "date-time" + } + }, + "oneOf": [ + { + "type": "object", + "properties": { + "scope": { + "type": "string", + "enum": [ + "global" + ] + } + }, + "required": [ + "scope" + ], + "description": "Global scope routing rule" + }, + { + "type": "object", + "properties": { + "scope": { + "type": "string", + "enum": [ + "team", + "customer", + "virtual_key" + ] + }, + "scope_id": { + "type": "string" + } + }, + "required": [ + "scope", + "scope_id" + ], + "description": "Scoped routing rule (requires scope_id)" } - } + ] } } } @@ -173841,7 +167880,7 @@ } }, "404": { - "description": "Model config not found", + "description": "Routing rule not found", "content": { "application/json": { "schema": { @@ -174013,18 +168052,18 @@ } }, "delete": { - "operationId": "deleteModelConfig", - "summary": "Delete model config", - "description": "Deletes a model configuration.", + "operationId": "deleteRoutingRule", + "summary": "Delete routing rule", + "description": "Deletes a routing rule.", "tags": [ "Governance" ], "parameters": [ { - "name": "mc_id", + "name": "rule_id", "in": "path", "required": true, - "description": "Model config ID", + "description": "Routing rule ID", "schema": { "type": "string" } @@ -174032,7 +168071,7 @@ ], "responses": { "200": { - "description": "Model config deleted successfully", + "description": "Routing rule deleted successfully", "content": { "application/json": { "schema": { @@ -174048,7 +168087,7 @@ } }, "404": { - "description": "Model config not found", + "description": "Routing rule not found", "content": { "application/json": { "schema": { @@ -174220,11 +168259,11 @@ } } }, - "/api/governance/providers": { + "/api/governance/model-configs": { "get": { - "operationId": "listProviderGovernance", - "summary": "List provider governance", - "description": "Returns a list of all providers with their governance settings (budget and rate limits).", + "operationId": "listModelConfigs", + "summary": "List model configs", + "description": "Returns a list of all model configurations with their budget and rate limit settings.", "tags": [ "Governance" ], @@ -174235,21 +168274,29 @@ "application/json": { "schema": { "type": "object", - "description": "Response containing list of provider governance settings", + "description": "Response containing list of model configs", "properties": { - "providers": { + "model_configs": { "type": "array", "items": { "type": "object", - "description": "Response containing provider governance settings", + "description": "Model configuration with budget and rate limit settings", "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the model config" + }, + "model_name": { + "type": "string", + "description": "Name of the model" + }, "provider": { "type": "string", - "description": "Provider name" + "description": "Provider name (optional - applies to all providers if not specified)" }, "budget": { "type": "object", - "description": "Budget configuration", + "description": "Budget configuration for this model", "properties": { "id": { "type": "string" @@ -174290,502 +168337,73 @@ }, "rate_limit": { "type": "object", - "description": "Rate limit configuration", + "description": "Rate limit configuration for this model", "properties": { "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - } - } - }, - "count": { - "type": "integer", - "description": "Number of providers with governance settings" - } - } - } - } - } - }, - "500": { - "description": "Internal server error", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - } - } - } - }, - "/api/governance/providers/{provider_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": { - "type": "object", - "description": "Request to update provider governance settings", - "properties": { - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "max_limit": { - "type": "number" - }, - "reset_duration": { - "type": "string" - }, - "calendar_aligned": { - "type": "boolean", - "nullable": true, - "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "request_max_limit": { - "type": "integer", - "format": "int64" - }, - "request_reset_duration": { - "type": "string" - } - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Provider governance updated successfully", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Response containing provider governance settings", - "properties": { - "provider": { - "type": "string", - "description": "Provider name" - }, - "budget": { - "type": "object", - "description": "Budget configuration", - "properties": { - "id": { - "type": "string" - }, - "max_limit": { - "type": "number", - "description": "Maximum budget in dollars" - }, - "reset_duration": { - "type": "string", - "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" - }, - "calendar_aligned": { - "type": "boolean", - "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", - "default": false - }, - "last_reset": { - "type": "string", - "format": "date-time" - }, - "current_usage": { - "type": "number" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "rate_limit": { - "type": "object", - "description": "Rate limit configuration", - "properties": { - "id": { - "type": "string" - }, - "token_max_limit": { - "type": "integer", - "format": "int64" - }, - "token_reset_duration": { - "type": "string" - }, - "token_current_usage": { - "type": "integer", - "format": "int64" - }, - "token_last_reset": { - "type": "string", - "format": "date-time" - }, - "request_max_limit": { - "type": "integer", - "format": "int64", - "nullable": true - }, - "request_reset_duration": { - "type": "string", - "nullable": true - }, - "request_current_usage": { - "type": "integer", - "format": "int64" - }, - "request_last_reset": { - "type": "string", - "format": "date-time" - }, - "config_hash": { - "type": "string", - "nullable": true - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad request", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" - } - } - }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } - } - } - } - } - } - }, - "404": { - "description": "Provider not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Error response from Bifrost", - "properties": { - "event_id": { - "type": "string" - }, - "type": { - "type": "string" - }, - "is_bifrost_error": { - "type": "boolean" - }, - "status_code": { - "type": "integer" - }, - "error": { - "type": "object", - "properties": { - "type": { - "type": "string" - }, - "code": { - "type": "string" - }, - "message": { - "type": "string" - }, - "param": { - "type": "string" - }, - "event_id": { - "type": "string" + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "When this model config was created" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "When this model config was last updated" + } } } }, - "extra_fields": { - "type": "object", - "properties": { - "provider": { - "type": "string", - "description": "AI model provider identifier", - "enum": [ - "openai", - "azure", - "anthropic", - "bedrock", - "cohere", - "vertex", - "vllm", - "mistral", - "ollama", - "groq", - "sgl", - "parasail", - "perplexity", - "replicate", - "cerebras", - "gemini", - "openrouter", - "elevenlabs", - "huggingface", - "nebius", - "xai", - "runway", - "fireworks" - ] - }, - "model_requested": { - "type": "string" - }, - "request_type": { - "type": "string" - } - } + "count": { + "type": "integer", + "description": "Number of model configs returned" } } } @@ -174879,43 +168497,219 @@ } } }, - "delete": { - "operationId": "deleteProviderGovernance", - "summary": "Delete provider governance", - "description": "Removes governance settings (budget and rate limits) for a specific provider.", + "post": { + "operationId": "createModelConfig", + "summary": "Create model config", + "description": "Creates a new model configuration with budget and rate limit settings.", "tags": [ "Governance" ], - "parameters": [ - { - "name": "provider_name", - "in": "path", - "required": true, - "description": "Provider name", - "schema": { - "type": "string" + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Request to create a new model config", + "required": [ + "model_name" + ], + "properties": { + "model_name": { + "type": "string", + "description": "Name of the model (required)" + }, + "provider": { + "type": "string", + "description": "Provider name (optional - applies to all providers if not specified)" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "required": [ + "max_limit", + "reset_duration" + ], + "properties": { + "max_limit": { + "type": "number" + }, + "reset_duration": { + "type": "string" + }, + "calendar_aligned": { + "type": "boolean", + "default": false, + "description": "When true, usage resets at the start of each calendar period in UTC instead of on a rolling window from last reset. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`). For example `1d` resets at midnight UTC; `1w` at Monday 00:00 UTC; `1M` on the first day of each month; `1Y` on January 1. Sub-day durations (e.g. `1h`) cannot use calendar alignment.\n" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "request_max_limit": { + "type": "integer", + "format": "int64" + }, + "request_reset_duration": { + "type": "string" + } + } + } + } + } } } - ], + }, "responses": { "200": { - "description": "Provider governance deleted successfully", + "description": "Model config created successfully", "content": { "application/json": { "schema": { "type": "object", - "description": "Simple message response", + "description": "Response containing a created/updated model config", "properties": { "message": { "type": "string" + }, + "model_config": { + "type": "object", + "description": "Model configuration with budget and rate limit settings", + "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the model config" + }, + "model_name": { + "type": "string", + "description": "Name of the model" + }, + "provider": { + "type": "string", + "description": "Provider name (optional - applies to all providers if not specified)" + }, + "budget": { + "type": "object", + "description": "Budget configuration for this model", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration for this model", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "When this model config was created" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "When this model config was last updated" + } + } } } } } } }, - "404": { - "description": "Provider not found", + "400": { + "description": "Bad request", "content": { "application/json": { "schema": { @@ -175087,51 +168881,20 @@ } } }, - "/api/governance/pricing-overrides": { + "/api/governance/model-configs/{mc_id}": { "get": { - "operationId": "listPricingOverrides", - "summary": "List pricing overrides", - "description": "Returns all pricing overrides, optionally filtered by scope.", + "operationId": "getModelConfig", + "summary": "Get model config", + "description": "Returns a specific model configuration by ID.", "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", + "name": "mc_id", + "in": "path", + "required": true, + "description": "Model config ID", "schema": { "type": "string" } @@ -175145,287 +168908,135 @@ "schema": { "type": "object", "properties": { - "pricing_overrides": { - "type": "array", - "items": { - "type": "object", - "description": "A pricing override that applies custom rates to matching requests.", - "properties": { - "id": { - "type": "string", - "description": "Unique override ID (UUID)" - }, - "name": { - "type": "string", - "description": "Human-readable label" - }, - "scope_kind": { - "type": "string", - "enum": [ - "global", - "provider", - "provider_key", - "virtual_key", - "virtual_key_provider", - "virtual_key_provider_key" - ], - "description": "Scope that determines which requests this override applies to" - }, - "virtual_key_id": { - "type": "string", - "nullable": true, - "description": "Required for virtual_key* scopes" - }, - "provider_id": { - "type": "string", - "nullable": true, - "description": "Required for provider and virtual_key_provider scopes" - }, - "provider_key_id": { - "type": "string", - "nullable": true, - "description": "Required for provider_key and virtual_key_provider_key scopes" - }, - "match_type": { - "type": "string", - "enum": [ - "exact", - "wildcard" - ], - "description": "How the pattern is matched against the model name" - }, - "pattern": { - "type": "string", - "description": "Model name or wildcard prefix (e.g. \"gpt-4o\" or \"claude-3*\")" - }, - "request_types": { - "type": "array", - "minItems": 1, - "items": { + "model_config": { + "type": "object", + "description": "Model configuration with budget and rate limit settings", + "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the model config" + }, + "model_name": { + "type": "string", + "description": "Name of the model" + }, + "provider": { + "type": "string", + "description": "Provider name (optional - applies to all providers if not specified)" + }, + "budget": { + "type": "object", + "description": "Budget configuration for this model", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration for this model", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { "type": "string", - "description": "Request type for pricing override filtering. Stream variants are treated identically to their base type — specifying `chat_completion` covers both streaming and non-streaming chat requests.\n", - "enum": [ - "chat_completion", - "text_completion", - "responses", - "embedding", - "rerank", - "speech", - "transcription", - "image_generation", - "image_variation", - "image_edit", - "video_generation", - "video_remix" - ] + "format": "date-time" }, - "description": "Request types this override applies to. At least one value is required." - }, - "pricing_patch": { - "type": "string", - "description": "JSON-encoded pricing fields to override (as stored in the database)" - }, - "patch": { - "type": "object", - "description": "Decoded pricing fields (present in API responses)", - "properties": { - "input_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_character": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_priority": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_image_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_audio_token_cost": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_low_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_medium_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_high_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_auto_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_premium_image": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_512_and_512_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_1024_and_1024_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_2048_and_2048_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_4096_and_4096_pixels": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_audio_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_audio_token": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_audio_per_second": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_second": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_video_per_second": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_video_per_second": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_second": { - "type": "number", - "minimum": 0 - }, - "search_context_cost_per_query": { - "type": "number", - "minimum": 0 - }, - "code_interpreter_cost_per_session": { - "type": "number", - "minimum": 0 - } + "updated_at": { + "type": "string", + "format": "date-time" } - }, - "config_hash": { - "type": "string", - "nullable": true, - "description": "Auto-managed hash for config-file-sourced overrides. Do not set manually." - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" } + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "When this model config was created" + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "When this model config was last updated" } } - }, - "count": { - "type": "integer", - "description": "Total number of overrides returned" } } } } } }, - "500": { - "description": "Internal server error", + "404": { + "description": "Model config not found", "content": { "application/json": { "schema": { @@ -175508,263 +169119,162 @@ } } } - } - } - }, - "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": { - "type": "object", - "description": "Request body for creating a pricing override.", - "required": [ - "name", - "scope_kind", - "match_type", - "pattern", - "request_types" - ], - "properties": { - "name": { - "type": "string", - "description": "Human-readable label" - }, - "scope_kind": { - "type": "string", - "enum": [ - "global", - "provider", - "provider_key", - "virtual_key", - "virtual_key_provider", - "virtual_key_provider_key" - ] - }, - "virtual_key_id": { - "type": "string", - "description": "Required for virtual_key* scopes" - }, - "provider_id": { - "type": "string", - "description": "Required for provider and virtual_key_provider scopes" - }, - "provider_key_id": { - "type": "string", - "description": "Required for provider_key and virtual_key_provider_key scopes" - }, - "match_type": { - "type": "string", - "enum": [ - "exact", - "wildcard" - ] - }, - "pattern": { - "type": "string", - "description": "Model name or wildcard prefix ending with * (e.g. \"claude-3*\")" - }, - "request_types": { - "type": "array", - "minItems": 1, - "items": { - "type": "string", - "description": "Request type for pricing override filtering. Stream variants are treated identically to their base type — specifying `chat_completion` covers both streaming and non-streaming chat requests.\n", - "enum": [ - "chat_completion", - "text_completion", - "responses", - "embedding", - "rerank", - "speech", - "transcription", - "image_generation", - "image_variation", - "image_edit", - "video_generation", - "video_remix" - ] + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" }, - "description": "Request types this override applies to. At least one value is required." - }, - "patch": { - "type": "object", - "description": "Pricing fields to override. Only non-zero/non-null fields are applied. All values are cost per unit in USD.\n", - "properties": { - "input_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_character": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_priority": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_image_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_audio_token_cost": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_low_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_medium_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_high_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_auto_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_premium_image": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_512_and_512_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_1024_and_1024_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_2048_and_2048_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_4096_and_4096_pixels": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_audio_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_audio_token": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_audio_per_second": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_second": { - "type": "number", - "minimum": 0 + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "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": { + "type": "object", + "description": "Request to update an existing model config", + "properties": { + "model_name": { + "type": "string", + "description": "Name of the model" + }, + "provider": { + "type": "string", + "description": "Provider name" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "max_limit": { + "type": "number" }, - "input_cost_per_video_per_second": { - "type": "number", - "minimum": 0 + "reset_duration": { + "type": "string" }, - "output_cost_per_video_per_second": { - "type": "number", - "minimum": 0 + "calendar_aligned": { + "type": "boolean", + "nullable": true, + "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "token_max_limit": { + "type": "integer", + "format": "int64" }, - "output_cost_per_second": { - "type": "number", - "minimum": 0 + "token_reset_duration": { + "type": "string" }, - "search_context_cost_per_query": { - "type": "number", - "minimum": 0 + "request_max_limit": { + "type": "integer", + "format": "int64" }, - "code_interpreter_cost_per_session": { - "type": "number", - "minimum": 0 + "request_reset_duration": { + "type": "string" } } } @@ -175774,280 +169284,221 @@ } }, "responses": { - "201": { - "description": "Pricing override created successfully", + "200": { + "description": "Model config updated successfully", "content": { "application/json": { "schema": { "type": "object", + "description": "Response containing a created/updated model config", "properties": { "message": { "type": "string" }, - "pricing_override": { + "model_config": { "type": "object", - "description": "A pricing override that applies custom rates to matching requests.", + "description": "Model configuration with budget and rate limit settings", "properties": { "id": { "type": "string", - "description": "Unique override ID (UUID)" - }, - "name": { - "type": "string", - "description": "Human-readable label" - }, - "scope_kind": { - "type": "string", - "enum": [ - "global", - "provider", - "provider_key", - "virtual_key", - "virtual_key_provider", - "virtual_key_provider_key" - ], - "description": "Scope that determines which requests this override applies to" - }, - "virtual_key_id": { - "type": "string", - "nullable": true, - "description": "Required for virtual_key* scopes" - }, - "provider_id": { - "type": "string", - "nullable": true, - "description": "Required for provider and virtual_key_provider scopes" - }, - "provider_key_id": { - "type": "string", - "nullable": true, - "description": "Required for provider_key and virtual_key_provider_key scopes" - }, - "match_type": { - "type": "string", - "enum": [ - "exact", - "wildcard" - ], - "description": "How the pattern is matched against the model name" + "description": "Unique identifier for the model config" }, - "pattern": { + "model_name": { "type": "string", - "description": "Model name or wildcard prefix (e.g. \"gpt-4o\" or \"claude-3*\")" - }, - "request_types": { - "type": "array", - "minItems": 1, - "items": { - "type": "string", - "description": "Request type for pricing override filtering. Stream variants are treated identically to their base type — specifying `chat_completion` covers both streaming and non-streaming chat requests.\n", - "enum": [ - "chat_completion", - "text_completion", - "responses", - "embedding", - "rerank", - "speech", - "transcription", - "image_generation", - "image_variation", - "image_edit", - "video_generation", - "video_remix" - ] - }, - "description": "Request types this override applies to. At least one value is required." + "description": "Name of the model" }, - "pricing_patch": { + "provider": { "type": "string", - "description": "JSON-encoded pricing fields to override (as stored in the database)" + "description": "Provider name (optional - applies to all providers if not specified)" }, - "patch": { + "budget": { "type": "object", - "description": "Decoded pricing fields (present in API responses)", + "description": "Budget configuration for this model", "properties": { - "input_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_character": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_priority": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_image_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_audio_token_cost": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image_token": { - "type": "number", - "minimum": 0 + "id": { + "type": "string" }, - "output_cost_per_image_token": { + "max_limit": { "type": "number", - "minimum": 0 + "description": "Maximum budget in dollars" }, - "output_cost_per_image_low_quality": { - "type": "number", - "minimum": 0 + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" }, - "output_cost_per_image_medium_quality": { - "type": "number", - "minimum": 0 + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false }, - "output_cost_per_image_high_quality": { - "type": "number", - "minimum": 0 + "last_reset": { + "type": "string", + "format": "date-time" }, - "output_cost_per_image_auto_quality": { - "type": "number", - "minimum": 0 + "current_usage": { + "type": "number" }, - "output_cost_per_image_premium_image": { - "type": "number", - "minimum": 0 + "config_hash": { + "type": "string", + "nullable": true }, - "output_cost_per_image_above_512_and_512_pixels": { - "type": "number", - "minimum": 0 + "created_at": { + "type": "string", + "format": "date-time" }, - "output_cost_per_image_above_1024_and_1024_pixels": { - "type": "number", - "minimum": 0 + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration for this model", + "properties": { + "id": { + "type": "string" }, - "output_cost_per_image_above_2048_and_2048_pixels": { - "type": "number", - "minimum": 0 + "token_max_limit": { + "type": "integer", + "format": "int64" }, - "output_cost_per_image_above_4096_and_4096_pixels": { - "type": "number", - "minimum": 0 + "token_reset_duration": { + "type": "string" }, - "input_cost_per_audio_token": { - "type": "number", - "minimum": 0 + "token_current_usage": { + "type": "integer", + "format": "int64" }, - "output_cost_per_audio_token": { - "type": "number", - "minimum": 0 + "token_last_reset": { + "type": "string", + "format": "date-time" }, - "input_cost_per_audio_per_second": { - "type": "number", - "minimum": 0 + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true }, - "input_cost_per_second": { - "type": "number", - "minimum": 0 + "request_reset_duration": { + "type": "string", + "nullable": true }, - "input_cost_per_video_per_second": { - "type": "number", - "minimum": 0 + "request_current_usage": { + "type": "integer", + "format": "int64" }, - "output_cost_per_video_per_second": { - "type": "number", - "minimum": 0 + "request_last_reset": { + "type": "string", + "format": "date-time" }, - "output_cost_per_second": { - "type": "number", - "minimum": 0 + "config_hash": { + "type": "string", + "nullable": true }, - "search_context_cost_per_query": { - "type": "number", - "minimum": 0 + "created_at": { + "type": "string", + "format": "date-time" }, - "code_interpreter_cost_per_session": { - "type": "number", - "minimum": 0 + "updated_at": { + "type": "string", + "format": "date-time" } } }, - "config_hash": { + "created_at": { "type": "string", - "nullable": true, - "description": "Auto-managed hash for config-file-sourced overrides. Do not set manually." + "format": "date-time", + "description": "When this model config was created" }, - "created_at": { + "updated_at": { "type": "string", - "format": "date-time" + "format": "date-time", + "description": "When this model config was last updated" + } + } + } + } + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" }, - "updated_at": { - "type": "string", - "format": "date-time" + "request_type": { + "type": "string" } } } @@ -176056,8 +169507,8 @@ } } }, - "400": { - "description": "Bad request", + "404": { + "description": "Model config not found", "content": { "application/json": { "schema": { @@ -176227,267 +169678,497 @@ } } } - } - }, - "/api/governance/pricing-overrides/{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.", + }, + "delete": { + "operationId": "deleteModelConfig", + "summary": "Delete model config", + "description": "Deletes a model configuration.", "tags": [ "Governance" ], "parameters": [ { - "name": "id", + "name": "mc_id", "in": "path", "required": true, - "description": "Pricing override ID", + "description": "Model config ID", "schema": { "type": "string" } } ], - "requestBody": { - "required": true, - "content": { - "application/json": { - "schema": { - "type": "object", - "description": "Request body for updating a pricing override. All fields are optional — omitted fields are merged from the existing record. The `patch` field is always replaced in full when provided.\n", - "properties": { - "name": { - "type": "string", - "description": "Human-readable label" - }, - "scope_kind": { - "type": "string", - "enum": [ - "global", - "provider", - "provider_key", - "virtual_key", - "virtual_key_provider", - "virtual_key_provider_key" - ] - }, - "virtual_key_id": { - "type": "string", - "description": "Required for virtual_key* scopes" - }, - "provider_id": { - "type": "string", - "description": "Required for provider and virtual_key_provider scopes" - }, - "provider_key_id": { - "type": "string", - "description": "Required for provider_key and virtual_key_provider_key scopes" - }, - "match_type": { - "type": "string", - "enum": [ - "exact", - "wildcard" - ] - }, - "pattern": { - "type": "string", - "description": "Model name or wildcard prefix ending with * (e.g. \"claude-3*\")" - }, - "request_types": { - "type": "array", - "minItems": 1, - "items": { - "type": "string", - "description": "Request type for pricing override filtering. Stream variants are treated identically to their base type — specifying `chat_completion` covers both streaming and non-streaming chat requests.\n", - "enum": [ - "chat_completion", - "text_completion", - "responses", - "embedding", - "rerank", - "speech", - "transcription", - "image_generation", - "image_variation", - "image_edit", - "video_generation", - "video_remix" - ] + "responses": { + "200": { + "description": "Model config deleted successfully", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Simple message response", + "properties": { + "message": { + "type": "string" + } + } + } + } + } + }, + "404": { + "description": "Model config not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" }, - "description": "Request types this override applies to." - }, - "patch": { + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/api/governance/providers": { + "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": { + "type": "object", + "description": "Response containing list of provider governance settings", + "properties": { + "providers": { + "type": "array", + "items": { + "type": "object", + "description": "Response containing provider governance settings", + "properties": { + "provider": { + "type": "string", + "description": "Provider name" + }, + "budget": { + "type": "object", + "description": "Budget configuration", + "properties": { + "id": { + "type": "string" + }, + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" + }, + "reset_duration": { + "type": "string", + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" + }, + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { + "type": "string", + "format": "date-time" + }, + "current_usage": { + "type": "number" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" + }, + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { + "type": "string", + "format": "date-time" + }, + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true + }, + "request_reset_duration": { + "type": "string", + "nullable": true + }, + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" + }, + "config_hash": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + }, + "count": { + "type": "integer", + "description": "Number of providers with governance settings" + } + } + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + } + } + } + }, + "/api/governance/providers/{provider_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": { + "type": "object", + "description": "Request to update provider governance settings", + "properties": { + "budget": { "type": "object", - "description": "Pricing fields to override. Only non-zero/non-null fields are applied. All values are cost per unit in USD.\n", + "description": "Budget configuration", "properties": { - "input_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_character": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_priority": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_image_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_audio_token_cost": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_low_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_medium_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_high_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_auto_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_premium_image": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_512_and_512_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_1024_and_1024_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_2048_and_2048_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_4096_and_4096_pixels": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_audio_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_audio_token": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_audio_per_second": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_second": { - "type": "number", - "minimum": 0 + "max_limit": { + "type": "number" }, - "input_cost_per_video_per_second": { - "type": "number", - "minimum": 0 + "reset_duration": { + "type": "string" }, - "output_cost_per_video_per_second": { - "type": "number", - "minimum": 0 + "calendar_aligned": { + "type": "boolean", + "nullable": true, + "description": "Set to true or false to enable or disable calendar-aligned resets. Only valid with reset durations that use day, week, month, or year suffixes (`d`, `w`, `M`, `Y`); sub-day durations (e.g. `1h`, `30m`) are invalid with calendar alignment and the API rejects that combination. When enabling on an existing budget, current usage is reset to zero and last_reset snaps to the current period start.\n" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "token_max_limit": { + "type": "integer", + "format": "int64" }, - "output_cost_per_second": { - "type": "number", - "minimum": 0 + "token_reset_duration": { + "type": "string" }, - "search_context_cost_per_query": { - "type": "number", - "minimum": 0 + "request_max_limit": { + "type": "integer", + "format": "int64" }, - "code_interpreter_cost_per_session": { - "type": "number", - "minimum": 0 + "request_reset_duration": { + "type": "string" } } } @@ -176498,271 +170179,100 @@ }, "responses": { "200": { - "description": "Pricing override updated successfully", + "description": "Provider governance updated successfully", "content": { "application/json": { "schema": { "type": "object", + "description": "Response containing provider governance settings", "properties": { - "message": { - "type": "string" + "provider": { + "type": "string", + "description": "Provider name" }, - "pricing_override": { + "budget": { "type": "object", - "description": "A pricing override that applies custom rates to matching requests.", + "description": "Budget configuration", "properties": { "id": { - "type": "string", - "description": "Unique override ID (UUID)" + "type": "string" }, - "name": { - "type": "string", - "description": "Human-readable label" + "max_limit": { + "type": "number", + "description": "Maximum budget in dollars" }, - "scope_kind": { + "reset_duration": { "type": "string", - "enum": [ - "global", - "provider", - "provider_key", - "virtual_key", - "virtual_key_provider", - "virtual_key_provider_key" - ], - "description": "Scope that determines which requests this override applies to" + "description": "Reset duration (e.g., \"30s\", \"5m\", \"1h\", \"1d\", \"1w\", \"1M\")" }, - "virtual_key_id": { + "calendar_aligned": { + "type": "boolean", + "description": "When true, resets align to calendar period boundaries in UTC (not rolling from last reset)", + "default": false + }, + "last_reset": { "type": "string", - "nullable": true, - "description": "Required for virtual_key* scopes" + "format": "date-time" }, - "provider_id": { + "current_usage": { + "type": "number" + }, + "config_hash": { "type": "string", - "nullable": true, - "description": "Required for provider and virtual_key_provider scopes" + "nullable": true }, - "provider_key_id": { + "created_at": { "type": "string", - "nullable": true, - "description": "Required for provider_key and virtual_key_provider_key scopes" + "format": "date-time" }, - "match_type": { + "updated_at": { "type": "string", - "enum": [ - "exact", - "wildcard" - ], - "description": "How the pattern is matched against the model name" + "format": "date-time" + } + } + }, + "rate_limit": { + "type": "object", + "description": "Rate limit configuration", + "properties": { + "id": { + "type": "string" }, - "pattern": { + "token_max_limit": { + "type": "integer", + "format": "int64" + }, + "token_reset_duration": { + "type": "string" + }, + "token_current_usage": { + "type": "integer", + "format": "int64" + }, + "token_last_reset": { "type": "string", - "description": "Model name or wildcard prefix (e.g. \"gpt-4o\" or \"claude-3*\")" + "format": "date-time" }, - "request_types": { - "type": "array", - "minItems": 1, - "items": { - "type": "string", - "description": "Request type for pricing override filtering. Stream variants are treated identically to their base type — specifying `chat_completion` covers both streaming and non-streaming chat requests.\n", - "enum": [ - "chat_completion", - "text_completion", - "responses", - "embedding", - "rerank", - "speech", - "transcription", - "image_generation", - "image_variation", - "image_edit", - "video_generation", - "video_remix" - ] - }, - "description": "Request types this override applies to. At least one value is required." + "request_max_limit": { + "type": "integer", + "format": "int64", + "nullable": true }, - "pricing_patch": { + "request_reset_duration": { "type": "string", - "description": "JSON-encoded pricing fields to override (as stored in the database)" + "nullable": true }, - "patch": { - "type": "object", - "description": "Decoded pricing fields (present in API responses)", - "properties": { - "input_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_batches": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_priority": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_character": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_128k_tokens": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_token_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_above_200k_tokens": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_token_cost_priority": { - "type": "number", - "minimum": 0 - }, - "cache_read_input_image_token_cost": { - "type": "number", - "minimum": 0 - }, - "cache_creation_input_audio_token_cost": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_pixel": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_image_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_low_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_medium_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_high_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_auto_quality": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_premium_image": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_512_and_512_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_1024_and_1024_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_2048_and_2048_pixels": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_image_above_4096_and_4096_pixels": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_audio_token": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_audio_token": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_audio_per_second": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_second": { - "type": "number", - "minimum": 0 - }, - "input_cost_per_video_per_second": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_video_per_second": { - "type": "number", - "minimum": 0 - }, - "output_cost_per_second": { - "type": "number", - "minimum": 0 - }, - "search_context_cost_per_query": { - "type": "number", - "minimum": 0 - }, - "code_interpreter_cost_per_session": { - "type": "number", - "minimum": 0 - } - } + "request_current_usage": { + "type": "integer", + "format": "int64" + }, + "request_last_reset": { + "type": "string", + "format": "date-time" }, "config_hash": { "type": "string", - "nullable": true, - "description": "Auto-managed hash for config-file-sourced overrides. Do not set manually." + "nullable": true }, "created_at": { "type": "string", @@ -176865,7 +170375,7 @@ } }, "404": { - "description": "Pricing override not found", + "description": "Provider not found", "content": { "application/json": { "schema": { @@ -177037,18 +170547,18 @@ } }, "delete": { - "operationId": "deletePricingOverride", - "summary": "Delete pricing override", - "description": "Deletes a pricing override by ID.", + "operationId": "deleteProviderGovernance", + "summary": "Delete provider governance", + "description": "Removes governance settings (budget and rate limits) for a specific provider.", "tags": [ "Governance" ], "parameters": [ { - "name": "id", + "name": "provider_name", "in": "path", "required": true, - "description": "Pricing override ID", + "description": "Provider name", "schema": { "type": "string" } @@ -177056,7 +170566,7 @@ ], "responses": { "200": { - "description": "Pricing override deleted successfully", + "description": "Provider governance deleted successfully", "content": { "application/json": { "schema": { @@ -177071,6 +170581,91 @@ } } }, + "404": { + "description": "Provider not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "description": "Error response from Bifrost", + "properties": { + "event_id": { + "type": "string" + }, + "type": { + "type": "string" + }, + "is_bifrost_error": { + "type": "boolean" + }, + "status_code": { + "type": "integer" + }, + "error": { + "type": "object", + "properties": { + "type": { + "type": "string" + }, + "code": { + "type": "string" + }, + "message": { + "type": "string" + }, + "param": { + "type": "string" + }, + "event_id": { + "type": "string" + } + } + }, + "extra_fields": { + "type": "object", + "properties": { + "provider": { + "type": "string", + "description": "AI model provider identifier", + "enum": [ + "openai", + "azure", + "anthropic", + "bedrock", + "cohere", + "vertex", + "vllm", + "mistral", + "ollama", + "groq", + "sgl", + "parasail", + "perplexity", + "replicate", + "cerebras", + "gemini", + "openrouter", + "elevenlabs", + "huggingface", + "nebius", + "xai", + "runway", + "fireworks" + ] + }, + "model_requested": { + "type": "string" + }, + "request_type": { + "type": "string" + } + } + } + } + } + } + } + }, "500": { "description": "Internal server error", "content": { @@ -177564,7 +171159,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -178195,7 +171791,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -178279,7 +171876,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -178916,7 +172514,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -179000,7 +172599,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -179084,7 +172684,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -179205,7 +172806,8 @@ "huggingface", "nebius", "xai", - "runway" + "runway", + "fireworks" ] }, "model_requested": { @@ -187148,81 +180750,6 @@ } } }, - "vllm_key_config": { - "type": "object", - "description": "VLLM-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "model_name": { - "type": "string" - } - }, - "required": [ - "url" - ] - }, - "ollama_key_config": { - "type": "object", - "description": "Ollama-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, - "sgl_key_config": { - "type": "object", - "description": "SGLang-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" @@ -214051,81 +207578,6 @@ } } }, - "vllm_key_config": { - "type": "object", - "description": "VLLM-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - }, - "model_name": { - "type": "string" - } - }, - "required": [ - "url" - ] - }, - "ollama_key_config": { - "type": "object", - "description": "Ollama-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, - "sgl_key_config": { - "type": "object", - "description": "SGLang-specific key configuration", - "properties": { - "url": { - "type": "object", - "description": "Environment variable configuration", - "properties": { - "value": { - "type": "string" - }, - "env_var": { - "type": "string" - }, - "from_env": { - "type": "boolean" - } - } - } - }, - "required": [ - "url" - ] - }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" @@ -214542,6 +207994,16 @@ "url" ] }, + "replicate_key_config": { + "type": "object", + "description": "Replicate-specific key configuration", + "properties": { + "use_deployments_endpoint": { + "type": "boolean", + "description": "Whether to use the deployments endpoint instead of the models endpoint" + } + } + }, "enabled": { "type": "boolean", "description": "Whether the key is active (defaults to true)" diff --git a/docs/providers/aliasing-models.mdx b/docs/providers/aliasing-models.mdx index 83f67d447d..caa17f2526 100644 --- a/docs/providers/aliasing-models.mdx +++ b/docs/providers/aliasing-models.mdx @@ -25,6 +25,8 @@ There are two aliasing mechanisms, and they operate at different layers: ## Static Aliasing +Static aliasing is available in **Bifrost v1.5.0-prerelease2 and above**. + Static aliases are configured directly on a provider key. Every request that is served by that key will have its model name resolved through the alias map before the request reaches the provider API. ### How it works diff --git a/docs/providers/request-options.mdx b/docs/providers/request-options.mdx index 5fba8b9a0c..dd845f4cd2 100644 --- a/docs/providers/request-options.mdx +++ b/docs/providers/request-options.mdx @@ -30,6 +30,7 @@ Bifrost provides request options that control behavior, enable features, and pas | `semanticcache.CacheNoStoreKey` | `x-bf-cache-no-store` | `bool` | Prevent caching | | `mcp-include-clients` | `x-bf-mcp-include-clients` | `[]string` | Filter MCP clients (comma-separated). | | `mcp-include-tools` | `x-bf-mcp-include-tools` | `[]string` | Filter MCP tools (`clientName-toolName` format, comma-separated) | +| `BifrostContextKeyMCPExtraHeaders` | *(any header in a client's `allowed_extra_headers`)* | `map[string][]string` | Headers forwarded to MCP servers at tool execution time, filtered per-client against `allowed_extra_headers` | | `maxim.TraceIDKey` | `x-bf-maxim-trace-id` | `string` | Maxim trace ID | | `maxim.GenerationIDKey` | `x-bf-maxim-generation-id` | `string` | Maxim generation ID | | `maxim.TagsKey` | `x-bf-maxim-*` | `map[string]string` | Maxim tags (custom tag names) | diff --git a/docs/providers/routing-rules.mdx b/docs/providers/routing-rules.mdx index a282260a23..77fcdd98ce 100644 --- a/docs/providers/routing-rules.mdx +++ b/docs/providers/routing-rules.mdx @@ -597,6 +597,8 @@ Route based on region headers: ## Rule Chaining +Rule chaining is available in **Bifrost v1.5.0-prerelease2 and above**. + Rule chaining allows routing rules to be composed together. When a rule has `chain_rule: true`, the routing engine does not stop after it matches — instead, it updates the request context with the resolved provider/model and re-evaluates the full rule set from the top. ### How Chaining Works diff --git a/transports/bifrost-http/handlers/oauth2_consent.go b/transports/bifrost-http/handlers/oauth2_consent.go index 58b6d6e632..f1402d9d51 100644 --- a/transports/bifrost-http/handlers/oauth2_consent.go +++ b/transports/bifrost-http/handlers/oauth2_consent.go @@ -145,7 +145,7 @@ func (h *ConsentHandler) handleIdentityPage(ctx *fasthttp.RequestCtx) {
- +
diff --git a/transports/bifrost-http/handlers/providers.go b/transports/bifrost-http/handlers/providers.go index 2c13fff8a0..a458739a25 100644 --- a/transports/bifrost-http/handlers/providers.go +++ b/transports/bifrost-http/handlers/providers.go @@ -830,33 +830,6 @@ func keyAllowsModelForList(key schemas.Key, model string) bool { return true } -// keyModelListAllowsModel reports whether model matches a key allow/deny list entry, -// using catalog-aware alias matching when model metadata is available. -func keyModelListAllowsModel(provider schemas.ModelProvider, model string, allowedModels []string, modelCatalog *modelcatalog.ModelCatalog) bool { - if len(allowedModels) == 0 { - return false - } - - if modelCatalog == nil { - return slices.Contains(allowedModels, model) - } - - if modelCatalog.IsModelAllowedForProvider(provider, model, allowedModels) { - return true - } - - for _, allowedModel := range allowedModels { - if strings.Contains(allowedModel, "/") { - continue - } - if modelCatalog.IsSameModel(allowedModel, model) { - return true - } - } - - return false -} - // matchesModelQuery applies the shared query match used by /api/models, // /api/models/details, and /api/models/base. func matchesModelQuery(model, query string) bool { diff --git a/ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx b/ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx index 5a34ea3190..609a47b3bb 100644 --- a/ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx +++ b/ui/app/workspace/mcp-registry/views/mcpClientSheet.tsx @@ -65,6 +65,9 @@ export default function MCPClientSheet({ mcpClient, onClose, onSubmitSuccess }: const [vkConfigs, setVKConfigs] = useState([]); const [vkConfigsDirty, setVKConfigsDirty] = useState(false); + const [allowedExtraHeadersRaw, setAllowedExtraHeadersRaw] = useState( + (mcpClient.config.allowed_extra_headers || []).join(", "), + ); // Persists names for newly added VKs so they survive search result changes const [localVKNames, setLocalVKNames] = useState>({}); @@ -75,6 +78,11 @@ export default function MCPClientSheet({ mcpClient, onClose, onSubmitSuccess }: setLocalVKNames({}); }, [initialVKConfigs]); + // Sync allowedExtraHeadersRaw when mcpClient changes + useEffect(() => { + setAllowedExtraHeadersRaw((mcpClient.config.allowed_extra_headers || []).join(", ")); + }, [mcpClient.config.allowed_extra_headers]); + // Name lookup: server response names → search results → locally cached names (highest priority) const vkNameByID = useMemo>(() => { const m: Record = {}; @@ -516,13 +524,17 @@ export default function MCPClientSheet({ mcpClient, onClose, onSubmitSuccess }: placeholder="*, or: authorization, x-user-id" name={field.name} ref={field.ref} - value={(field.value || []).join(", ")} + value={allowedExtraHeadersRaw} onChange={(e) => { - const raw = e.target.value; - const parsed = raw.trim() ? raw.split(",").map((h) => h.trim()).filter(Boolean) : []; + setAllowedExtraHeadersRaw(e.target.value); + }} + onBlur={() => { + const parsed = allowedExtraHeadersRaw.trim() + ? allowedExtraHeadersRaw.split(",").map((h) => h.trim()).filter(Boolean) + : []; field.onChange(parsed); + field.onBlur(); }} - onBlur={field.onBlur} />

diff --git a/ui/app/workspace/virtual-keys/views/virtualKeyDetailsSheet.tsx b/ui/app/workspace/virtual-keys/views/virtualKeyDetailsSheet.tsx index 1349583b8f..5de108a6c9 100644 --- a/ui/app/workspace/virtual-keys/views/virtualKeyDetailsSheet.tsx +++ b/ui/app/workspace/virtual-keys/views/virtualKeyDetailsSheet.tsx @@ -114,7 +114,7 @@ export default function VirtualKeyDetailSheet({ virtualKey, onClose }: VirtualKe Allowed Models

{config.allowed_models?.includes("*") ? ( - All Models + All Models ) : config.allowed_models && config.allowed_models.length > 0 ? (
{config.allowed_models.map((model) => ( @@ -133,7 +133,7 @@ export default function VirtualKeyDetailSheet({ virtualKey, onClose }: VirtualKe Allowed Keys
{config.allow_all_keys ? ( - All keys allowed + All Keys ) : config.keys && config.keys.length > 0 ? (
{config.keys.map((key) => ( @@ -143,7 +143,7 @@ export default function VirtualKeyDetailSheet({ virtualKey, onClose }: VirtualKe ))}
) : ( - No keys allowed + No keys (deny all) )}
@@ -319,7 +319,7 @@ export default function VirtualKeyDetailSheet({ virtualKey, onClose }: VirtualKe {config.mcp_client?.name || "Unknown Client"} {config.tools_to_execute?.includes("*") ? ( - All tools allowed + All Tools ) : config.tools_to_execute && config.tools_to_execute.length > 0 ? (
{config.tools_to_execute.map((tool) => ( @@ -329,7 +329,7 @@ export default function VirtualKeyDetailSheet({ virtualKey, onClose }: VirtualKe ))}
) : ( - No tools selected + No tools (deny all) )}
diff --git a/ui/app/workspace/virtual-keys/views/virtualKeySheet.tsx b/ui/app/workspace/virtual-keys/views/virtualKeySheet.tsx index 7820717f46..c39b533fa2 100644 --- a/ui/app/workspace/virtual-keys/views/virtualKeySheet.tsx +++ b/ui/app/workspace/virtual-keys/views/virtualKeySheet.tsx @@ -323,7 +323,7 @@ export default function VirtualKeySheet({ virtualKey, teams, customers, onSave, const newConfig = { mcp_client_name: mcpClientName, - tools_to_execute: [], // Empty means no tools allowed + tools_to_execute: ["*"], }; form.setValue("mcpConfigs", [...mcpConfigs, newConfig], { shouldDirty: true }); @@ -495,7 +495,7 @@ export default function VirtualKeySheet({ virtualKey, teams, customers, onSave, className="flex w-full flex-col overflow-x-hidden px-4 pb-8" data-testid="vk-sheet-content" onInteractOutside={(e) => e.preventDefault()} - onEscapeKeyDown={(e) => e.preventDefault()} + onEscapeKeyDown={() => handleClose()} > {isEditing ? virtualKey?.name : "Create Virtual Key"}