first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 21:52:23 +03:00
commit 880f412e2c
2662 changed files with 866266 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
services:
weaviate:
image: cr.weaviate.io/semitechnologies/weaviate:1.32.4
command:
- --host
- 0.0.0.0
- --port
- '8080'
- --scheme
- http
environment:
- CLUSTER_HOSTNAME=weaviate
- CLUSTER_ADVERTISE_ADDR=172.38.0.12
- CLUSTER_GOSSIP_BIND_PORT=7946
- CLUSTER_DATA_BIND_PORT=7947
- DISABLE_TELEMETRY=true
- PERSISTENCE_DATA_PATH=/var/lib/weaviate
- DEFAULT_VECTORIZER_MODULE=none
- ENABLE_MODULES=
- AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED=true
- LOG_LEVEL=info
ports:
- "9000:8080"
volumes:
- weaviate_data:/var/lib/weaviate
networks:
bifrost_network:
ipv4_address: 172.38.0.12
# Redis Stack instance for vector store tests
redis-stack:
image: redis/redis-stack:7.4.0-v6
command: redis-stack-server --protected-mode no
ports:
- "6379:6379"
- "8001:8001" # RedisInsight web UI
volumes:
- redis_data:/data
networks:
bifrost_network:
ipv4_address: 172.38.0.13
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 10s
retries: 3
# Qdrant instance for vector store tests
qdrant:
image: qdrant/qdrant:v1.16.0
ports:
- "6334:6334" # gRPC API
volumes:
- qdrant_data:/qdrant/storage
networks:
bifrost_network:
ipv4_address: 172.38.0.14
# mitmproxy - HTTP proxy with Web UI for debugging
# Web UI: http://localhost:8081
# Proxy: http://localhost:8082
mitmproxy:
image: mitmproxy/mitmproxy:latest
container_name: bifrost-mitmproxy
command: mitmweb --web-host 0.0.0.0 --web-port 8081 --listen-host 0.0.0.0 --listen-port 8082 --set proxyauth=bifrost:secret-token --set web_password=secret-token
ports:
- "8082:8082" # Proxy port
- "8081:8081" # Web UI
networks:
bifrost_network:
ipv4_address: 172.38.0.16
networks:
bifrost_network:
driver: bridge
ipam:
config:
- subnet: 172.38.0.0/16
gateway: 172.38.0.1
volumes:
weaviate_data:
redis_data:
qdrant_data:

View File

@@ -0,0 +1,18 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"encryption_key": "<REPLACE_WITH_BASE64_KEY>",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/encryptionmigration/config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/encryptionmigration/logs.db"
}
}
}

View File

@@ -0,0 +1,9 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": false
},
"logs_store": {
"enabled": false
}
}

View File

@@ -0,0 +1,55 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../tests/configs/partial/config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../tests/configs/partial/logs.db"
}
},
"providers": {
"openai": {
"keys": [
{
"name": "openai-key-1",
"value": "sk-123",
"weight": 1,
"models": ["*"]
}
]
},
"anthropic": {
"keys": [
{
"name": "anthropic-key-1",
"value": "sk-456",
"weight": 1,
"models": ["*"]
}
]
},
"bedrock": {
"keys": [
{
"name": "bedrock-key-1",
"value": "ak-123",
"weight": 1,
"models": ["*"]
},
{
"name": "bedrock-key-2",
"value": "ak-456",
"weight": 1,
"models": ["*"]
}
]
}
}
}

View File

@@ -0,0 +1,116 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"version": 1,
"providers": {
"openai": {
"keys": [
{
"name": "main",
"value": "env.OPENAI_API_KEY",
"models": [],
"weight": 1.0
}
],
"network_config": {
"default_request_timeout_in_seconds": 30,
"max_retries": 2
}
},
"anthropic": {
"keys": [
{
"name": "primary",
"value": "env.ANTHROPIC_API_KEY",
"models": [],
"weight": 1.0
},
{
"name": "secondary",
"value": "env.ANTHROPIC_API_KEY_2",
"models": [],
"weight": 0.5
}
],
"network_config": {
"default_request_timeout_in_seconds": 60,
"max_retries": 1
}
}
},
"mcp": {
"client_configs": [
{
"name": "internal_tools",
"connection_type": "http",
"connection_string": "http://localhost:3001",
"auth_type": "none",
"tools_to_execute": ["*"],
"allow_on_all_virtual_keys": false
}
]
},
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/v1compat/config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/v1compat/logs.db"
}
},
"governance": {
"virtual_keys": [
{
"id": "vk-full-access",
"name": "Full Access",
"description": "v1 compat: empty provider_configs and mcp_configs mean allow all",
"provider_configs": [],
"mcp_configs": []
},
{
"id": "vk-openai-restricted",
"name": "OpenAI Restricted",
"description": "v1 compat: explicit provider entry but empty allowed_models and key_ids mean allow all",
"provider_configs": [
{
"provider": "openai",
"allowed_models": [],
"key_ids": [],
"weight": 1.0
}
],
"mcp_configs": [
{
"mcp_client_name": "internal_tools",
"tools_to_execute": ["*"]
}
]
},
{
"id": "vk-anthropic-restricted",
"name": "Anthropic Restricted",
"description": "v1 compat: mix — one provider with specific model list, another with empty (allow all)",
"provider_configs": [
{
"provider": "anthropic",
"allowed_models": [],
"key_ids": [],
"weight": 1.0
}
],
"mcp_configs": []
}
]
}
}

