$ show lich0821/ccNexus
ccNexus is a desktop application (built with Wails v2, Go backend + web frontend) and a headless server that acts as a smart proxy for multiple AI API endpoints, including Claude, OpenAI Chat, OpenAI Responses, and Gemini. It manages endpoint rotation with automatic failover, credential token pools (API keys, access tokens, refresh tokens), and real-time format conversion between the different API protocols. The system provides a full-featured GUI for managing endpoints, viewing usage statistics, configuring backup/restore (WebDAV, local, S3), launching Claude Code or Codex CLI terminals, and applying visual themes. A separate web UI is available for headless deployments via Docker. The architecture follows a layered design: a proxy layer handles request routing, authentication, and streaming response transformation; a transformer layer converts between API formats using a registry of converters; a storage layer persists endpoints, credentials, and stats in SQLite; and a service layer orchestrates higher-level operations like backup, updates, and terminal launching. The codebase demonstrates strong engineering practices including thread-safe configuration, adapter patterns for storage abstraction, SSE for real-time stats, and comprehensive contract tests. Notable features include zero-cost endpoint testing, incremental stats updates, and a credential lifecycle management system with rate limit tracking and automatic cooldown. While primarily an application, ccNexus includes some data-oriented components such as token counting, usage statistics aggregation, and credential rate limit parsing. However, these serve the operational needs of the proxy rather than constituting a data research pipeline. The project is actively maintained with a responsive issue tracker and regular releases.
The LLM identified 4 files worth highlighting for reuse:
Defines the Transformer interface with methods for transforming requests, responses, and streaming responses between different API formats (Claude, OpenAI Chat, OpenAI Responses, Gemini). The global registry allows adding new transformers without modifying core logic. The StreamContext type provides a thread-safe state machine for tracking streaming progress across multiple events. This pattern is reusable for any multi-format API proxy or middleware that needs to normalize heterogeneous protocols.
Implements a complete credential management system with status derivation (active, expiring, expired, invalid, cooldown), rate limit snapshots, and token pool statistics. Supports bulk import, automatic failure marking, and cooldown management. The design is self-contained and can be extracted for any application that needs to manage API credentials with health monitoring and rotation, such as multi-tenant API gateways or credential vaults.
Provides robust SSE (Server-Sent Events) parsing with configurable buffer sizes, handling edge cases like split events, missing [DONE] markers, and rapid endpoint switches. Extracts token usage from streaming responses and supports fallback estimation. The scanner-based design is reusable for any streaming proxy or SSE client that needs reliable event parsing and token accounting.
Implements thread-safe configuration management using sync.RWMutex and atomic snapshot copies. All getters return deep copies to prevent race conditions, and setters validate changes before persisting. The pattern is simple yet effective and can be reused in any Go application requiring concurrent config access with minimal overhead.