Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
4d81f47
feat: enable npm global install from source
May 9, 2026
bcc969d
Merge pull request #1 from diepxuan/feat/npm-global-install
caothu159 May 9, 2026
3bf78dc
fix: remove broken .gitmodules and exclude src/mitm/dev from npm pack…
caothu159 May 9, 2026
215bb27
Create build-and-deploy.yml
caothu159 May 9, 2026
01cf836
Remove npm ci from build-and-deploy workflow
caothu159 May 9, 2026
23be611
Update build-and-deploy.yml
caothu159 May 9, 2026
e22a7b5
chore: update package name to @diepxuan/9router for GitHub Packages"
caothu159 May 9, 2026
801cce1
Update GitHub Actions workflow for build and deploy
caothu159 May 9, 2026
ef685f8
Update package name and modify package.json structure
caothu159 May 9, 2026
52902ce
ci: update build-and-deploy workflow - build app/ separately and publish
caothu159 May 9, 2026
2266678
Update build-and-deploy.yml
caothu159 May 9, 2026
0d91e93
Update build-and-deploy.yml
caothu159 May 9, 2026
d31f572
Update build-and-deploy.yml
caothu159 May 9, 2026
55cd94d
Update build-and-deploy.yml
caothu159 May 9, 2026
cdc407d
Update build-and-deploy.yml
caothu159 May 9, 2026
41b554b
Update build-and-deploy.yml
caothu159 May 9, 2026
6b62044
Update .npmignore
caothu159 May 9, 2026
86045f0
Update build-and-deploy.yml
caothu159 May 9, 2026
7607cfd
Update build-and-deploy.yml
caothu159 May 9, 2026
452f1da
Update build-and-deploy.yml
caothu159 May 9, 2026
e0df50f
Update build-and-deploy.yml
caothu159 May 9, 2026
26cdb3f
Create diepxuan.config.mjs
caothu159 May 9, 2026
550ce2e
Update build-and-deploy.yml
caothu159 May 9, 2026
bd470be
Update build-and-deploy.yml
caothu159 May 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
86 changes: 86 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build and Deploy

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref || github.ref_name }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://npm.pkg.github.com'

- name: Download latest CLI
run: |
mkdir -p temp-cli
cd temp-cli
npm init -y
npm install 9router@latest
cd ..
rm -rf cli/
mv temp-cli/node_modules/9router ./cli
rm -rf temp-cli

- name: Install dependencies
run: npm install

- name: Build
run: |
mv next.config.mjs base.config.mjs
npm run build

- name: Patch CLI
working-directory: cli
run: |
npm pkg set name="@diepxuan/9router"
npm pkg delete scripts.prepublishOnly
cat package.json
tree -L 2 .

- name: Push changes to GitHub
run: |
git add cli/
git commit -m "${GIT_COMMITTER_MESSAGE:-'Auto-commit update 9router cli'}" || true
if ! git push; then
git stash
git pull --rebase
git stash pop
git push || true
fi
env:
REPOSITORY: ${{ github.repository }}
GIT_COMMITTER_MESSAGE: ${{ github.event.head_commit.message }}
GIT_AUTHOR_NAME: Tran Ngoc Duc
GIT_AUTHOR_EMAIL: ductn@diepxuan.com
GIT_COMMITTER_NAME: Tran Ngoc Duc
GIT_COMMITTER_EMAIL: ductn@diepxuan.com

- name: Bump version
working-directory: cli
run: |
TIMESTAMP=$(date +%s)
npm version patch --no-git-tag-version
npm version prerelease --preid=patch.$TIMESTAMP --no-git-tag-version

- name: Publish to GitHub Packages
working-directory: cli
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

4 changes: 2 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ data/
**/db.json

# Development
src/
src/mitm/dev/
docs/
test/
agents/
Expand All @@ -13,6 +13,7 @@ worker/
shared-sse/
copilot-api/
CLIProxyAPI/
cli/

# Config files
*.md
Expand All @@ -28,4 +29,3 @@ tsconfig.json
# Build artifacts that shouldn't be published
.next/cache/
.next/standalone/data/

