Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/configs/default/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"name": "e2e-openai-key",
"value": "env.OPENAI_API_KEY",
"weight": 1,
"models": ["*"],
"use_for_batch_api": true
}
],
Expand All @@ -44,6 +45,7 @@
"name": "e2e-anthropic-key",
"value": "env.ANTHROPIC_API_KEY",
"weight": 1,
"models": ["*"],
"use_for_batch_api": true
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
"provider_configs": [
{
"provider": "openai",
"allowed_models": ["*"],
"key_ids": ["*"],
"weight": 1.0
}
]
Expand All @@ -109,6 +111,8 @@
"provider_configs": [
{
"provider": "openai",
"allowed_models": ["*"],
"key_ids": ["*"],
"weight": 1.0
}
]
Expand All @@ -130,7 +134,8 @@
{
"name": "openai-primary",
"value": "env.OPENAI_API_KEY",
"weight": 1
"weight": 1,
"models": ["*"]
}
]
}
Expand Down
21 changes: 21 additions & 0 deletions core/schemas/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ type BifrostImageGenerationResponse struct {
func (r *BifrostImageGenerationResponse) BackfillParams(req *BifrostRequest) {
numInputImages, size, quality := getNumInputImagesSizeAndQualityFromRequest(req)

// Backfill Model if not returned by the provider
if r.Model == "" {
r.Model = getModelFromRequest(req)
}

// Backfill NumInputImages
if numInputImages > 0 {
if r.Usage == nil {
Expand All @@ -96,6 +101,22 @@ func (r *BifrostImageGenerationResponse) BackfillParams(req *BifrostRequest) {
}
}

// getModelFromRequest extracts the model from any image-related request.
func getModelFromRequest(req *BifrostRequest) string {
if req == nil {
return ""
}
switch {
case req.ImageGenerationRequest != nil:
return req.ImageGenerationRequest.Model
case req.ImageEditRequest != nil:
return req.ImageEditRequest.Model
case req.ImageVariationRequest != nil:
return req.ImageVariationRequest.Model
}
return ""
}

// getNumInputImagesSizeAndQualityFromRequest extracts request params for cost calculation.
// Quality is only returned when it is one of low, medium, high, auto.
func getNumInputImagesSizeAndQualityFromRequest(req *BifrostRequest) (numInputImages int, size string, quality string) {
Expand Down
2 changes: 1 addition & 1 deletion docs/quickstart/go-sdk/setting-up.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (a *MyAccount) GetKeysForProvider(ctx *context.Context, provider schemas.Mo
if provider == schemas.OpenAI {
return []schemas.Key{{
Value: os.Getenv("OPENAI_API_KEY"),
Models: []string{}, // Keep Models empty to use any model
Models: schemas.WhiteList{"*"}, // Keep Models ["*"] to use any model
Weight: 1.0,
}}, nil
}
Expand Down
4 changes: 4 additions & 0 deletions framework/vectorstore/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -1610,5 +1610,9 @@ func newRedisStore(_ context.Context, config RedisConfig, logger schemas.Logger)
logger: logger,
namespaceFieldTypes: make(map[string]map[string]VectorStorePropertyType),
}
// Eagerly verify connectivity, consistent with other store constructors (e.g. Qdrant)
if err := store.Ping(context.Background()); err != nil {
return nil, fmt.Errorf("failed to connect to redis: %w", err)
}
return store, nil
}
2 changes: 1 addition & 1 deletion helm-charts/bifrost/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: bifrost
description: A Helm chart for deploying Bifrost - AI Gateway with unified interface for multiple providers
type: application
version: 2.0.14
version: 2.0.15
appVersion: "1.4.11"
keywords:
- ai
Expand Down
16 changes: 15 additions & 1 deletion helm-charts/bifrost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,24 @@

Official Helm charts for deploying [Bifrost](https://github.com/maximhq/bifrost) - a high-performance AI gateway with unified interface for multiple providers.

**Latest Version:** 2.0.14
**Latest Version:** 2.0.15

## Changelog

### v2.0.15

- Synced helm schema with transport `config.schema.json` — added missing properties:
- `client.mcpDisableAutoToolInject` — disable automatic MCP tool injection
- `governance.budgets[].calendar_aligned` — snap budget resets to calendar boundaries
- `governance.pricingOverrides` — scoped pricing overrides for the model catalog
- `mcp.clientConfigs[].allowedExtraHeaders` — header allowlist per MCP client
- `mcp.clientConfigs[].allowOnAllVirtualKeys` — make MCP server accessible to all virtual keys
- `mcp.toolManagerConfig.disableAutoToolInject` — disable auto tool injection at manager level
- `networkConfig.beta_header_overrides` — override Anthropic beta header support per provider
- `websocket` — full WebSocket gateway tuning (connections, pool, transcript buffer)
- Fixed SSE `connectionString` not being rendered in `_helpers.tpl` for MCP clients
- Added template rendering for all new properties in `_helpers.tpl`

### v2.0.14

- Added `placement` and `order` fields to custom plugin schema and template rendering
Expand Down
52 changes: 51 additions & 1 deletion helm-charts/bifrost/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ false
{{- if hasKey .Values.bifrost.client "hideDeletedVirtualKeysInFilters" }}
{{- $_ := set $client "hide_deleted_virtual_keys_in_filters" .Values.bifrost.client.hideDeletedVirtualKeysInFilters }}
{{- end }}
{{- if hasKey .Values.bifrost.client "mcpDisableAutoToolInject" }}
{{- $_ := set $client "mcp_disable_auto_tool_inject" .Values.bifrost.client.mcpDisableAutoToolInject }}
{{- end }}
{{- $_ := set $config "client" $client }}
{{- end }}
{{- /* Framework */ -}}
Expand Down Expand Up @@ -354,6 +357,9 @@ false
{{- if .Values.bifrost.governance.providers }}
{{- $_ := set $governance "providers" .Values.bifrost.governance.providers }}
{{- end }}
{{- if .Values.bifrost.governance.pricingOverrides }}
{{- $_ := set $governance "pricing_overrides" .Values.bifrost.governance.pricingOverrides }}
{{- end }}
{{- if .Values.bifrost.governance.authConfig }}
{{- $authConfig := dict }}
{{- if and .Values.bifrost.governance.authConfig.existingSecret .Values.bifrost.governance.authConfig.usernameKey }}
Expand All @@ -376,7 +382,7 @@ false
{{- $_ := set $governance "auth_config" $authConfig }}
{{- end }}
{{- end }}
{{- if or $governance.budgets $governance.rate_limits $governance.customers $governance.teams $governance.virtual_keys $governance.routing_rules $governance.model_configs $governance.providers $governance.auth_config }}
{{- if or $governance.budgets $governance.rate_limits $governance.customers $governance.teams $governance.virtual_keys $governance.routing_rules $governance.model_configs $governance.providers $governance.pricing_overrides $governance.auth_config }}
{{- $_ := set $config "governance" $governance }}
{{- end }}
{{- end }}
Expand Down Expand Up @@ -667,6 +673,10 @@ false
{{- if and (eq $client.connectionType "websocket") $client.websocketConfig }}
{{- $_ := set $cc "connection_string" $client.websocketConfig.url }}
{{- end }}
{{- /* Map connectionString for SSE connections */ -}}
{{- if and (eq $client.connectionType "sse") $client.connectionString }}
{{- $_ := set $cc "connection_string" $client.connectionString }}
{{- end }}
{{- /* Map stdioConfig -> stdio_config */ -}}
{{- if $client.stdioConfig }}
{{- $stdio := dict "command" $client.stdioConfig.command }}
Expand Down Expand Up @@ -709,6 +719,12 @@ false
{{- if $client.toolPricing }}
{{- $_ := set $cc "tool_pricing" $client.toolPricing }}
{{- end }}
{{- if $client.allowedExtraHeaders }}
{{- $_ := set $cc "allowed_extra_headers" $client.allowedExtraHeaders }}
{{- end }}
{{- if hasKey $client "allowOnAllVirtualKeys" }}
{{- $_ := set $cc "allow_on_all_virtual_keys" $client.allowOnAllVirtualKeys }}
{{- end }}
{{- $clientConfigs = append $clientConfigs $cc }}
{{- end }}
{{- $mcpConfig := dict "client_configs" $clientConfigs }}
Expand All @@ -723,6 +739,9 @@ false
{{- if .Values.bifrost.mcp.toolManagerConfig.codeModeBindingLevel }}
{{- $_ := set $tmConfig "code_mode_binding_level" .Values.bifrost.mcp.toolManagerConfig.codeModeBindingLevel }}
{{- end }}
{{- if hasKey .Values.bifrost.mcp.toolManagerConfig "disableAutoToolInject" }}
{{- $_ := set $tmConfig "disable_auto_tool_inject" .Values.bifrost.mcp.toolManagerConfig.disableAutoToolInject }}
{{- end }}
{{- if $tmConfig }}
{{- $_ := set $mcpConfig "tool_manager_config" $tmConfig }}
{{- end }}
Expand Down Expand Up @@ -900,6 +919,37 @@ false
{{- $_ := set $config "audit_logs" $auditLogs }}
{{- end }}
{{- end }}
{{- /* WebSocket Config */ -}}
{{- if .Values.bifrost.websocket }}
{{- $ws := dict }}
{{- if .Values.bifrost.websocket.maxConnectionsPerUser }}
{{- $_ := set $ws "max_connections_per_user" .Values.bifrost.websocket.maxConnectionsPerUser }}
{{- end }}
{{- if .Values.bifrost.websocket.transcriptBufferSize }}
{{- $_ := set $ws "transcript_buffer_size" .Values.bifrost.websocket.transcriptBufferSize }}
{{- end }}
{{- if .Values.bifrost.websocket.pool }}
{{- $pool := dict }}
{{- if .Values.bifrost.websocket.pool.maxIdlePerKey }}
{{- $_ := set $pool "max_idle_per_key" .Values.bifrost.websocket.pool.maxIdlePerKey }}
{{- end }}
{{- if .Values.bifrost.websocket.pool.maxTotalConnections }}
{{- $_ := set $pool "max_total_connections" .Values.bifrost.websocket.pool.maxTotalConnections }}
{{- end }}
{{- if .Values.bifrost.websocket.pool.idleTimeoutSeconds }}
{{- $_ := set $pool "idle_timeout_seconds" .Values.bifrost.websocket.pool.idleTimeoutSeconds }}
{{- end }}
{{- if .Values.bifrost.websocket.pool.maxConnectionLifetimeSeconds }}
{{- $_ := set $pool "max_connection_lifetime_seconds" .Values.bifrost.websocket.pool.maxConnectionLifetimeSeconds }}
{{- end }}
{{- if $pool }}
{{- $_ := set $ws "pool" $pool }}
{{- end }}
{{- end }}
{{- if $ws }}
{{- $_ := set $config "websocket" $ws }}
{{- end }}
{{- end }}
{{- $config | toJson }}
{{- end }}

Expand Down
Loading
Loading