View File

@@ -0,0 +1,25 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"governance": {
"auth_config": {
"admin_username": "env.BIFROST_ADMIN_USERNAME",
"admin_password": "env.BIFROST_ADMIN_PASSWORD",
"is_enabled": true,
"disable_auth_on_inference": false
}
},
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/withauth/config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/withauth/logs.db"
}
}
}

View File

@@ -0,0 +1,39 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./config.db"
}
},
"client": {
"compat": {
"convert_text_to_chat": true,
"convert_chat_to_responses": true,
"should_drop_params": true,
"should_convert_params": false
},
"enable_logging": true,
"initial_pool_size": 300,
"log_retention_days": 365,
"header_filter_config": {
"allowlist": ["x-bf-eh-user-id", "x-bf-eh-team-id"],
"denylist": []
},
"required_headers": ["x-bf-user-id"],
"logging_headers": ["x-bf-user-id", "x-bf-team-id"]
},
"providers": {
"openai": {
"keys": [
{
"name": "openai-key-1",
"value": "sk-dummy",
"weight": 1,
"models": ["*"]
}
]
}
}
}

View File

@@ -0,0 +1,58 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/withconfigstore/config.db"
}
},
"auth_config": {
"admin_username": "env.BIFROST_ADMIN_USERNAME",
"admin_password": "env.BIFROST_ADMIN_PASSWORD",
"is_enabled": true,
"disable_auth_on_inference": true
},
"governance": {
"virtual_keys": [
{
"id": "vk-gpt",
"value": "vk-gpt",
"is_active": true,
"provider_configs": [
{
"provider": "azure",
"key_ids": [
"*"
],
"allowed_models": [
"gpt-4.1-2025-04-14",
"gpt-4.1-mini-2025-04-14",
"gpt-4.1-nano-2025-04-14",
"gpt-4o-2024-08-06",
"gpt-4o-2024-11-20",
"gpt-4o-mini-2024-07-18",
"gpt-5-2025-08-07",
"gpt-5-mini-2025-08-07",
"gpt-5-nano-2025-08-07",
"gpt-5-pro-2025-10-06",
"gpt-5.1-2025-11-13",
"o1-2024-12-17",
"o3-2025-04-16",
"o3-mini-2025-01-31",
"o3-pro-2025-06-10",
"o4-mini-2025-04-16",
"text-embedding-3-large-1",
"text-embedding-3-small-1",
"text-embedding-ada-002",
"tts-hd-001",
"whisper-001"
],
"weight": 0.5
}
],
"name": "vk-gpt"
}
]
}
}

View File

@@ -0,0 +1,27 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "postgres",
"config": {
"host": "localhost",
"port": "5432",
"user": "bifrost",
"password": "bifrost_password",
"db_name": "bifrost",
"ssl_mode": "disable"
}
},
"logs_store": {
"enabled": true,
"type": "postgres",
"config": {
"host": "localhost",
"port": "5432",
"user": "bifrost",
"password": "bifrost_password",
"db_name": "bifrost",
"ssl_mode": "disable"
}
}
}

View File

@@ -0,0 +1,17 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../tests/configs/withconfigstorelogsstore/config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../tests/configs/withconfigstorelogsstore/logs.db"
}
}
}

View File

@@ -0,0 +1,18 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/withconfigstore/config.db"
}
},
"plugins": [
{
"enabled": true,
"name": "hello-world",
"path": "/Users/akshay/Codebase/universe/bifrost/examples/plugins/hello-world/build/hello-world.so",
"version": 3
}
]
}

View File

@@ -0,0 +1,29 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"version": 2,
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./config.db"
}
},
"framework": {
"pricing": {
"pricing_url": "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json",
"pricing_sync_interval": 86400
}
},
"providers": {
"openai": {
"keys": [
{
"name": "openai-key-1",
"value": "sk-dummy",
"weight": 1,
"models": ["*"]
}
]
}
}
}

View File

@@ -0,0 +1,37 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./logs.db"
}
},
"large_payload_optimization": {
"enabled": true,
"request_threshold_bytes": 10485760,
"response_threshold_bytes": 10485760,
"prefetch_size_bytes": 65536,
"max_payload_bytes": 524288000,
"truncated_log_bytes": 1048576
},
"providers": {
"openai": {
"keys": [
{
"name": "openai-key-1",
"value": "sk-dummy",
"weight": 1,
"models": ["*"]
}
]
}
}
}

View File

@@ -0,0 +1,25 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": false
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../tests/configs/withlogstore/logs.db"
}
},
"providers": {
"openai": {
"keys": [
{
"name": "openai-key-1",
"value": "sk-proj-abc",
"weight": 1,
"models": ["*"]
}
]
}
}
}

View File

