No description
  • Go 55.6%
  • JavaScript 43.6%
  • Shell 0.2%
  • SCSS 0.2%
  • Lua 0.2%
  • Other 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nex 5e9babb179
Some checks failed
neorouter docker image / build-and-push (push) Failing after 1h21m36s
deploy(docker-compose): update
2026-06-11 00:50:44 +08:00
.agents/skills/beads bd init: initialize beads issue tracking 2026-06-02 22:30:41 +08:00
.beads chore: ignore beads interaction log 2026-06-03 04:11:13 +08:00
.claude bd init: initialize beads issue tracking 2026-06-02 22:30:41 +08:00
.codex bd init: initialize beads issue tracking 2026-06-02 22:30:41 +08:00
.compound-engineering feat(branding): rename product to NeoRouter 2026-06-08 01:36:59 +08:00
.github build: optimize docker image build 2026-06-06 15:02:34 +08:00
bin first commit 2025-06-09 16:10:03 +08:00
cli feat(branding): rename product to NeoRouter 2026-06-08 01:36:59 +08:00
common Merge remote-tracking branch 'upstream/main' 2026-06-10 21:12:29 +08:00
controller feat: hide About/Notice nav buttons when content not configured 2026-06-11 00:08:41 +08:00
cron first commit 2025-06-09 16:10:03 +08:00
docs feat(home): redesign public homepage (draft) 2026-06-08 07:53:33 +08:00
hack/scripts first commit 2025-06-09 16:10:03 +08:00
i18n feat(branding): rename product to NeoRouter 2026-06-08 01:36:59 +08:00
mcp first commit 2025-06-09 16:10:03 +08:00
metrics first commit 2025-06-09 16:10:03 +08:00
middleware feat(branding): rename product to NeoRouter 2026-06-08 01:36:59 +08:00
model Merge remote-tracking branch 'upstream/main' 2026-06-10 21:12:29 +08:00
payment fix(test): stabilize backend test setup 2026-06-05 11:27:52 +08:00
providers Merge remote-tracking branch 'upstream/main' 2026-06-10 21:12:29 +08:00
relay Merge remote-tracking branch 'upstream/main' 2026-06-10 21:12:29 +08:00
router feat(branding): add admin theme customization 2026-06-07 00:43:36 +08:00
safty first commit 2025-06-09 16:10:03 +08:00
types fix: openaiResponse arguments 2026-06-06 23:57:47 +08:00
web feat: hide About/Notice nav buttons when content not configured 2026-06-11 00:08:41 +08:00
.air.toml setup: enable backend hot reload for dev 2026-06-06 01:20:03 +08:00
.cursorignore first commit 2025-06-09 16:10:03 +08:00
.dockerignore build: optimize docker image build 2026-06-06 15:02:34 +08:00
.editorconfig first commit 2025-06-09 16:10:03 +08:00
.env.example chore: switch docker compose from redis to valkey 2026-06-09 19:43:10 +08:00
.gitignore fix(test): stabilize backend test setup 2026-06-05 11:27:52 +08:00
.golangci.yml first commit 2025-06-09 16:10:03 +08:00
.roborev.toml setup: configure roborev reviews 2026-06-02 23:56:13 +08:00
.sembleignore setup(aiad): add Semble local semantic search guidance 2026-06-02 17:43:43 +08:00
AGENTS.md docs: document mise task preference 2026-06-05 12:26:02 +08:00
CLAUDE.md docs(beads): align review follow-up guidance 2026-06-07 15:31:29 +08:00
docker-compose.yml deploy(docker-compose): update 2026-06-11 00:50:44 +08:00
Dockerfile build: use domestic docker build mirrors 2026-06-07 00:17:43 +08:00
Dockerfile-action chore: rename distribution artifacts 2026-06-06 01:11:37 +08:00
go.mod fix: 2025-12-24 23:11:49 +08:00
go.sum fix: 2025-12-24 23:11:49 +08:00
init.sh deploy(docker-compose): update 2026-06-09 18:42:24 +08:00
LICENSE first commit 2025-06-09 16:10:03 +08:00
main.go feat(branding): rename product to NeoRouter 2026-06-08 01:36:59 +08:00
makefile chore: rename distribution artifacts 2026-06-06 01:11:37 +08:00
mise.toml build: use domestic docker build mirrors 2026-06-07 00:17:43 +08:00
neorouter.service chore: rename distribution artifacts 2026-06-06 01:11:37 +08:00
pull_request_template.md first commit 2025-06-09 16:10:03 +08:00
README.en.md feat(branding): rename product to NeoRouter 2026-06-08 01:36:59 +08:00
README.md feat(branding): rename product to NeoRouter 2026-06-08 01:36:59 +08:00
Taskfile.yml chore: rename distribution artifacts 2026-06-06 01:11:37 +08:00
VERSION first commit 2025-06-09 16:10:03 +08:00

