How lich0821/ccnexus works
ccNexus is a cross-platform Claude Code/Codex proxy with desktop and headless-server entry points. Its main workflow accepts client API requests, selects an endpoint, transforms formats as needed, and forwards requests; configuration, credentials, persistence, and usage statistics support that flow. Desktop and server interfaces expose endpoint and statistics management, while README-documented capabilities include Codex token pools, model listing, Basic Auth, and WebDAV sync. Some runtime wiring is not shown in the excerpts, so uncertain links are omitted or marked unverified.
Main entry points: proxy.go Proxy server · sqlite.go SQLite state · proxy_request.go Request routing · app.go Desktop bridge
Components 17
Proxy runtime
- Proxy server
internal/proxy/proxy.go - Request routing
internal/proxy/proxy_request.go - Format conversion
internal/transformer/convert - Token estimation
internal/tokencount/estimator.go - Headless entry
cmd/server/main.go
Endpoint domain
- Endpoint management
internal/service/endpoint.go - App configuration
internal/config/config.go - Codex token pool
internal/storage/interface.go - Usage statistics
internal/proxy/stats.go
State and sync
- SQLite state
internal/storage/sqlite.go - WebDAV sync
internal/webdav/sync.go
Desktop app
- Desktop bridge
cmd/desktop/app.go - Desktop interface
cmd/desktop/frontend/src/main.js
Server console
- Admin API
cmd/server/webui/api/handler.go - Server console
cmd/server/webui/ui/js/main.js
Other components
- API client
- Provider endpoints
Connections 18
- API client → Proxy server: sends requests
README.md - Proxy server → Request routing: dispatches requests
- Request routing → Provider endpoints: forwards requests
- Request routing → Format conversion: converts formats
internal/proxy/proxy_request.go - Proxy server → Token estimation: estimates tokens
- Endpoint management → Proxy server: updates configuration
internal/service/endpoint.go - Endpoint management → SQLite state: persists configuration
internal/service/endpoint.go - Proxy server → Usage statistics: records usage
- Codex token pool → SQLite state: stores credentials
- WebDAV sync → SQLite state: syncs state
- Headless entry → Proxy server: starts service
cmd/server/main.go - Headless entry → SQLite state: opens storage
cmd/server/main.go - Admin API → Proxy server: updates proxy config
cmd/server/webui/api/handler.go - Server console → Admin API: calls admin API
- Desktop interface → Desktop bridge: invokes bindings
- Desktop bridge → Proxy server: starts proxy
cmd/desktop/app.go - Desktop bridge → Endpoint management: manages endpoints
- Desktop interface → Usage statistics: shows statistics