@@ -0,0 +1,77 @@
# Bifrost behind NGINX (Docker Compose)
This example runs 3 Bifrost containers behind an NGINX reverse proxy.
## Files
- `docker-compose.yml` - Starts NGINX and 3 Bifrost nodes
- `nginx.conf` - Reverse proxy and load balancing config
- `config.json` - Shared Bifrost config for all nodes
- `.env.example` - Required environment variables
- `helm-values.yaml` - Helm values for Kubernetes + NGINX Ingress
- `k8s-ingress.yaml` - Standalone ingress manifest (non-Helm or override)
## Run
```bash
cd examples/configs/withnginxreverseproxy
cp .env.example .env
# Edit .env and set real values
docker compose config
docker compose up -d
docker compose ps
```
NGINX exposes Bifrost on `http://localhost:8080`.
## Verify
```bash
# Health through NGINX
curl -i http://localhost:8080/health
# Chat completion through NGINX
curl -sS http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"messages": [{"role": "user", "content": "Say hello"}]
}'
```
Streaming check:
```bash
curl -N http://localhost:8080/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini",
"stream": true,
"messages": [{"role": "user", "content": "stream test"}]
}'
```
## Stop
```bash
docker compose down
```
## Kubernetes / Helm
```bash
# Render manifests and verify ingress is present
helm template bifrost ./helm-charts/bifrost \
-f examples/configs/withnginxreverseproxy/helm-values.yaml
# Install (or upgrade) with this example
helm upgrade --install bifrost ./helm-charts/bifrost \
-f examples/configs/withnginxreverseproxy/helm-values.yaml
```
Validate ingress manifest only:
```bash
kubectl apply --dry-run=client -f examples/configs/withnginxreverseproxy/k8s-ingress.yaml
```

View File

@@ -0,0 +1,33 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"encryption_key": "env.BIFROST_ENCRYPTION_KEY",
"config_store": {
"enabled": false
},
"logs_store": {
"enabled": false
},
"client": {
"drop_excess_requests": false,
"enable_logging": true,
"allowed_origins": [
"*"
],
"max_request_body_size_mb": 100
},
"providers": {
"openai": {
"keys": [
{
"name": "openai-primary",
"value": "env.OPENAI_API_KEY",
"models": [
"gpt-4o-mini",
"gpt-4o"
],
"weight": 1
}
]
}
}
}

View File

@@ -0,0 +1,54 @@
services:
nginx:
image: nginx:alpine
container_name: bifrost-nginx
ports:
- "8080:80"
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
depends_on:
- bifrost-1
- bifrost-2
- bifrost-3
restart: unless-stopped
bifrost-1:
image: maximhq/bifrost:latest
container_name: bifrost-1
env_file:
- .env
volumes:
- ./config.json:/app/config.json:ro
- bifrost_data_1:/app/data
expose:
- "8080"
restart: unless-stopped
bifrost-2:
image: maximhq/bifrost:latest
container_name: bifrost-2
env_file:
- .env
volumes:
- ./config.json:/app/config.json:ro
- bifrost_data_2:/app/data
expose:
- "8080"
restart: unless-stopped
bifrost-3:
image: maximhq/bifrost:latest
container_name: bifrost-3
env_file:
- .env
volumes:
- ./config.json:/app/config.json:ro
- bifrost_data_3:/app/data
expose:
- "8080"
restart: unless-stopped
volumes:
bifrost_data_1:
bifrost_data_2:
bifrost_data_3:

View File

@@ -0,0 +1,43 @@
image:
tag: "v1.4.18"
replicaCount: 3
ingress:
enabled: true
className: nginx
annotations:
nginx.ingress.kubernetes.io/proxy-body-size: "100m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
nginx.ingress.kubernetes.io/proxy-buffering: "off"
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
hosts:
- host: bifrost.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: bifrost-tls
hosts:
- bifrost.example.com
bifrost:
encryptionKey: "env.BIFROST_ENCRYPTION_KEY"
client:
enableLogging: true
maxRequestBodySizeMb: 100
providers:
openai:
keys:
- name: "openai-primary"
value: "env.OPENAI_API_KEY"
models: ["gpt-4o-mini", "gpt-4o"]
weight: 1
env:
- name: OPENAI_API_KEY
value: "replace-with-real-key"
- name: BIFROST_ENCRYPTION_KEY
value: "replace-with-32-byte-random-string"

View File

@@ -0,0 +1,27 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: bifrost
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/proxy-body-size: "100m"
nginx.ingress.kubernetes.io/proxy-read-timeout: "300"
nginx.ingress.kubernetes.io/proxy-send-timeout: "300"
nginx.ingress.kubernetes.io/proxy-buffering: "off"
spec:
ingressClassName: nginx
rules:
- host: bifrost.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: bifrost
port:
number: 8080
tls:
- secretName: bifrost-tls
hosts:
- bifrost.example.com

View File

@@ -0,0 +1,35 @@
events {
worker_connections 1024;
}
http {
upstream bifrost_backend {
least_conn;
server bifrost-1:8080;
server bifrost-2:8080;
server bifrost-3:8080;
}
server {
listen 80;
server_name _;
location / {
proxy_pass http://bifrost_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_http_version 1.1;
proxy_buffering off;
proxy_request_buffering off;
proxy_read_timeout 300s;
proxy_send_timeout 300s;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
}

View File

@@ -0,0 +1,16 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/withobjectstoragegcs/logs.db"
},
"object_storage": {
"type": "gcs",
"bucket": "env.GCS_BUCKET",
"credentials": "env.GCS_KEY",
"prefix":"bifrost/logs"
}
}
}

