npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zouwei/aihub-cli

v0.1.0

Published

Local AI channel pass-through proxy CLI.

Readme

目的

提供一个本地 aihub-cli 代理服务。客户端请求本地 /v1/* 接口后,服务先做本地鉴权,然后通过火山 Ark SDK 调用配置的火山地址或火山代理地址。

火山应用层加密需要依赖 Ark SDK,所以服务默认给 SDK 请求追加 x-is-encrypted: true。服务不做模型映射或字段转换,/v1/chat/completions/v1/completions/v1/responses 的请求 JSON body 会作为 SDK 参数传入。

使用方法

全局命令方式

推荐使用 config.yaml,避免启动参数过长:

api_key: sk-local
ark_base_url: http://101.96.224.38:3000/v1
ark_api_key: sk-ark
host: 127.0.0.1
port: 8080
encrypted: true

启动:

npm install -g @zouwei/aihub-cli
aihub-cli start --config config.yaml

也可以继续使用命令行参数:

npm install -g @zouwei/aihub-cli
aihub-cli start --port 8080 --api-key sk-local --ark-base-url http://101.96.224.38:3000/v1 --ark-api-key sk-ark

全局命令安装时会自动创建包内 Python 虚拟环境,并安装 requirements.txt 中的依赖,包括火山 Ark SDK 和 PyYAML。

如果只想安装 npm 命令、不自动安装 Python 依赖,可以使用:

AIHUB_SKIP_PYTHON_INSTALL=1 npm install -g @zouwei/aihub-cli

Docker 方式

docker build -t aihub-cli .
docker run -p 8080:8080 \
  -v $(pwd)/config.yaml:/app/config.yaml \
  -e AIHUB_CONFIG=/app/config.yaml \
  aihub-cli

Docker 也可以继续使用环境变量:

docker run -p 8080:8080 \
  -e AIHUB_API_KEY=sk-local \
  -e ARK_BASE_URL=http://101.96.224.38:3000/v1 \
  -e ARK_API_KEY=sk-ark \
  aihub-cli

客户端配置

客户端把 base_url 指向本地服务地址,例如:

http://localhost:8080/v1

客户端的 api_key 使用启动 aihub-cli 时配置的本地 api_key

配置项

  • AIHUB_API_KEY:本地服务鉴权密钥。
  • AIHUB_CONFIG:可选,config.yaml 配置文件路径。
  • ARK_BASE_URL:火山 Ark 或火山代理地址。
  • ARK_API_KEY:火山 Ark API Key。
  • ARK_ENCRYPTED:是否追加 x-is-encrypted=true,默认 true
  • HOST:监听地址,默认 127.0.0.1,Docker 中默认 0.0.0.0
  • PORT:监听端口,默认 8080

配置优先级:命令行参数 > config.yaml > 环境变量 > 默认值。

aihub-cli 命令原理

aihub-cli 命令通过 npm 的 bin 机制提供。

package.json 中配置:

{
  "bin": {
    "aihub-cli": "bin/aihub-cli.js"
  }
}

执行全局安装后:

npm install -g .

npm 会在全局 bin 目录中生成 aihub-cli 命令,并指向项目里的 bin/aihub-cli.js。安装过程还会执行 postinstall 脚本,在包目录中创建 .venv 并安装 Python 依赖。

bin/aihub-cli.js 是一个 Node 启动器,它不会直接实现代理逻辑,而是优先使用包内 .venv 的 Python,把参数继续交给 Python 模块:

python3 -m aihub_cli start --config config.yaml

完整启动链路:

aihub-cli
  -> bin/aihub-cli.js
  -> python3 -m aihub_cli
  -> aihub_cli/__main__.py
  -> aihub_cli/cli.py
  -> 读取 config.yaml
  -> 启动本地 HTTP 服务

这样用户可以用简单的全局命令启动服务,同时核心逻辑仍然保留在 Python 中,方便依赖火山 Ark SDK。

发布到 npm 远程

确认包名和版本:

{
  "name": "@zouwei/aihub-cli",
  "version": "0.1.0"
}

首次发布前登录 npm:

npm login

检查将要发布的文件:

npm pack --dry-run

发布 scoped public 包:

npm publish --access public

发布成功后,用户就可以通过一条命令安装:

npm install -g @zouwei/aihub-cli

后续每次发布新版本,需要先更新 package.json 中的 version,例如:

npm version patch
npm publish --access public