# @afg473319/afrouter 中文文档

规范地址：https://npmcn.com/package/%40afg473319/afrouter/

版本：0\.5\.98
npm 元数据更新时间：2026-10-12T15:56:22.260Z
中文译文更新时间：2026-11-08T01:17:47.819Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40afg473319/afrouter
原文对照：https://npmcn.com/package/%40afg473319/afrouter/?lang=original
项目主页：https://github.com/AFG473319/AFRouter
源码仓库：https://github.com/AFG473319/AFRouter

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：53.3 MB，3297 个文件
- TypeScript 类型：未声明
- Node.js 要求：\>=18\.0\.0
- 运行依赖：6 个
- 首次发布：2026-09-13T12:00:20.080Z
- 最新版本发布：2026-10-12T15:56:21.930Z
- 近 30 天下载量：1940（2026-10-05 至 2026-11-03，npm 官方下载统计）
- 已发布版本数：23（近 12 个月 23 个）

## 中文简介

AFRouter CLI - 启动和管理 AFRouter 服务器

## 安装

```sh
npm install @afg473319/afrouter
```

也可以使用：`pnpm add @afg473319/afrouter`、`yarn add @afg473319/afrouter`、`bun add @afg473319/afrouter`

## README

# AFRouter — FREE AI 路由器和托肯保护器

**永不停止编码. 以RTK + 自动倒回FREE & 廉价AI模式保存20-40%的令牌.**

**连接所有AI代码工具(Claude Code, Cursor, Antigravity, Copilot, Codex, 双子座, OpenCode, Cline, OpenClaw...)到40+AI提供商和100+模型.**

