# Repository Briefing: lich0821/ccNexus
> Source: https://repoforai.com/repo/lich0821/ccNexus (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/lich0821/ccNexus
- **Category**: LLMs & Inference (大模型与推理微调)
- **Primary Language**: Go
- **License**: MIT
- **Engineering Health**: A (83/100 · Maintenance 26/35 · Adoption 17/25 · Releases 20/20 · License 20/20)
- **Latest Release**: v5.4.0 (2026-10-24) — https://github.com/lich0821/ccNexus/releases
- **Review Snapshot**: 2026-12-02
- **Deployment / Stack Signals**: Docker, Self-Hosted, API
- **Momentum**: 961 ★ total (+0 24h / +0 7d) · 131 forks
- **Topics**: `ai-coding`, `claude-code`, `claude-code-proxy`, `claude-code-router`
- **When to Use**: Best for: Developers and teams that want Claude Code or Codex CLI to use multiple upstreams through one self-hosted endpoint, with failover and centralized usage tracking. Skip if: One upstream already meets your needs, you need offline model execution, or you require exact provider-native behavior across all features without testing the conversion layer.

## Overview
```text
### Architecture & Core Mechanics
ccNexus is a Go HTTP gateway that sits between Claude Code or Codex CLI and upstream model APIs. Claude Code points to the gateway root; Codex CLI uses a provider base URL ending in /v1 and selects the responses or chat wire API. Each endpoint selects a request format converter. A configured endpoint model overrides the client’s model name; otherwise the original name is forwarded.

The source tree includes cmd/ and internal/. The module declares Go 1.24.0 with toolchain go1.24.3, and includes Wails v2.11.0 and modernc.org/sqlite. ccNexus offers a cross-platform desktop app and a headless HTTP server. WebDAV sync covers configuration and data. The gateway handles routing and API translation; model inference happens upstream.

### Key Capabilities & Differentiators
When an endpoint fails, ccNexus switches to the next configured endpoint. Its converters cover Claude, OpenAI Chat, OpenAI Responses, and Gemini. Operators can filter and clone endpoint entries, and clients can query /v1/models, which serves cached results by default and supports on-demand refresh when enabled.

The Codex Token Pool imports access_token and refresh_token pairs in batches, rotates credentials, refreshes after a 401, and isolates invalid credentials. It tracks requests, errors, and token usage per credential. In v5.4.0, proxy changes corrected forwarding of OpenAI image generation and editing requests and added support for multi-megabyte SSE events.

### Trade-offs & Limitations
Compared with connecting an OpenAI-compatible client directly to the OpenAI API, ccNexus adds protocol conversion, endpoint failover, and credential-level visibility, but also adds another service to configure and troubleshoot. Switching endpoints can help when one fails, but a converted request or a model-name override does not make providers interchangeable. Test the client features you rely on, notably streaming and any non-text requests, across each intended primary and fallback endpoint.

The MIT license permits self-hosting and commercial use subject to its notice requirements; upstream service terms still apply. A Token Pool puts multiple refresh credentials at the gateway, making credential and host access controls important. Before enabling WebDAV sync, verify what data is synchronized and who can access the destination.

### Hardware & Deployment Guide
Run a desktop release on Windows, macOS, or Linux, or use the headless HTTP server via Docker; container setup is covered in docs/README_DOCKER.md. The default port is 3000, overridable with -port or CCNEXUS_PORT. If Basic Auth is enabled without a configured password, startup generates one and prints it to the log. Keep the service on a trusted network or put it behind a reverse proxy with TLS and access controls, and restrict access to startup logs.

Self-hosting moves the gateway onto your infrastructure, not the models: requests still require a reachable upstream, and the gateway itself does not need model VRAM. Start sizing around concurrent streams and payload sizes, especially large SSE events. v5.3.0 added headless Basic Auth, endpoint cloning, and the cached models API; v5.4.0 focused on proxy reliability and the management UI.
```

## Key Capabilities
```text
- Endpoint failover: Switches to the next configured upstream when an endpoint fails.
- Protocol conversion: Claude, OpenAI Chat, OpenAI Responses, and Gemini converters; optional endpoint model override.
- Codex credentials: Batch import of access and refresh tokens, credential rotation, refresh after a 401, and isolation of invalid credentials.
- Usage tracking: Per-credential request, error, and token counts, plus dashboard views for today, yesterday, this week, and this month.
- Model discovery: Cached /v1/models endpoint with on-demand refresh when enabled.
- Proxy fixes in v5.4.0: Corrected OpenAI image generation and editing request forwarding and added support for multi-megabyte SSE events.
```

## Quick Start / Clone
```bash
{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "随便写，不重要",
    "ANTHROPIC_BASE_URL": "http://127.0.0.1:3000",
    "CLAUDE_CODE_MAX_OUTPUT_TOKENS": "64000", // 有些模型可能不支持 64k
  }
  // 其他配置
}
```