中文 | English

image__3_-removebg-preview.png

This project is a secondary development based on done-hub

Telegram Group

AI Wave Community · (Offering public API and AI bots in-group)

📚 View Original Project Documentation


About

NeoRouter is a fork / secondary development of one-hub. It stays fully database- and image-compatible with the upstream while adding substantial improvements around reverse-proxying modern clients (Claude Code / Gemini CLI / Codex / Antigravity, etc.), fine-grained channel control, an invitation & rebate system, analytics, and multi-instance deployment stability.

The database schema is compatible with the upstream — existing one-hub users can migrate by simply pulling the nexzhu/neorouter image.


Differences from Upstream (Latest one-hub Image)

The additions are grouped into ten categories: new providers, native-route compatibility, channel-level enhancements, invitation & rebates, batch management, analytics & logging, auth, UI/UX, bug fixes, and performance / reliability.

1. New Provider / Channel Types

Channel Description
Codex (reverse proxy) New provider that reverse-proxies Codex CLI / Codex API as a standard upstream channel.
Claude Code (reverse proxy) New ClaudeCode provider — terminates the Claude Code client (including the native /v1/messages protocol).
Gemini CLI (reverse proxy) New GeminiCli channel (type 57) for transparently relaying native Gemini CLI requests.
Antigravity (reverse proxy) New Antigravity channel (type 60) targeting alternative endpoints such as daily-cloudcode-pa.googleapis.com.
Vertex AI Express New Vertex AI Express channel (type 61) — a lighter-weight Vertex AI integration.

2. Native-Route Compatibility Across Channels

