CCProxy

CCProxy is a high-performance Go proxy server that enables Claude Code to work with multiple AI providers through intelligent routing and API translation.
π Features
- Multi-Provider Support: Anthropic, OpenAI, Google Gemini, DeepSeek, OpenRouter
- Intelligent Routing: Automatic model selection based on token count and parameters
- API Translation: Seamless conversion between Anthropic and provider-specific formats
- Tool Support: Full support for function calling across all compatible providers
- Streaming Support: Server-Sent Events (SSE) for real-time responses
- Cross Platform: Binaries available for Linux, macOS, and Windows (AMD64/ARM64)
- Process Management: Background service with automatic startup and graceful shutdown
- Health Monitoring: Built-in health checks and provider status tracking
- Security: API key validation, IP-based access control, rate limiting
π Quick Start
Option 1: Download Pre-built Binary
- Download the latest binary for your platform from the releases page
- Create a configuration file:
cp example.config.json config.json
# Edit config.json to add your provider API keys
- Start CCProxy:
./ccproxy start
Option 2: Build from Source
- Prerequisites: Go 1.23 or later
- Clone and build:
git clone https://github.com/orchestre-dev/ccproxy.git
cd ccproxy
go build ./cmd/ccproxy
- Configure:
cp example.config.json config.json
# Edit config.json to add your provider API keys
- Start the service:
./ccproxy start
Option 3: Docker
docker build -t ccproxy .
docker run -d -p 3456:3456 -v $(pwd)/config.json:/home/ccproxy/.ccproxy/config.json ccproxy
Option 4: One-Command Setup with Claude Code
# CCProxy will auto-start and configure Claude Code
./ccproxy code
π§ Configuration
CCProxy uses a JSON configuration file. Create config.json based on example.config.json:
{
"host": "127.0.0.1",
"port": 3456,
"log": true,
"apikey": "your-api-key-here",
"providers": [
{
"name": "anthropic",
"api_base_url": "https://api.anthropic.com",
"api_key": "your-anthropic-api-key",
"models": ["claude-3-opus-20240229", "claude-3-sonnet-20240229"],
"enabled": true
},
{
"name": "openai",
"api_base_url": "https://api.openai.com/v1",
"api_key": "your-openai-api-key",
"models": ["gpt-4", "gpt-4-turbo", "gpt-3.5-turbo"],
"enabled": false
}
],
"routes": {
"default": {
"provider": "anthropic",
"model": "claude-3-sonnet-20240229"
}
}
}
Environment Variables
| Variable |
Default |
Description |
CCPROXY_PORT |
3456 |
Override default port |
CCPROXY_HOST |
127.0.0.1 |
Override default host |
CCPROXY_API_KEY |
|
Set API key for authentication |
CCPROXY_CONFIG |
|
Path to configuration file |
LOG |
false |
Enable file logging |
π― Using with Claude Code
Automatic Setup (Recommended)
# CCProxy will auto-start and configure Claude Code environment
./ccproxy code
Manual Setup
-
Start CCProxy:
./ccproxy start
-
Configure Claude Code:
export ANTHROPIC_BASE_URL=http://localhost:3456
export ANTHROPIC_AUTH_TOKEN=test
-
Use Claude Code:
claude "Help me with my code"
π Supported Providers
CCProxy supports multiple AI providers with full API translation:
- Anthropic - Claude models with native support
- OpenAI - GPT-4, GPT-3.5 models
- Google Gemini - Advanced multimodal models
- DeepSeek - Cost-effective coding models
- OpenRouter - Access to 100+ models from various providers
Provider Support Levels
CCProxy offers different levels of support for various providers:
These providers have complete API translation and all features work seamlessly:
- Anthropic - Native Claude API support
- OpenAI - Complete GPT model compatibility
- Google Gemini - Full multimodal support
- DeepSeek - Optimized for coding tasks
- OpenRouter - Unified access to multiple providers
Basic Routing Support
These providers have basic routing capabilities but may have limited functionality:
- Groq, Mistral, XAI, Ollama - Basic message routing only
For production use, we recommend using providers with full support.
Configuration Example
Add providers to your config.json:
{
"providers": [
{
"name": "openai",
"api_base_url": "https://api.openai.com/v1",
"api_key": "your-api-key",
"models": ["gpt-4", "gpt-3.5-turbo"],
"enabled": true
}
]
}
π API Endpoints
POST /v1/messages - Anthropic-compatible messages endpoint
GET /health - Health check endpoint
GET /status - Service status information
GET /providers - List configured providers
POST /providers - Add new provider
PUT /providers/:name - Update provider
DELETE /providers/:name - Remove provider
Example Request
curl -X POST http://localhost:3456/v1/messages \
-H "Content-Type: application/json" \
-H "x-api-key: your-api-key" \
-d '{
"model": "claude-3-sonnet-20240229",
"max_tokens": 1000,
"messages": [
{
"role": "user",
"content": "Hello, how are you?"
}
]
}'
π¨ Development
Building
# Build for current platform
make build
# Cross-platform builds
make build-all
# Run tests
make test
# Run tests with race detection
make test-race
Commands
ccproxy start - Start the service
ccproxy stop - Stop the service
ccproxy status - Check service status
ccproxy code - Configure Claude Code
ccproxy version - Show version
ccproxy env - Show environment variables
π License
MIT License - see LICENSE file for details.
π€ Contributing
Contributions are welcome! Please read our Contributing Guidelines first.
π Acknowledgments
Built with β€οΈ for the Claude Code community.
π Troubleshooting
Common Issues
-
Service won't start
- Check if port 3456 is available:
lsof -i :3456
- Verify configuration file syntax
- Check logs:
tail -f ~/.ccproxy/ccproxy.log
-
Authentication errors
- Verify API keys in config.json
- Check provider is enabled in configuration
- Ensure API key has correct permissions
-
Connection refused
- Check service status:
./ccproxy status
- Verify firewall settings
- Ensure service is bound to correct interface
Debug Mode
Enable debug logging:
LOG=true ./ccproxy start
# Check logs at ~/.ccproxy/ccproxy.log
π Support
If you find this project useful, please consider giving it a β on GitHub!