README
ยถ
ccNexus (Claude Code Nexus)
โจ Features
- ๐ Automatic Endpoint Rotation - Seamlessly switches between endpoints on errors
- ๐ Multi-Provider Support - Use official Claude API and third-party providers
- ๐ Multi-Format Transformer - Support Claude, OpenAI, and Gemini API formats
- ๐ Smart Retry - Retries on any non-200 response
- ๐ Real-time Statistics - Monitor requests, errors, and endpoint usage
- ๐ฐ Token Usage Tracking - Track input/output tokens for each endpoint
- ๐ฏ Endpoint Management - Enable/disable endpoints with toggle switches
- ๐ Secure API Key Display - Shows only last 4 characters of API keys
- ๐ฆ Smart Load Balancing - Distributes requests only to enabled endpoints
- ๐ Comprehensive Logging - Multi-level logging (DEBUG/INFO/WARN/ERROR) with real-time viewing
- ๐ฅ๏ธ Desktop GUI - Beautiful cross-platform interface built with Wails
- ๐ Single Binary - No dependencies, just download and run
- ๐ง Easy Configuration - Manage endpoints through GUI or config file
- ๐พ Persistent Config - Automatically saves configuration and preferences
- ๐ Local First - All data stays on your machine
๐ Quick Start
Download
Download the latest release for your platform:
- Windows:
ccNexus-windows-amd64.zip - macOS (Intel):
ccNexus-darwin-amd64.zip - macOS (Apple Silicon):
ccNexus-darwin-arm64.zip - Linux:
ccNexus-linux-amd64.tar.gz
Installation
Windows
- Extract the ZIP file
- Double-click
ccNexus.exe - The application will start with a default configuration
macOS
- Extract the ZIP file
- Move
ccNexus.appto Applications folder - Right-click and select "Open" (first time only)
- The application will start with a default configuration
Linux
tar -xzf ccNexus-linux-amd64.tar.gz
chmod +x ccNexus
./ccNexus
Configuration
- Add Endpoints: Click "Add Endpoint" button
- Fill in Details:
- Name: A friendly name (e.g., "Claude Official")
- API URL: The API server address (e.g.,
api.anthropic.com) - API Key: Your API key
- Transformer: Select API format (Claude/OpenAI/Gemini)
- Model: Required for OpenAI and Gemini (e.g.,
gpt-4-turbo,gemini-pro)
- Save: Click "Save" to add the endpoint
Configure Claude Code
In Claude Code settings:
- API Base URL:
http://localhost:3000 - API Key: Any value (will be replaced by proxy)
๐ How It Works
Claude Code โ Proxy (localhost:3000) โ Endpoint #1 (non-200 response)
โ Endpoint #2 (success) โ
- Request Interception: Proxy receives all API requests
- Endpoint Selection: Uses current available endpoint
- Error Detection: Monitors response status codes
- Auto Retry: Switches endpoint and retries on non-200 responses
- Round Robin: Cycles through all endpoints
๐ What's New in v0.5.0
๐ Multi-Format API Transformer Support
- OpenAI API Format: Full support for OpenAI-compatible APIs
- Request/response transformation between Claude and OpenAI formats
- Tool calling support with proper format conversion
- Streaming response handling with thinking blocks
- Model specification for different OpenAI-compatible endpoints
- Google Gemini API Format: Native support for Google's Gemini API
- Complete request/response transformation
- Function calling (tools) support
- Streaming response handling
- Model specification for different Gemini models
- Flexible Configuration: Easy switching between API formats through GUI
- Select transformer type (Claude/OpenAI/Gemini) per endpoint
- Automatic model field display for non-Claude transformers
- Seamless integration with existing endpoint management
๐ก Usage Example
Configure multiple API providers with different formats:
{
"endpoints": [
{
"name": "Claude Official",
"transformer": "claude",
"apiUrl": "api.anthropic.com"
},
{
"name": "OpenAI GPT-4",
"transformer": "openai",
"model": "gpt-4-turbo",
"apiUrl": "api.openai.com"
},
{
"name": "Google Gemini",
"transformer": "gemini",
"model": "gemini-pro",
"apiUrl": "generativelanguage.googleapis.com"
}
]
}
๐ง Configuration File
Configuration is stored at:
- Windows:
%USERPROFILE%\.ccNexus\config.json - macOS/Linux:
~/.ccNexus/config.json
Example:
{
"port": 3000,
"logLevel": 1,
"endpoints": [
{
"name": "Claude Official 1",
"apiUrl": "api.anthropic.com",
"apiKey": "sk-ant-api03-your-key-1",
"transformer": "claude",
"enabled": true
},
{
"name": "OpenAI Compatible",
"apiUrl": "api.openai.com",
"apiKey": "sk-your-openai-key",
"transformer": "openai",
"model": "gpt-4-turbo",
"enabled": true
},
{
"name": "Google Gemini",
"apiUrl": "generativelanguage.googleapis.com",
"apiKey": "your-gemini-key",
"transformer": "gemini",
"model": "gemini-pro",
"enabled": true
}
]
}
Configuration Fields:
port: Proxy server port (default: 3000)logLevel: Logging level - 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR (default: 1)endpoints: Array of API endpointsname: Friendly name for the endpointapiUrl: API server addressapiKey: API authentication keytransformer: API format - "claude" (default), "openai", or "gemini"model: Model name (required for OpenAI and Gemini transformers)enabled: Whether the endpoint is active
๐ ๏ธ Development
Prerequisites
- Go 1.22+
- Node.js 18+
- Wails CLI v2
Setup
# Clone repository
git clone https://github.com/lich0821/ccNexus.git
cd ccNexus
# Install Wails
go install github.com/wailsapp/wails/v2/cmd/wails@latest
# Install dependencies
go mod download
cd frontend && npm install && cd ..
# Run in development mode
wails dev
Build
# Build for current platform
wails build
# Build for specific platform
wails build -platform windows/amd64
wails build -platform darwin/amd64
wails build -platform darwin/arm64
wails build -platform linux/amd64
๐ Project Structure
ccNexus/
โโโ main.go # Application entry point
โโโ app.go # Wails app logic
โโโ internal/
โ โโโ proxy/ # Proxy core logic
โ โ โโโ proxy.go # HTTP proxy with retry
โ โ โโโ stats.go # Statistics tracking
โ โโโ config/ # Configuration management
โ โ โโโ config.go # Config structure
โ โโโ transformer/ # API format transformers
โ โ โโโ transformer.go # Transformer interface
โ โ โโโ claude.go # Claude API format
โ โ โโโ openai.go # OpenAI API format
โ โ โโโ gemini.go # Gemini API format
โ โ โโโ types.go # Common types
โ โ โโโ registry.go # Transformer registry
โ โโโ logger/ # Logging system
โ โโโ logger.go # Multi-level logger
โโโ frontend/ # Frontend UI
โ โโโ index.html
โ โโโ src/
โ โโโ main.js # UI logic
โ โโโ style.css # Styles
โโโ .github/workflows/
โโโ build.yml # CI/CD pipeline
โ FAQ
Q: Proxy won't start?
A: Check if port is in use:
# macOS/Linux
lsof -i :3000
# Windows
netstat -ano | findstr :3000
Q: Claude Code can't connect?
A: Verify:
- Proxy application is running
- Claude Code Base URL is
http://localhost:3000 - Firewall isn't blocking the connection
Q: Endpoint switching not working?
A: Check:
- Multiple endpoints are configured
- API keys are valid
- View application logs for switching behavior
Q: How to view detailed logs?
A:
- Built-in Log Panel: Use the Logs section in the application UI
- Select log level: DEBUG, INFO, WARN, or ERROR
- Auto-refreshes every 2 seconds
- Copy logs with one click
- Shows last 100 log entries
- Console Output:
- macOS/Linux: Run app from terminal to see real-time logs
- Windows: Logs are displayed in the built-in log panel
- Advanced: Use
./ccNexus 2>&1 | tee ccNexus.logto save logs to file
Q: What do the log levels mean?
A:
- DEBUG (๐): Detailed information for debugging (request URLs, token counts, etc.)
- INFO (โน๏ธ): General information (endpoint switches, configuration changes)
- WARN (โ ๏ธ): Warning messages (HTTP errors, retry attempts)
- ERROR (โ): Error messages (critical failures, connection issues)
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
๐ Support
- ๐ Report Bug
- ๐ก Request Feature
- ๐ฌ Discussions
Made with โค๏ธ by Chuck
Documentation
ยถ
There is no documentation for this package.
Click to show internal directories.
Click to hide internal directories.