Add support for alternate LLM providers
Overview
Add support for invoking models beyond AWS Bedrock, including 3rd party public endpoints (e.g., OpenAI, Anthropic API, Cohere) and privately hosted LLM routers (e.g., LiteLLM). This will provide users with flexibility to choose their preferred model providers and enable deployment in environments where Bedrock may not be available or optimal.
Requirements
R1: Multi-Provider Model Selection
Users should be able to select models from other model providers, public or private. This includes:
Support for major public LLM providers (OpenAI, Anthropic API, Cohere, Google Vertex AI)
Support for privately hosted LiteLLM model router endpoints
Support for custom OpenAI-compatible endpoints
Model selection UI that displays available models across all configured providers
Provider-specific authentication and authorization
Fallback behavior when a provider is unavailable
Technical Considerations
Provider Abstraction Layer
LLM Provider Interface : Create an abstract provider interface that normalizes:
Model invocation (prompt/messages format)
Response streaming
Token usage tracking
Error handling
Rate limiting and retry logic
Provider Implementations : Implement concrete providers:
BedrockProvider (existing, refactored)
OpenAIProvider (OpenAI API and compatible endpoints)
AnthropicProvider (direct Anthropic API)
LiteLLMProvider (privately hosted LiteLLM router)
VertexAIProvider (Google Vertex AI)
CohereProvider (Cohere API)
Configuration Management
Update etc/environment.sh to include provider-specific configuration:
Provider type (bedrock, openai, anthropic, litellm, etc.)
API endpoints (base URLs for custom/private deployments)
Authentication method (API keys, IAM, OAuth)
Model availability and pricing
Store sensitive credentials in AWS Secrets Manager, not in environment files
Support per-agent provider configuration (some agents may use different providers)
Environment-specific provider configurations (dev vs production)
Backend Changes
Provider Factory : Create a factory pattern to instantiate the correct provider based on configuration
Provider Registry : Maintain a registry of available providers and their models
Cost Tracking : Extend cost tracking to support different provider pricing models
Token-based pricing (most providers)
Request-based pricing
Custom pricing for private deployments
Response Normalization : Normalize responses across providers to maintain consistent API contracts
Streaming Support : Ensure streaming works consistently across providers
Frontend Changes
Model Selection UI : Update model selection dropdown to show:
Provider name/logo
Model name
Model capabilities (context length, vision support, etc.)
Estimated pricing
Provider Status : Display provider availability status
Error Handling : Provider-specific error messages and troubleshooting
Security Considerations
API Key Management :
Store API keys in AWS Secrets Manager
Never log or expose API keys in responses
Support key rotation
VPC Integration : Private LiteLLM deployments may require VPC connectivity (see Issue Add support for VPC-enabled agents #73 )
Rate Limiting : Implement provider-specific rate limiting to avoid quota issues
Audit Logging : Log which provider/model was used for each invocation
Dependencies
Install provider SDKs as needed:
openai (Python SDK for OpenAI and compatible endpoints)
anthropic (Python SDK for Anthropic API)
cohere (Python SDK for Cohere)
litellm (Python SDK for LiteLLM router)
google-cloud-aiplatform (for Vertex AI)
Acceptance Criteria
AC1: Provider Abstraction
AC2: Configuration
AC3: Model Selection
AC4: Cost Tracking
AC5: Error Handling
AC6: Testing
Implementation Notes
Suggested Approach
Phase 1: Provider Abstraction (Week 1)
Design and implement provider interface in backend/
Refactor existing Bedrock integration to use new interface
Create provider factory and registry
Add unit tests
Phase 2: OpenAI Provider (Week 1-2)
Implement OpenAIProvider class
Add OpenAI SDK dependency with uv
Configure API key in Secrets Manager
Test with OpenAI API and OpenAI-compatible endpoints
Update cost tracking for OpenAI pricing
Phase 3: LiteLLM Provider (Week 2)
Implement LiteLLMProvider class
Add LiteLLM SDK dependency
Support custom endpoint configuration for private deployments
Test with public LiteLLM demo endpoint first
Document private deployment setup
Phase 4: Frontend Integration (Week 2-3)
Update model selection API to return multi-provider models
Update frontend UI to display provider information
Add provider status indicators
Update cost dashboard to show provider-specific costs
Phase 5: Additional Providers (Week 3)
Implement Anthropic API provider
Implement other providers as needed
Comprehensive testing across all providers
Key Files to Modify/Create
Backend:
backend/providers/ (new directory):
base.py: Abstract provider interface
bedrock.py: Refactored Bedrock provider
openai.py: OpenAI provider implementation
litellm.py: LiteLLM provider implementation
anthropic.py: Anthropic API provider
factory.py: Provider factory
registry.py: Provider registry
backend/models/: Update data models for provider metadata
backend/api/: Update endpoints to support provider selection
backend/cost/: Extend cost calculation for multiple providers
backend/requirements.txt or pyproject.toml: Add provider SDKs
Configuration:
etc/environment.sh: Add provider configuration
iac/: SAM templates for Secrets Manager secrets
Frontend:
frontend/src/components/ModelSelector.tsx: Multi-provider model selection
frontend/src/components/ProviderStatus.tsx: Provider health indicators
frontend/src/pages/CostDashboardPage.tsx: Update to show provider in costs
Tests:
backend/tests/providers/: Provider-specific tests
backend/tests/integration/: Multi-provider integration tests
Provider Priority
OpenAI - Most widely used, good for testing abstraction
LiteLLM - Enables private deployments and multi-provider routing
Anthropic API - Direct access to Claude models outside AWS
Others - Cohere, Vertex AI (lower priority)
Cost Tracking Updates
Each provider has different pricing models:
OpenAI : Per 1K tokens (separate input/output pricing)
Anthropic API : Per 1M tokens (separate input/output pricing)
Bedrock : Per 1K tokens (varies by model)
LiteLLM : Depends on backend provider
Update formatCost functions to handle provider-specific pricing and maintain consistency across:
CostDashboardPage.tsx
InvocationDetailPage.tsx
LatencySummary.tsx
InvocationTable.tsx
Testing Strategy
Unit Tests : Mock provider responses and test interface implementation
Integration Tests : Use provider SDK test modes or mock servers
Manual Testing : Test with real provider accounts (low quota/cost)
Load Testing : Verify rate limiting and retry logic
Cost Validation : Ensure cost calculations match provider billing
References
Dependencies
Priority
High - Increases platform flexibility and reduces vendor lock-in
Estimated Effort
Large (3 weeks) - Requires significant refactoring, new integrations, and thorough testing
Add support for alternate LLM providers
Overview
Add support for invoking models beyond AWS Bedrock, including 3rd party public endpoints (e.g., OpenAI, Anthropic API, Cohere) and privately hosted LLM routers (e.g., LiteLLM). This will provide users with flexibility to choose their preferred model providers and enable deployment in environments where Bedrock may not be available or optimal.
Requirements
R1: Multi-Provider Model Selection
Users should be able to select models from other model providers, public or private. This includes:
Technical Considerations
Provider Abstraction Layer
BedrockProvider(existing, refactored)OpenAIProvider(OpenAI API and compatible endpoints)AnthropicProvider(direct Anthropic API)LiteLLMProvider(privately hosted LiteLLM router)VertexAIProvider(Google Vertex AI)CohereProvider(Cohere API)Configuration Management
etc/environment.shto include provider-specific configuration:Backend Changes
Frontend Changes
Security Considerations
Dependencies
openai(Python SDK for OpenAI and compatible endpoints)anthropic(Python SDK for Anthropic API)cohere(Python SDK for Cohere)litellm(Python SDK for LiteLLM router)google-cloud-aiplatform(for Vertex AI)Acceptance Criteria
AC1: Provider Abstraction
AC2: Configuration
etc/environment.shAC3: Model Selection
AC4: Cost Tracking
~prefixAC5: Error Handling
AC6: Testing
Implementation Notes
Suggested Approach
Phase 1: Provider Abstraction (Week 1)
backend/Phase 2: OpenAI Provider (Week 1-2)
OpenAIProviderclassuvPhase 3: LiteLLM Provider (Week 2)
LiteLLMProviderclassPhase 4: Frontend Integration (Week 2-3)
Phase 5: Additional Providers (Week 3)
Key Files to Modify/Create
Backend:
backend/providers/(new directory):base.py: Abstract provider interfacebedrock.py: Refactored Bedrock provideropenai.py: OpenAI provider implementationlitellm.py: LiteLLM provider implementationanthropic.py: Anthropic API providerfactory.py: Provider factoryregistry.py: Provider registrybackend/models/: Update data models for provider metadatabackend/api/: Update endpoints to support provider selectionbackend/cost/: Extend cost calculation for multiple providersbackend/requirements.txtorpyproject.toml: Add provider SDKsConfiguration:
etc/environment.sh: Add provider configurationiac/: SAM templates for Secrets Manager secretsFrontend:
frontend/src/components/ModelSelector.tsx: Multi-provider model selectionfrontend/src/components/ProviderStatus.tsx: Provider health indicatorsfrontend/src/pages/CostDashboardPage.tsx: Update to show provider in costsTests:
backend/tests/providers/: Provider-specific testsbackend/tests/integration/: Multi-provider integration testsProvider Priority
Cost Tracking Updates
Each provider has different pricing models:
Update
formatCostfunctions to handle provider-specific pricing and maintain consistency across:CostDashboardPage.tsxInvocationDetailPage.tsxLatencySummary.tsxInvocationTable.tsxTesting Strategy
References
Dependencies
Priority
High - Increases platform flexibility and reduces vendor lock-in
Estimated Effort
Large (3 weeks) - Requires significant refactoring, new integrations, and thorough testing