Upstream providers can normally only be called via their own protocol. NeoRouter bridges different native protocols so that a single channel can simultaneously serve multiple client types:

  • Custom channels can expose the native Claude route (/v1/messages) — ready to plug into Claude Code.
  • Vertex AI channels can expose the native Gemini route (/gemini/*) — ready to plug into Gemini CLI.
  • Vertex AI channels can expose the native Claude route — ready to plug into Claude Code.
  • Vertex AI channels support multiple regions; one region is randomly chosen per request, giving free per-request load balancing.
  • Google Gemini channels support native video generation (Veo series) via the /gemini route.
  • gemini-2.0-flash-preview-image-generation is supported for text-to-image / image-to-image, and is also compatible with the OpenAI Chat Completions interface.

3. Channel-Level Enhancements

  • Request parameter pass-through / filtering
    • Native /gemini image-generation requests support extra-parameter pass-through.
    • Claude channels (both OpenAI format and native format) support extra-parameter pass-through.
    • remove_params supports nested fields, e.g. "remove_params": ["generationConfig.thinkingConfig"].
  • Model name mapping
    • Configurable case-insensitive model name matching.
    • Configurable unified request / response model name mapping.
    • Model redirection supports auto-mapping the key to model configuration.
  • BaseURL templating
    • Channel BaseURL supports model-variable substitution for dynamic upstream URLs based on the request model.
  • Per-channel toggles
    • Bill empty responses toggle (default: billed).
    • Built-in chat feature toggle.
    • Per-channel allow_extra_body to allow extra request body fields.

4. Invitation & Rebate System (new)

  • Invite Code module
    • Manual / automatic code generation, batch create (up to 100 at a time), and batch delete.
    • Per-code max uses, start / expiry timestamps, and enable / disable flag.
    • Tracks usage and status statistics.
  • Recharge rebate for inviters
    • When an invitee recharges, the inviter can be rewarded:
      • Fixed amount or percentage types.
    • Coexists with the original "invite bonus quota" feature, forming a full referral incentive loop.
  • Decouple third-party login from invite-code authorization
    • Fixes the coupling that forced invite codes on third-party logins; the open-registration policy can now be configured independently.

5. Batch Management

  • Batch delete channels
  • Batch add models to multiple channels at once
  • Batch attach user groups to multiple channels
  • Batch operations are also available for invite codes, system logs, etc.

6. Analytics & Logging

  • Live RPM / TPM / CPM metrics in the analytics dashboard.
  • Recharge statistics now supports time-period filters (all / year / month / week / day).
  • The system log (system_log) supports conditional queries and pagination.
  • Logs can be exported as CSV for offline analysis and reconciliation.
  • Removed the meaningless "original price" styling from log views.

7. Auth & Login

  • LinuxDo OAuth login with Trust Levelbased access control (Basic / Member / Regular / Leader).
  • Third-party login flow decoupled from invite-code authorization.

8. UI / UX

  • System Information module rebuilt — denser, more readable.
  • Dark mode follows the OS automatically.
  • Improved email validation rules.
  • Many backend UI polish items (table sorting, icons, forms, hints, etc.).
  • Better disabled-channel email notification logic to avoid duplicates / false positives.

9. Bug Fixes

Covers billing, caching, statistics, payments, security — the critical paths:

  • Fixed broken user-facing API endpoints.
  • Fixed missing fields in invitation records.
  • Fixed hardcoded timezone affecting statistical data (now respects TZ / time.Local).
  • Fixed channels not reloading into memory after updates.
  • Fixed payment-callback failures in multi-instance deployments.
  • Fixed floating-point token math for Zhipu GLM models.
  • Fixed CDN-caching on API routes that led to privilege escalation.
  • Fixed inconsistent time-type formatting across MySQL versions.
  • Fixed multiple user-quota cache / DB inconsistencies that caused billing anomalies.
  • Fixed missing cached_tokens field in the Responses API.
  • Fixed parsing of Anthropic-style cache tokens in OpenAI-compatible usage.
  • Fixed context propagation in the Gemini CLI provider during token refresh / error handling.

10. Performance & Reliability

  • Vertex AI auth caching — significantly fewer redundant auth round-trips.
  • Key cache pre-warming — higher cache hit rate at startup.
  • Channel cache reloads on update — no restart required.
  • Improved retry / cooldown logic for more stable failover.
  • Cleaner google_search responses for /gemini requests.
  • Unified and trimmed log formatting across the codebase for faster triage.
  • Alipay payment pipeline refactor; Epay and related fixes.

Deployment

Follow the upstream deployment guide and swap the image for nexzhu/neorouter.

Database-compatible — existing one-hub deployments can migrate by simply pulling this image.

Quick start:

docker pull nexzhu/neorouter:latest

docker run -d \
  --name neorouter \
  -p 3000:3000 \
  -e TZ=Asia/Shanghai \
  -v $(pwd)/data:/data \
  nexzhu/neorouter:latest

Full deployment, configuration, billing, and model-pricing docs live in the upstream documentation: https://one-hub-doc.vercel.app/


Feedback & Community

  • Telegram: AI Wave Community (public API and AI bots available in-group)
  • Issues / PRs are welcome on this repository.

Acknowledgments

  • This program builds on the following open-source project:
    • done-hub — the foundation of this project.
    • one-hub — done-hub's upstream.

Thanks to the authors and contributors of the upstream project.