This guide covers the deployment of the enhanced CCany application with full Claude Code compatibility.
-
Clone the repository:
git clone <repository-url> cd ccany
-
Set up environment:
cp .env.example .env # Edit .env file with your API keys and configuration -
Deploy using the deployment script:
./scripts/deploy.sh start
./scripts/deploy.sh start./scripts/deploy.sh monitoring./scripts/deploy.sh nginx./scripts/deploy.sh test| Variable | Description | Default |
|---|---|---|
OPENAI_API_KEY |
OpenAI API key | Required |
CLAUDE_API_KEY |
Claude API key | Optional |
BIG_MODEL |
Large model for complex tasks | gpt-4o |
SMALL_MODEL |
Small model for simple tasks | gpt-4o-mini |
REASONING_MODEL |
Model for thinking mode | gpt-4o |
LONG_CONTEXT_MODEL |
Model for long context | gpt-4o |
MAX_TOKENS_LIMIT |
Maximum tokens per request | 8192 |
REQUEST_TIMEOUT |
Request timeout in seconds | 120 |
CLAUDE_CODE_COMPATIBLE |
Enable Claude Code compatibility | true |
CLAUDE_PROXY_DATA_PATH |
Data storage directory | ./data |
CLAUDE_PROXY_MASTER_KEY |
Master key for encrypting sensitive configs | Required for production |
JWT_SECRET |
JWT key for user authentication | Required for production |
The enhanced version includes:
- ✅ Complete SSE Event Sequence: Proper
message_start,content_block_start,ping,content_block_delta,content_block_stop,message_delta, andmessage_stopevents - ✅ Request Cancellation: Client disconnect detection and graceful request cancellation
- ✅ Claude Configuration: Automatic
~/.claude.jsonconfiguration file creation - ✅ Thinking Mode: Support for
thinkingfield with intelligent model routing - ✅ Enhanced Tool Calls: Proper tool call streaming with incremental JSON parsing
- ✅ Cache Tokens: Support for
cache_read_input_tokensin usage reporting - ✅ Smart Routing: Intelligent model selection based on complexity and token count
- ccany: Main application with Claude Code enhancements
- redis: Caching and session management
- nginx: Reverse proxy (optional)
- prometheus: Metrics collection
- grafana: Visualization dashboard
- test-claude-code: Claude Code compatibility tests
The application includes comprehensive health checks:
# Check application health
curl http://localhost:8082/health
# Check detailed health status
curl http://localhost:8082/health/detailed
# Check system metrics
curl http://localhost:8082/health/metricsWhen deployed with monitoring:
- Grafana: http://localhost:3000 (admin/admin)
- Prometheus: http://localhost:9090
-
Port already in use:
docker-compose down ./scripts/deploy.sh cleanup
-
Permission denied:
chmod +x scripts/deploy.sh
-
Database issues:
docker volume rm ccany_ccany_data ./scripts/deploy.sh restart
# Show all service logs
./scripts/deploy.sh logs
# Show specific service logs
docker-compose logs ccany
# Follow logs in real-time
docker-compose logs -f ccany# Build the application
./scripts/deploy.sh build
# Run tests
./scripts/deploy.sh test
# Development with hot reload
docker-compose up --build- Make code changes
- Test locally:
./scripts/deploy.sh test - Build:
./scripts/deploy.sh build - Deploy:
./scripts/deploy.sh restart
- Docker and Docker Compose installed
- Sufficient system resources (2GB RAM minimum)
- Network access to OpenAI/Claude APIs
-
Use strong passwords:
export JWT_SECRET=$(openssl rand -base64 32) export CLAUDE_PROXY_MASTER_KEY=$(openssl rand -base64 32)
-
Enable HTTPS:
- Configure SSL certificates in
ssl/directory - Use the nginx profile for reverse proxy
- Configure SSL certificates in
-
Firewall configuration:
# Allow only necessary ports ufw allow 22/tcp ufw allow 80/tcp ufw allow 443/tcp ufw enable
For high-traffic deployments:
-
Use multiple replicas:
docker-compose up --scale ccany=3
-
External database:
- Configure PostgreSQL instead of SQLite
- Update
DATABASE_URLin.env
-
Load balancing:
- Use nginx upstream configuration
- Configure health checks
# Backup data volumes
docker run --rm -v ccany_ccany_data:/data -v $(pwd):/backup alpine tar czf /backup/ccany-backup.tar.gz /data
# Backup configuration
cp .env .env.backup# Restore data volumes
docker run --rm -v ccany_ccany_data:/data -v $(pwd):/backup alpine tar xzf /backup/ccany-backup.tar.gz
# Restore configuration
cp .env.backup .envPOST /v1/messages- Claude Code compatible messagesGET /v1/models/capabilities- Model capabilitiesPOST /v1/messages/count_tokens- Enhanced token countingPOST /v1/chat/completions- OpenAI compatible endpoint
- Thinking Mode: Include
"thinking": truein requests - Model Commands: Use
/model provider,modelin messages - Enhanced Streaming: Complete SSE event sequence
- Tool Calls: Proper incremental JSON parsing
For issues and questions:
- Check the troubleshooting guide
- Review application logs
- Check health endpoints
- Verify configuration