Skip to content

Intelligent API gateway for Claude Code - rotate endpoints, monitor usage, and seamlessly integrate OpenAI, Gemini, and other platforms.

License

Notifications You must be signed in to change notification settings

lich0821/ccNexus

Repository files navigation

ccNexus

Smart API endpoint rotation proxy for Claude Code

Build Status License: MIT Go Version Wails

English | ็ฎ€ไฝ“ไธญๆ–‡

๐Ÿ“ธ Screenshot

Light Dark

โœจ Features

  • ๐Ÿ”„ Auto Endpoint Rotation - Seamless failover on errors
  • ๐Ÿ”€ Multi-Format Support - Claude, OpenAI, and Gemini API formats
  • ๐Ÿ” Smart Retry - Automatic retry with endpoint switching
  • ๐Ÿ“Š Real-time Stats - Monitor requests, errors, and token usage
  • ๐Ÿ“ˆ Historical Data - SQLite-based statistics with monthly archives
  • ๐Ÿ–ฅ๏ธ Desktop GUI - Cross-platform interface with light/dark themes
  • ๐Ÿš€ Single Binary - No dependencies required
  • ๐Ÿ”’ Local First - All data stays on your machine

๐Ÿš€ Quick Start

๐Ÿ“ฅ Download Latest Release

Installation

Windows: Extract ZIP and run ccNexus.exe macOS: Extract ZIP, move to Applications, right-click โ†’ Open Linux: tar -xzf ccNexus-linux-amd64.tar.gz && ./ccNexus

Setup

  1. Click "Add Endpoint" and configure:

    • Name: Friendly identifier
    • API URL: e.g., api.anthropic.com
    • API Key: Your API key
    • Transformer: Claude/OpenAI/Gemini
    • Model: Required for OpenAI/Gemini (e.g., gpt-4-turbo)
  2. Configure Claude Code:

    • API Base URL: http://localhost:3000
    • API Key: Any value

๐Ÿ“– How It Works

Claude Code โ†’ Proxy (localhost:3000) โ†’ Endpoint #1 (fails) โ†’ Endpoint #2 (success) โœ…

Proxy intercepts requests, forwards to enabled endpoints with round-robin rotation, and automatically retries on failures.

๐Ÿ”ง Configuration

Data Location: ~/.ccNexus/ (Windows: %USERPROFILE%\.ccNexus\)

Files:

  • ccnexus.db - SQLite database (config + stats)
  • config.json - Legacy config (auto-migrated on first run)

Settings:

  • port: Proxy port (default: 3000)
  • logLevel: 0=DEBUG, 1=INFO, 2=WARN, 3=ERROR

๐Ÿ› ๏ธ Development

Prerequisites: Go 1.22+, Node.js 18+

# Clone and run
git clone https://github.com/lich0821/ccNexus.git
cd ccNexus
node run.mjs  # Auto-installs Wails CLI and dependencies

# Build
npm run build              # Current platform
npm run build:prod         # Optimized build
npm run build:windows      # Windows
npm run build:macos        # macOS
npm run build:linux        # Linux

๐Ÿ“š Architecture

ccNexus/
โ”œโ”€โ”€ main.go & app.go           # Application entry
โ”œโ”€โ”€ internal/
โ”‚   โ”œโ”€โ”€ proxy/                 # HTTP proxy with retry logic
โ”‚   โ”œโ”€โ”€ storage/               # SQLite persistence + migration
โ”‚   โ”œโ”€โ”€ transformer/           # API format converters (Claude/OpenAI/Gemini)
โ”‚   โ”œโ”€โ”€ config/                # Configuration management
โ”‚   โ””โ”€โ”€ logger/                # Multi-level logging
โ””โ”€โ”€ frontend/                  # Vanilla JS UI
Made with โค๏ธ by Chuck

About

Intelligent API gateway for Claude Code - rotate endpoints, monitor usage, and seamlessly integrate OpenAI, Gemini, and other platforms.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 5