42 changes: 42 additions & 0 deletions cli/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
MIT License

Copyright (c) 2026 9Router Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.





















112 changes: 112 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# 9Router - FREE AI Router & Token Saver

**Never stop coding. Save 20-40% tokens with RTK + auto-fallback to FREE & cheap AI models.**

**Connect All AI Code Tools (Claude Code, Cursor, Antigravity, Copilot, Codex, Gemini, OpenCode, Cline, OpenClaw...) to 40+ AI Providers & 100+ Models.**

[![npm](https://img.shields.io/npm/v/9router.svg)](https://www.npmjs.com/package/9router)
[![Downloads](https://img.shields.io/npm/dm/9router.svg)](https://www.npmjs.com/package/9router)
[![License](https://img.shields.io/npm/l/9router.svg)](https://github.com/decolua/9router/blob/main/LICENSE)

<a href="https://trendshift.io/repositories/22628" target="_blank"><img src="https://trendshift.io/api/badge/repositories/22628" alt="decolua%2F9router | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>

[🌐 Website](https://9router.com) • [📖 Full Docs](https://github.com/decolua/9router)

---

## 🤔 Why 9Router?

**Stop wasting money, tokens and hitting limits:**

- ❌ Subscription quota expires unused every month
- ❌ Rate limits stop you mid-coding
- ❌ Tool outputs (git diff, grep, ls...) burn tokens fast
- ❌ Expensive APIs ($20-50/month per provider)

**9Router solves this:**

- ✅ **RTK Token Saver** - Auto-compress tool_result, save 20-40% tokens
- ✅ **Maximize subscriptions** - Track quota, use every bit before reset
- ✅ **Auto fallback** - Subscription → Cheap → Free, zero downtime
- ✅ **Multi-account** - Round-robin between accounts per provider
- ✅ **Universal** - Works with any OpenAI/Claude-compatible CLI

---

## ⚡ Quick Start

**1. Install & run:**

```bash
npm install -g 9router
9router

# Or run directly with npx
npx 9router
```

🎉 Dashboard opens at `http://localhost:20128`

**2. Connect a FREE provider (no signup needed):**

Dashboard → Providers → Connect **Kiro AI** (free Claude unlimited) or **OpenCode Free** (no auth) → Done!

**3. Use in your CLI tool:**

```
Claude Code/Codex/OpenClaw/Cursor/Cline Settings:
Endpoint: http://localhost:20128/v1
API Key: [copy from dashboard]
Model: kr/claude-sonnet-4.5
```

That's it! Start coding with FREE AI models.

---

## 🚀 CLI Options

```bash
9router # Start with default settings
9router --port 8080 # Custom port
9router --no-browser # Don't open browser
9router --skip-update # Skip auto-update check
9router --help # Show all options
```

**Dashboard**: `http://localhost:20128/dashboard`

---

## 🛠️ Supported CLI Tools

Claude-Code • OpenClaw • Codex • OpenCode • Cursor • Antigravity • Cline • Continue • Droid • Roo • Copilot • Kilo Code • Gemini CLI • Qwen Code • iFlow • Crush • Crusher • Aider

Any tool supporting OpenAI/Claude-compatible API works.

---

## 💾 Data Location

- **macOS/Linux**: `~/.9router/db.json`
- **Windows**: `%APPDATA%/9router/db.json`

---

## 📚 Documentation

Full docs, advanced setup, video tutorials & development guide:

- **GitHub**: https://github.com/decolua/9router
- **Full README**: https://github.com/decolua/9router/blob/main/app/README.md
- **Website**: https://9router.com

---

## 🙏 Acknowledgments

- **[CLIProxyAPI](https://github.com/router-for-me/CLIProxyAPI)** - Original Go implementation

## 📄 License

MIT License - see [LICENSE](LICENSE) for details.
1 change: 1 addition & 0 deletions cli/app/.next/BUILD_ID
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
g6K-sXverqaFK0NMbiAzn
Loading