View File

@@ -0,0 +1,18 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/withobjectstorage/logs.db"
},
"object_storage": {
"type": "s3",
"bucket": "env.AWS_S3_BUCKET",
"region": "env.AWS_REGION",
"access_key_id": "env.AWS_ACCESS_KEY_ID",
"secret_access_key": "env.AWS_SECRET_ACCESS_KEY",
"prefix": "logs"
}
}
}

View File

@@ -0,0 +1,37 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../tests/configs/withobservability/config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../tests/configs/withobservability/logs.db"
}
},
"plugins": [
{
"enabled": true,
"name": "maxim",
"config": {
"api_key": "",
"log_repo_id": ""
}
},
{
"enabled": true,
"name": "otel",
"config": {
"service_name": "bifrost",
"collector_url": "http://localhost:4318/v1/traces",
"trace_type": "genai_extension",
"protocol": "http"
}
}
]
}

View File

@@ -0,0 +1,48 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./logs.db"
}
},
"providers": {
"openai": {
"keys": [
{
"name": "openai-key-1",
"value": "sk-dummy",
"weight": 1,
"models": ["*"]
}
]
}
},
"plugins": [
{
"enabled": true,
"name": "otel",
"config": {
"service_name": "bifrost",
"collector_url": "http://localhost:4318/v1/traces",
"trace_type": "otel",
"protocol": "http",
"metrics_enabled": true,
"metrics_endpoint": "http://localhost:4318/v1/metrics",
"metrics_push_interval": 15,
"headers": {
"x-honeycomb-team": "env.HONEYCOMB_API_KEY"
},
"insecure": false
}
}
]
}

View File

@@ -0,0 +1,150 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"client": {
"allow_direct_keys": false,
"allowed_origins": [
"*"
],
"disable_content_logging": false,
"drop_excess_requests": false,
"enable_logging": true,
"enforce_auth_on_inference": true,
"initial_pool_size": 300,
"log_retention_days": 365,
"max_request_body_size_mb": 100
},
"config_store": {
"enabled": true,
"type": "postgres",
"config": {
"host": "localhost",
"port": "5432",
"user": "bifrost",
"password": "bifrost_password",
"db_name": "bifrost",
"ssl_mode": "disable"
}
},
"logs_store": {
"enabled": true,
"type": "postgres",
"config": {
"host": "localhost",
"port": "5432",
"user": "bifrost",
"password": "bifrost_password",
"db_name": "bifrost",
"ssl_mode": "disable"
}
},
"mcp": {
"client_configs": [
{
"name": "WeatherService",
"connection_type": "http",
"client_id": "weather-mcp-server",
"connection_string": "http://localhost:8080/mcp"
},
{
"name": "CalendarService",
"connection_type": "http",
"client_id": "calendar-mcp-server",
"connection_string": "http://localhost:8081/mcp"
}
]
},
"governance": {
"auth_config": {
"admin_password": "env.BIFROST_ADMIN_PASSWORD",
"admin_username": "env.BIFROST_ADMIN_USERNAME",
"disable_auth_on_inference": true,
"is_enabled": false
},
"virtual_keys": [
{
"id": "vk-ai-portal-prod",
"is_active": true,
"name": "ai-portal-production-key",
"description": "Virtual key for AI portal with MCP access to weather and calendar services",
"value": "env.BIFROST_VK_AI_PORTAL",
"mcp_configs": [
{
"mcp_client_name": "WeatherService",
"tools_to_execute": [
"*"
]
},
{
"mcp_client_name": "CalendarService",
"tools_to_execute": [
"get_events",
"create_event"
]
}
],
"provider_configs": [
{
"provider": "openai",
"weight": 1.0,
"allowed_models": [
"*"
],
"key_ids": [
"*"
]
}
]
},
{
"id": "vk-internal-tools",
"is_active": true,
"name": "internal-tools-key",
"description": "Virtual key for internal tools with limited MCP access",
"value": "env.BIFROST_VK_INTERNAL",
"mcp_configs": [
{
"mcp_client_name": "WeatherService",
"tools_to_execute": [
"get_current_weather"
]
}
],
"provider_configs": [
{
"provider": "openai",
"weight": 1.0,
"allowed_models": [
"*"
],
"key_ids": [
"*"
]
}
]
}
]
},
"plugins": [
{
"config": {
"is_vk_mandatory": true
},
"enabled": true,
"name": "governance"
}
],
"providers": {
"openai": {
"keys": [
{
"name": "openai-primary",
"value": "env.OPENAI_API_KEY",
"weight": 1,
"models": [
"*"
]
}
]
}
}
}

View File