> **AFRouter 软件** 保持个人叉 [9号路透社](https://github.com/decolua/9router)它运送更多供应商,并修复尚未上游的诺斯门户网站(Hermes CLI OAuth)、OrcaRouter、同时在供应商卡上进行模型测试,以及多模式的Grok Building集成——拥有自己的指挥权(`afrouter`)和单独的数据目录.

[![npm](https://img.shields.io/npm/v/afrouter.svg)](https://www.npmjs.com/package/afrouter) [![Downloads](https://img.shields.io/npm/dm/afrouter.svg)](https://www.npmjs.com/package/afrouter) [![License](https://img.shields.io/npm/l/afrouter.svg)](https://github.com/AFG473319/AFRouter/blob/master/LICENSE)

[上游9号路透](https://github.com/decolua/9router) 二. 支助 [AFRouter 重播](https://github.com/AFG473319/AFRouter)

* * *

## 为什么是AFRouter?

**停止浪费钱,代币和打出限制:**

-   \* 每月订阅配额到期
-   QQ 利率限制停止中编码
-   QQ 工具输出( git diff, grep, Is. ) 快速刻录符号
-   \* 昂贵的API(每个供应商每月20-50美元)

**AFRouter 解决了这个问题** (所有9路特的核心,加上叉子外加):

-   ✅ **RTK 托肯保护程序** - 自动压缩工具 结果, 保存 20- 40% 的令牌
-   ✅ **最大限度的订阅** - 曲目配额,在重置前使用每一分
-   ✅ **自动倒置** 免费、零停机
-   ✅ **多账户** - 每家供应商账户之间的轮旋
-   ✅ **通用** - 与OpenAI/Claude兼容的CLI合作
-   ✅ **叉外加数** - Nous Portal, OrcaRouter,多型格罗克建筑,同时进行模型测试

* * *

## QQ 快速启动

```bash
npm install -g @afg473319/afrouter
afrouter

# Or run directly with npx
npx @afg473319/afrouter
```

{\\fn黑体\\fs22\\bord1\\shad0\\3aHBE\\4aH00\\fscx67\\fscy66\\2cHFFFFFF\\3cH808080} `http://localhost:20128`

**和9路透一起跑吗?** 有——AFRouter将其数据保存在自己的目录中,因此它不会与股票9路特安装共享状态. 一次只在20128号端口运行其中之一,或以 `--port`。 。 。 .

**2\. 连接FREE供应商(不需要注册):**

盘子 提供商 连接 **基罗大赦国际** (自由克洛德无限)或 **打开代码自由** (无授权) 完成!

**3\. 将以下工具用于国家领导才能工具:**

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

就这样! 开始用FREE AI模型编码.

> **杜克吗?** AFRouter 目前只使用 npm —— 使用 [上游 9 Router 的 Docker 图像](https://hub.docker.com/r/decolua/9router) 如果你部署在一个容器.

* * *

## QQ CLI 选项

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

**盘子**数字 : `http://localhost:20128/dashboard`

* * *

## QQ 无头模式( 标语和 AI 代理)

无头模式使许多仪表板操作非互动性地暴露出来,但均等是 尚未完成。 见 `../CLI_AUDIT.md` 用于已知缺口和当前修复范围. 无头命令 : **已运行** 网关并绕过发射器 :

```bash
afrouter <domain> <action> [flags]
afrouter status
afrouter providers list
afrouter models list --filter claude
afrouter chat --model cc/claude-sonnet-5 --prompt "say hi"
echo "summarize: ..." | afrouter chat --model ag/gemini-3-flash
```

公约:

-   **JSON 默认退出** (方便代理人); `--human` 打印表格.
-   **错误转到 stderr** 有退出代码 : `0` 好,你别这样, `1` 错误, `2` 使用错误.
-   **目标网关**数字 : `--port/-p` (默认) `20128`,或 `AFROUTER_PORT`, (中文(简体) ), `--host/-H` (默认) `127.0.0.1`,或 `AFROUTER_HOST`) (中文(简体) ).
-   **认证**:自动通过本地的机器代号——不需要在同一台机器上登录.
-   **全文参考**数字 : `afrouter <domain> --help` (每个领域帮助是真理的来源).

| 域名 | 实例 |
| --- | --- |
| `status` | `afrouter status` 保健+版本 |
| `providers` | `list`, (中文(简体) ), `test <id>`, (中文(简体) ), `test-batch --mode all`, (中文(简体) ), `enable/disable <id>`, (中文(简体) ), `add --provider openai --name Main --api-key sk-...` |
| `nodes` | `list`, (中文(简体) ), `add --name X --prefix x --base-url https://... --type openai-compatible` |
| `keys` | `list`, (中文(简体) ), `create --name ci`, (中文(简体) ), `delete <id>` |
| `combos` | `list`, (中文(简体) ), `create --name route --models cc/claude-sonnet-5,cx/gpt-5.2`, (中文(简体) ), `presets --source claude` |
| `models` | `list --filter <q>`, (中文(简体) ), `ping --model <m>`, (中文(简体) ), `alias-set --alias a --model <m>`, (中文(简体) ), `pricing` |
| `usage` | `stats --period 7d`, (中文(简体) ), `requests --provider cline --page-size 50`, (中文(简体) ), `connection <id>` |
| `settings` | `get`, (中文(简体) ), `set --key rtkEnabled --value false`, (中文(简体) ), `db-export --file backup.json`, (中文(简体) ), `shutdown` |
| `network` | `endpoint`, (中文(简体) ), `tunnel-on/tunnel-off`, (中文(简体) ), `pools`, (中文(简体) ), `pxpipe-stats`, (中文(简体) ), `tailscale-enable` |
| `tools` | `statuses`, (中文(简体) ), `setup --tool kilo --model cc/claude-sonnet-5`, (中文(简体) ), `reset --tool cline` |
| `media` | `voices --provider edge-tts --lang en` |
| `chat` | `chat --model <m> --prompt <text>` (或有管状铁屑; `--system`, (中文(简体) ), `--max-tokens`, (中文(简体) ), `--temperature`(中文(简体) ) |
| □ QQ 连接到远程 AFRouter |  |

已经在另一台机器上运行了9路透(比如在你的局域网上运行团队服务器)? 将这个机器的 CLI 工具对准它——没有开始本地服务器:

```bash
npx @afg473319/afrouter connect http://<server-host>:20128                       # pick tools interactively
npx @afg473319/afrouter connect http://<server-host>:20128 --tools claude,codex  # or choose up front
npx @afg473319/afrouter connect --reset --tools claude,codex                     # undo
```

它使用仪表板密码( 隐藏快取) 登录、 重复使用或创建命名的 API 密钥 `cli-<hostname>`,并写入每个工具的配置(备份一次原作) `*.bak-afrouter`) (中文(简体) ).

获得支持: `claude`, (中文(简体) ), `codex`, (中文(简体) ), `opencode`, (中文(简体) ), `droid`, (中文(简体) ), `crush`, (中文(简体) ), `kilo`, (中文(简体) ), `cline`,或 `all`。其他选项: `--model`, (中文(简体) ), `--opus/--sonnet/--haiku/--fable`, (中文(简体) ), `--api-key`, (中文(简体) ), `--key-name`, (中文(简体) ), `--print-env`。见 `afrouter connect --help`。 。 。 .

> 过平地 `http://` 密码和 API 密钥是不加密发送的 —— 使用一个可信赖的局域网/ VPN 或将 HTTPS 放在前面 。 API密钥被存储在每个工具的配置文件中.

* * *

## 支持的 CLI 工具

Claude-Code • OpenClaw • Codex • OpenCode • Cursor • Antigravity • Cline • 继续 机器人 • Roo • 副驾驶 • Kilo 代码 • 双子座 CLI • Quen 代码 • iFlow • Crusher • Aider

任何支持OpenAI/Claude-compatiable API作品的工具.

* * *

## 数据位置

AFRouter将其状态与9路特分开:

-   **macOS/ 在线**数字 : `~/.afrouter/db/data.sqlite`
-   **窗口**数字 : `%APPDATA%/afrouter/db/data.sqlite`
-   覆盖到 `DATA_DIR` 环境变量.

* * *

## 页:1

-   **AFRouter 回波器**数字 : [https://github.com/AFG473319/AF鲁特](https://github.com/AFG473319/AFRouter)
-   **上游 9 Router 文件**数字 : [https://github.com/decolua/9router (英语)](https://github.com/decolua/9router)
-   **网站**数字 : [https://9router.com (英语)](https://9router.com/)

* * *

## 承认

-   **[9号路透社](https://github.com/decolua/9router)** - 这叉子在上游
-   **[CLIProxyAPI (英语)](https://github.com/router-for-me/CLIProxyAPI)** - 原实施

## 许可证

麻省理工学院许可证——见 [自由主义](https://npmcn.com/package/%40afg473319/afrouter/LICENSE) 详细情况.

## 常见问题

### @afg473319/afrouter 是什么？

AFRouter CLI - 启动和管理 AFRouter 服务器

### 如何安装 @afg473319/afrouter？

在项目目录运行 npm install @afg473319/afrouter，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 afrouter，可以用 npx afrouter 直接运行。

### @afg473319/afrouter 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/afg473319\_\_afrouter 是否存在。

### @afg473319/afrouter 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=18\.0\.0。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @afg473319/afrouter 可以商用吗？

@afg473319/afrouter 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @afg473319/afrouter 的下载量有多少？

根据 npm 官方下载统计，@afg473319/afrouter 在 2026/10/05 – 2026/11/03 这 30 天内被下载 1,940 次，日均约 65 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @afg473319/afrouter 还在维护吗？

最新版本 0\.5\.98 发布于 2026/10/12（26 天前）；至今共发布 23 个版本，其中过去 12 个月发布了 23 个；首次发布于 2026/09/13。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

