How aws-samples/sample-kolya-br-proxy works
Kolya BR Proxy is a multi-provider AI gateway with OpenAI-compatible and Anthropic Messages interfaces, plus an administrative web console. A client request enters a compatible API endpoint, is authenticated and quota-checked, routed to a provider-specific adapter, and returned in the requested format; usage and pricing support billing and administration. The README documents those routing capabilities, while sampled source confirms the app entry point, API routers, provider clients, database and frontend routes. Some internal call wiring is unsampled, so links below reflect documented behavior rather than asserted implementation details.
Main entry points: v1/router.py OpenAI API · anthropic/router.py Anthropic API · database.py PostgreSQL · translator.py Format translation
Components 22
API gateway
- FastAPI application
backend/main.py - OpenAI API
backend/app/api/v1/router.py - Anthropic API
backend/app/api/anthropic/router.py - Token and quota
backend/app/services/auth.py - Format translation
backend/app/services/translator.py - Anthropic translation
backend/app/services/anthropic_translator.py - Usage tracking
backend/app/services/usage_stats.py
Model providers
- Bedrock client
backend/app/services/bedrock.py - Gemini client
backend/app/services/gemini_client.py - Mantle client
backend/app/services/mantle_client.py
Admin and operations
- Admin console
frontend/src/App.vue - Admin endpoints
backend/app/api/admin/router.py - OAuth services
backend/app/services/oauth.py - Pricing updates
backend/app/services/pricing_updater.py - Pricing scheduler
backend/app/tasks/pricing_tasks.py
Persistence and shared services
- PostgreSQL
backend/app/core/database.py - Redis configuration
backend/app/core/redis.py - Domain records
backend/app/models
Other components
- API client
- AWS Bedrock
- Google Gemini
- AWS mantle
Connections 29
- API client → OpenAI API: sends OpenAI requests
- API client → Anthropic API: sends Messages requests
- OpenAI API → FastAPI application: handled by app
- Anthropic API → FastAPI application: handled by app
- OpenAI API → Token and quota: validates token
- Anthropic API → Token and quota: validates token
- OpenAI API → Format translation: translates formats
- Anthropic API → Anthropic translation: translates formats
- Format translation → Bedrock client: routes other models
- Format translation → Gemini client: routes Gemini models
- Format translation → Mantle client: routes OpenAI models
- Anthropic translation → Bedrock client: routes other models
- Anthropic translation → Gemini client: routes Gemini models
- Anthropic translation → Mantle client: routes OpenAI models
- Bedrock client → AWS Bedrock: invokes models
- Gemini client → Google Gemini: calls generateContent
- Mantle client → AWS mantle: calls Responses API
- OpenAI API → Usage tracking: records usage
- Anthropic API → Usage tracking: records usage
- Admin console → Admin endpoints: uses admin API
- Admin endpoints → OAuth services: handles sign-in
- Admin endpoints → Pricing updates: manages pricing
- Pricing scheduler → Pricing updates: runs refresh
- FastAPI application → PostgreSQL: initializes database
- Usage tracking → PostgreSQL: records usage
- Pricing updates → PostgreSQL: stores pricing
- Admin endpoints → PostgreSQL: reads and writes
- FastAPI application → Redis configuration: subscribes configuration
- PostgreSQL → Domain records: stores records