@@ -0,0 +1,74 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": false
},
"logs_store": {
"enabled": false
},
"governance": {
"pricing_overrides": [
{
"id": "override-global-gpt4o",
"name": "Global GPT-4o Pricing",
"scope_kind": "global",
"match_type": "exact",
"pattern": "gpt-4o",
"request_types": ["chat_completion"],
"pricing_patch": "{\"input_cost_per_token\":0.0000025,\"output_cost_per_token\":0.00001}"
},
{
"id": "override-global-claude-wildcard",
"name": "Global Claude Models Pricing",
"scope_kind": "global",
"match_type": "wildcard",
"pattern": "claude-*",
"request_types": ["chat_completion"],
"pricing_patch": "{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015}"
},
{
"id": "override-provider-openai-gpt4o-mini",
"name": "OpenAI GPT-4o Mini Pricing",
"scope_kind": "provider",
"provider_id": "openai",
"match_type": "exact",
"pattern": "gpt-4o-mini",
"request_types": ["chat_completion"],
"pricing_patch": "{\"input_cost_per_token\":0.00000015,\"output_cost_per_token\":0.0000006}"
}
]
},
"plugins": [
{
"name": "governance",
"enabled": true,
"config": {
"is_vk_mandatory": false
}
}
],
"providers": {
"openai": {
"keys": [
{
"id": "key-openai-1",
"name": "openai-key-1",
"value": "env.OPENAI_API_KEY",
"weight": 1,
"models": ["*"]
}
]
},
"anthropic": {
"keys": [
{
"id": "key-anthropic-1",
"name": "anthropic-key-1",
"value": "env.ANTHROPIC_API_KEY",
"weight": 1,
"models": ["*"]
}
]
}
}
}

View File

@@ -0,0 +1,82 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "logs.db"
}
},
"governance": {
"pricing_overrides": [
{
"id": "override-global-gpt4o",
"name": "Global GPT-4o Pricing",
"scope_kind": "global",
"match_type": "exact",
"pattern": "gpt-4o",
"request_types": ["chat_completion"],
"pricing_patch": "{\"input_cost_per_token\":0.0000025,\"output_cost_per_token\":0.00001}"
},
{
"id": "override-global-claude-wildcard",
"name": "Global Claude Models Pricing",
"scope_kind": "global",
"match_type": "wildcard",
"pattern": "claude-*",
"request_types": ["chat_completion"],
"pricing_patch": "{\"input_cost_per_token\":0.000003,\"output_cost_per_token\":0.000015}"
},
{
"id": "override-provider-openai-gpt4o-mini",
"name": "OpenAI GPT-4o Mini Pricing",
"scope_kind": "provider",
"provider_id": "openai",
"match_type": "exact",
"pattern": "gpt-4o-mini",
"request_types": ["chat_completion"],
"pricing_patch": "{\"input_cost_per_token\":0.00000015,\"output_cost_per_token\":0.0000006}"
}
]
},
"plugins": [
{
"name": "governance",
"enabled": true,
"config": {
"is_vk_mandatory": false
}
}
],
"providers": {
"openai": {
"keys": [
{
"id": "key-openai-1",
"name": "openai-key-1",
"value": "env.OPENAI_API_KEY",
"weight": 1,
"models": ["*"]
}
]
},
"anthropic": {
"keys": [
{
"id": "key-anthropic-1",
"name": "anthropic-key-1",
"value": "env.ANTHROPIC_API_KEY",
"weight": 1,
"models": ["*"]
}
]
}
}
}

View File

