Add Multi-Provider Support for Claude Code Security Reviews#40
Add Multi-Provider Support for Claude Code Security Reviews#40elhayef wants to merge 1 commit intoanthropics:mainfrom
Conversation
|
@peterlai-ant @peter-anthropic can you please reivew ? |
|
@peterlai-ant @peter-anthropic Please review we are kind of blocked on this |
|
@ddworken perhaps you could review this? I am also blocked on this for AWS support. |
seefood
left a comment
There was a problem hiding this comment.
Looks super useful, but my guess is, the PR is too big so they don't want to even start reading it. maybe there is a way to somehow break it down to smaller PRs? one adds the factory, others add bedrock and vertex one by one, etc?
| 'claude-3-5-haiku-20241022': 'anthropic.claude-3-5-haiku-20241022-v1:0', | ||
| 'claude-3-5-sonnet-20241022': 'anthropic.claude-3-5-sonnet-20241022-v2:0', | ||
| 'claude-3-opus-20240229': 'anthropic.claude-3-opus-20240229-v1:0', | ||
| 'claude-opus-4-1-20250805': 'anthropic.claude-3-opus-20240229-v1:0', # Use Claude 3 Opus as fallback |
| self.aws_region = os.environ.get("AWS_REGION") | ||
| self.aws_access_key_id = os.environ.get("AWS_ACCESS_KEY_ID") | ||
| self.aws_secret_access_key = os.environ.get("AWS_SECRET_ACCESS_KEY") |
There was a problem hiding this comment.
feature idea: get credentials from IMDS. e.g. in our setup we use self hosted runners on ec2.
If only there was an automated way to review PRs... ;) |
|
Hi could you pls to review, it seems many people need it |
Overview
This PR introduces comprehensive multi-provider support for Claude Code, enabling users to access Claude models through multiple cloud providers while maintaining full backward compatibility.
✨ Features Added
🔧 Multi-Provider Architecture
🏗️ Clean Architecture
ClaudeClientBase) defining common interfaceClaudeClientFactory) for automatic provider selection🔄 Backward Compatibility
ClaudeAPIClientrefactored but API-compatible📁 Files Added/Modified
Core Architecture
claudecode/claude_client_base.py- Abstract base class for all providersclaudecode/claude_client_factory.py- Factory for provider selectionclaudecode/claude_api_client.py- Refactored to inherit from base classclaudecode/claude_bedrock_client.py- AWS Bedrock implementationclaudecode/claude_vertex_client.py- Google Vertex AI implementationclaudecode/env_validation.py- Environment validation utilitiesDocumentation & Examples
docs/multi-provider-setup.md- Comprehensive setup guideexamples/multi-provider-example.py- Working example demonstrating all providersDependencies
claudecode/requirements.txt- Addedboto3for Bedrock,anthropic[vertex]for Vertex AITesting Suite
test_multi_provider.py- Unit tests for all componentstest_integration_multi_provider.py- Integration tests with real providerstest_providers_manually.py- Manual testing script for quick validationtest_provider_performance.py- Performance testing and benchmarking🛠️ Configuration
Anthropic API (Default)
AWS Bedrock
Google Vertex AI
🧪 Testing
Unit Tests
Integration Tests (requires credentials)
Manual Testing
💡 Usage Examples
Automatic Provider Selection (recommended)
Direct Provider Usage
🔄 Migration Guide
No changes required - existing code continues to work. To use new providers:
pip install boto3for Bedrock orpip install 'anthropic[vertex]'for Vertex AI🎯 Benefits
🧪 Test Coverage
🔍 Technical Details
Provider-Specific Features:
Quality Assurance:
📈 Performance Impact
🚨 Breaking Changes
None - This is a fully backward-compatible change.