@@ -0,0 +1,245 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"providers": {
"openai": {
"keys": [
{
"name": "OpenAI API Key",
"value": "env.OPENAI_API_KEY",
"weight": 1,
"use_for_batch_api": true,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"anthropic": {
"keys": [
{
"name": "Anthropic API Key",
"value": "env.ANTHROPIC_API_KEY",
"weight": 1,
"use_for_batch_api": true,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"gemini": {
"keys": [
{
"value": "env.GEMINI_API_KEY",
"weight": 1,
"use_for_batch_api": true,
"models": [
"*"
],
"name": "gemini-key-1"
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"vertex": {
"keys": [
{
"name": "Vertex API Key",
"vertex_key_config": {
"project_id": "env.VERTEX_PROJECT_ID",
"region": "env.GOOGLE_LOCATION",
"auth_credentials": "env.VERTEX_CREDENTIALS"
},
"weight": 1,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"mistral": {
"keys": [
{
"name": "Mistral API Key",
"value": "env.MISTRAL_API_KEY",
"weight": 1,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"cohere": {
"keys": [
{
"name": "Cohere API Key",
"value": "env.COHERE_API_KEY",
"weight": 1,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"groq": {
"keys": [
{
"name": "Groq API Key",
"value": "env.GROQ_API_KEY",
"weight": 1,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"perplexity": {
"keys": [
{
"name": "Perplexity API Key",
"value": "env.PERPLEXITY_API_KEY",
"weight": 1,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"cerebras": {
"keys": [
{
"name": "Cerebras API Key",
"value": "env.CEREBRAS_API_KEY",
"weight": 1,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"openrouter": {
"keys": [
{
"name": "OpenRouter API Key",
"value": "env.OPENROUTER_API_KEY",
"weight": 1,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"azure": {
"keys": [
{
"name": "Azure API Key",
"value": "env.AZURE_API_KEY",
"azure_key_config": {
"endpoint": "env.AZURE_ENDPOINT",
"api_version": "env.AZURE_API_VERSION"
},
"weight": 1,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
},
"bedrock": {
"keys": [
{
"name": "Bedrock API Key",
"bedrock_key_config": {
"access_key": "env.AWS_ACCESS_KEY_ID",
"secret_key": "env.AWS_SECRET_ACCESS_KEY",
"region": "env.AWS_REGION",
"arn": "env.AWS_ARN"
},
"weight": 1,
"use_for_batch_api": true,
"models": [
"*"
]
}
],
"network_config": {
"default_request_timeout_in_seconds": 300
}
}
},
"client": {
"drop_excess_requests": false,
"initial_pool_size": 300,
"allowed_origins": [
"*"
],
"enable_logging": true,
"enforce_auth_on_inference": false,
"allow_direct_keys": false,
"max_request_body_size_mb": 100
},
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/withprompushgateway/config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "../../examples/configs/withprompushgateway/logs.db"
}
},
"plugins": [
{
"name": "telemetry",
"enabled": true,
"config": {
"push_gateway": {
"enabled": true,
"push_gateway_url": "http://localhost:9091",
"job_name": "bifrost",
"push_interval": 15,
"basic_auth": {
"username": "admin",
"password": "admin"
}
}
}
}
]
}

View File

@@ -0,0 +1,68 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./config.db"
}
},
"governance": {
"routing_rules": [
{
"id": "rule-gpt4-to-azure",
"name": "Route GPT-4 to Azure",
"description": "Route all GPT-4 model requests to Azure provider",
"enabled": true,
"cel_expression": "model.startsWith('gpt-4')",
"targets": [
{ "provider": "azure", "weight": 1.0 }
],
"fallbacks": ["openai"],
"scope": "global",
"priority": 0
},
{
"id": "rule-high-budget-fallback",
"name": "Use fallback when budget high",
"description": "Route to fallback providers when budget usage exceeds 80%",
"enabled": true,
"cel_expression": "budget_used >= 80.0",
"targets": [
{ "provider": "anthropic", "weight": 0.5 },
{ "provider": "openai", "weight": 0.5 }
],
"fallbacks": ["anthropic", "openai"],
"scope": "global",
"priority": 10
},
{
"id": "rule-embedding-lightweight",
"name": "Use lightweight embeddings",
"description": "Route embedding requests to cost-effective provider",
"enabled": true,
"cel_expression": "request_type == 'embedding'",
"targets": [
{ "provider": "openai", "model": "text-embedding-3-small", "weight": 1.0 }
],
"fallbacks": [],
"scope": "global",
"priority": 5
},
{
"id": "rule-premium-vk-azure",
"name": "Premium VK gets Azure",
"description": "Premium virtual keys always use Azure",
"enabled": true,
"cel_expression": "virtual_key_name == 'premium-tier'",
"targets": [
{ "provider": "azure", "weight": 1.0 }
],
"fallbacks": ["openai", "anthropic"],
"scope": "virtual_key",
"scope_id": "premium-tier",
"priority": 0
}
]
}
}

View File

@@ -0,0 +1,22 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"vector_store": {
"enabled": true,
"type": "weaviate",
"config": {
"scheme": "http",
"host": "localhost:9000"
}
},
"plugins": [
{
"enabled": true,
"name": "semantic_cache",
"config": {
"dimension": 1,
"ttl": 300,
"threshold": 0.8
}
}
]
}

View File

@@ -0,0 +1,30 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"vector_store": {
"enabled": true,
"type": "redis",
"config": {
"addr": "env.REDIS_ADDR",
"username": "env.REDIS_USERNAME",
"password": "env.REDIS_PASSWORD",
"db": 0,
"use_tls": true,
"insecure_skip_verify": false,
"ca_cert_pem": "env.REDIS_CA_CERT_PEM",
"cluster_mode": true
}
},
"plugins": [
{
"enabled": true,
"name": "semantic_cache",
"config": {
"dimension": 1,
"ttl": 300,
"threshold": 0.8,
"default_cache_key": "valkey-repro-cache",
"vector_store_namespace": "ValkeySemanticCacheRepro"
}
}
]
}

View File

@@ -0,0 +1,76 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./logs.db"
}
},
"providers": {
"openai": {
"keys": [
{
"name": "openai-key-1",
"value": "sk-dummy",
"weight": 1,
"models": ["*"]
}
]
}
},
"governance": {
"customers": [
{
"id": "cust-acme",
"name": "Acme Corporation",
"budget_id": "b-cust-acme",
"rate_limit_id": "rl-cust-acme"
}
],
"teams": [
{
"id": "team-eng",
"name": "Engineering",
"customer_id": "cust-acme",
"budget_id": "b-team-eng"
},
{
"id": "team-sales",
"name": "Sales",
"customer_id": "cust-acme",
"budget_id": "b-team-sales"
}
],
"virtual_keys": [
{
"id": "vk-eng-1",
"name": "Engineering VK",
"value": "sk-bf-eng-1",
"is_active": true,
"team_id": "team-eng",
"rate_limit_id": "rl-vk-eng"
}
],
"budgets": [
{"id": "b-cust-acme", "max_limit": 5000, "reset_duration": "1M", "calendar_aligned": true},
{"id": "b-team-eng", "max_limit": 1000, "reset_duration": "1M"},
{"id": "b-team-sales", "max_limit": 500, "reset_duration": "1M"}
],
"rate_limits": [
{"id": "rl-cust-acme", "token_max_limit": 10000000, "token_reset_duration": "1h", "request_max_limit": 10000, "request_reset_duration": "1h"},
{"id": "rl-vk-eng", "token_max_limit": 500000, "token_reset_duration": "1h", "request_max_limit": 500, "request_reset_duration": "1h"}
],
"model_configs": [
{"id": "mc-gpt4", "model_name": "gpt-4o", "provider": "openai", "budget_id": "b-team-eng"},
{"id": "mc-gpt35", "model_name": "gpt-3.5-turbo", "provider": "openai", "rate_limit_id": "rl-vk-eng"}
]
}
}

View File

@@ -0,0 +1,33 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": ".config.db"
}
},
"logs_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": ".logs.db"
}
},
"vector_store": {
"enabled": true,
"type": "weaviate",
"config": {
"scheme": "http",
"host": "localhost:9000",
"grpc_config": {
"host": "localhost:50051",
"secured": false
}
}
},
"client": {
"enable_logging": true,
"log_retention_days": 30
}
}

View File

@@ -0,0 +1,23 @@
version: "3.8"
services:
weaviate:
image: cr.weaviate.io/semitechnologies/weaviate:1.32.4
container_name: weaviate
ports:
- "9000:8080"
- "50051:50051"
environment:
QUERY_DEFAULTS_LIMIT: 25
AUTHENTICATION_APIKEY_ENABLED: "false"
PERSISTENCE_DATA_PATH: "/var/lib/weaviate"
volumes:
- weaviate_data:/var/lib/weaviate
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/v1/.well-known/ready"]
interval: 10s
timeout: 5s
retries: 5
volumes:
weaviate_data:

View File

@@ -0,0 +1,314 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"client": {
"allow_direct_keys": false,
"allowed_origins": [
"*"
],
"disable_content_logging": false,
"drop_excess_requests": false,
"enable_logging": true,
"enforce_auth_on_inference": true,
"initial_pool_size": 300,
"log_retention_days": 365,
"max_request_body_size_mb": 100
},
"config_store": {
"config": {
"path": "../../examples/configs/withvirtualkeys/config.db"
},
"enabled": true,
"type": "sqlite"
},
"framework": {
"pricing": {
"pricing_sync_interval": 86400
}
},
"governance": {
"auth_config": {
"admin_password": "env.BIFROST_ADMIN_PASSWORD",
"admin_username": "env.BIFROST_ADMIN_USERNAME",
"disable_auth_on_inference": true,
"is_enabled": false
},
"virtual_keys": [
{
"id": "sk-bf-vk-prod-assistant-us-01",
"is_active": true,
"name": "prod-assistant-us-key-01-configurations",
"provider_configs": [
{
"key_ids": [
"key-azure-us-1-prod"
],
"allowed_models": [
"*"
],
"provider": "azure",
"weight": 0.5
},
{
"key_ids": [
"key-vertex-us-east1-prod",
"key-vertex-global-prod"
],
"allowed_models": [
"*"
],
"provider": "vertex",
"weight": 0.5
},
{
"key_ids": [
"key-openai-us-1-prod"
],
"allowed_models": [
"*"
],
"provider": "openai",
"weight": 0.5
}
],
"value": "env.BIFROST_VK_PROD_ASSISTANT_US_01"
},
{
"id": "sk-bf-vk-prod-assistant-eu-01",
"is_active": true,
"name": "prod-assistant-eu-key-01-configurations",
"provider_configs": [
{
"key_ids": [
"key-azure-eu-1-prod"
],
"allowed_models": [
"*"
],
"provider": "azure",
"weight": 0.5
},
{
"key_ids": [
"key-vertex-eu-west1-prod",
"key-vertex-global-prod"
],
"allowed_models": [
"*"
],
"provider": "vertex",
"weight": 0.5
},
{
"key_ids": [
"key-bedrock-eu-central-1-prod"
],
"allowed_models": [
"*"
],
"provider": "bedrock",
"weight": 0.5
}
],
"value": "sk-bf-vk-prod-assistant-eu-01"
}
]
},
"logs_store": {
"config": {
"path": "../../examples/configs/withvirtualkeys/logs.db"
},
"enabled": true,
"type": "sqlite"
},
"plugins": [
{
"config": {
"is_vk_mandatory": true
},
"enabled": true,
"name": "governance"
}
],
"providers": {
"azure": {
"keys": [
{
"id": "key-azure-us-1-prod",
"azure_key_config": {
"api_version": "2025-03-01-preview",
"endpoint": "https://orca-prod-us-east-1.openai.azure.com/"
},
"models": [
"gpt-4.1",
"gpt-4.1-mini",
"gpt-4o",
"gpt-4o-mini",
"gpt-5",
"gpt-5-mini",
"gpt-5.1"
],
"name": "azure-us-key-1-prod",
"value": "env.AZURE_OPENAI_API_KEY_US_EAST_1",
"weight": 1
},
{
"id": "key-azure-us-2-prod",
"azure_key_config": {
"api_version": "2025-03-01-preview",
"endpoint": "https://orca-prod-us-east-2.openai.azure.com/"
},
"models": [
"gpt-4.1",
"gpt-4.1-mini",
"gpt-4o",
"gpt-4o-mini",
"gpt-5",
"gpt-5-mini",
"gpt-5.1"
],
"name": "azure-us-key-2-prod",
"value": "env.AZURE_OPENAI_API_KEY_US_EAST_2",
"weight": 1
},
{
"id": "key-azure-eu-1-prod",
"azure_key_config": {
"api_version": "2025-03-01-preview",
"endpoint": "https://orca-prod-eu-central-1.openai.azure.com/"
},
"models": [
"gpt-4.1",
"gpt-4.1-mini",
"gpt-4o",
"gpt-4o-mini",
"gpt-5",
"gpt-5-mini",
"gpt-5.1"
],
"name": "azure-eu-key-1-prod",
"value": "env.AZURE_OPENAI_API_KEY_EU_CENTRAL_1",
"weight": 1
}
]
},
"bedrock": {
"keys": [
{
"id": "key-bedrock-us-east-1-prod",
"bedrock_key_config": {
"access_key": "env.AWS_ACCESS_KEY_ID_US_EAST_1",
"region": "us-east-1",
"secret_key": "env.AWS_SECRET_ACCESS_KEY_US_EAST_1"
},
"models": [
"*"
],
"name": "bedrock-us-east-1-prod",
"weight": 1
},
{
"id": "key-bedrock-us-west-2-prod",
"bedrock_key_config": {
"access_key": "env.AWS_ACCESS_KEY_ID_US_WEST_2",
"region": "us-west-2",
"secret_key": "env.AWS_SECRET_ACCESS_KEY_US_WEST_2"
},
"models": [
"*"
],
"name": "bedrock-us-west-2-prod",
"weight": 1
},
{
"id": "key-bedrock-eu-central-1-prod",
"bedrock_key_config": {
"access_key": "env.AWS_ACCESS_KEY_ID_EU_CENTRAL_1",
"region": "eu-central-1",
"secret_key": "env.AWS_SECRET_ACCESS_KEY_EU_CENTRAL_1"
},
"models": [
"*"
],
"name": "bedrock-eu-central-1-prod",
"weight": 1
}
]
},
"vertex": {
"keys": [
{
"id": "key-vertex-us-east1-prod",
"models": [
"google/gemini-2.5-pro",
"google/gemini-2.5-flash-lite",
"google/gemini-2.5-flash"
],
"name": "vertex-us-east1-prod",
"vertex_key_config": {
"auth_credentials": "env.VERTEX_CREDENTIALS_US_EAST1",
"project_id": "agentic-ai-project-1",
"region": "us-east1"
},
"weight": 1
},
{
"id": "key-vertex-eu-west1-prod",
"models": [
"google/gemini-2.5-pro",
"google/gemini-2.5-flash-lite",
"google/gemini-2.5-flash"
],
"name": "vertex-europe-west1-prod",
"vertex_key_config": {
"auth_credentials": "env.VERTEX_CREDENTIALS_EUROPE_WEST1",
"project_id": "agentic-ai-project-1",
"region": "europe-west1"
},
"weight": 1
},
{
"id": "key-vertex-us-west1-prod",
"models": [
"google/gemini-2.5-pro",
"google/gemini-2.5-flash-lite",
"google/gemini-2.5-flash"
],
"name": "vertex-us-west1-prod",
"vertex_key_config": {
"auth_credentials": "env.VERTEX_CREDENTIALS_US_WEST1",
"project_id": "agentic-ai-project-1",
"region": "us-west1"
},
"weight": 1
},
{
"id": "key-vertex-global-prod",
"models": [
"google/gemini-3-pro-preview",
"google/gemini-3-flash-preview"
],
"name": "vertex-global-prod",
"vertex_key_config": {
"auth_credentials": "env.VERTEX_CREDENTIALS_GLOBAL",
"project_id": "agentic-ai-project-1",
"region": "global"
},
"weight": 1
}
]
},
"openai": {
"keys": [
{
"id": "key-openai-us-1-prod",
"name": "openai-us-key-1-prod",
"value": "env.OPENAI_API_KEY_US_EAST_1",
"weight": 1,
"models": [
"*"
]
}
]
}
}
}

View File

@@ -0,0 +1,32 @@
{
"$schema": "https://www.getbifrost.ai/schema",
"config_store": {
"enabled": true,
"type": "sqlite",
"config": {
"path": "./config.db"
}
},
"websocket": {
"max_connections_per_user": 100,
"transcript_buffer_size": 100,
"pool": {
"max_idle_per_key": 50,
"max_total_connections": 1000,
"idle_timeout_seconds": 600,
"max_connection_lifetime_seconds": 7200
}
},
"providers": {
"openai": {
"keys": [
{
"name": "openai-key-1",
"value": "sk-dummy",
"weight": 1,
"models": ["*"]
}
]
}
}
}