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

ai-api-gateway

v0.1.1

Published

AI 大模型 API 聚合网关:把多个上游 AI API(OpenAI/Claude/Gemini/兼容接口)聚合为一个 OpenAI 兼容出口,支持模型可用性探测、虚拟分组、用量统计与价格同步。

Readme

AI API 聚合网关 (ai-api-gateway)

把多个上游 AI 大模型 API(OpenAI、Anthropic Claude、Google Gemini、DeepSeek/通义/Kimi/智谱等国内模型、以及任意 OpenAI 兼容接口)聚合为一个统一的 OpenAI 兼容 API 出口

功能

  • 统一入口:POST /v1/chat/completions(支持 SSE 流式)、GET /v1/models
  • 协议适配:OpenAI / Anthropic / Gemini 请求与响应自动互转
  • 模型可用性测试:手动探测 + 定时探测,记录延迟与失败原因
  • 虚拟分组:任意勾选多个上游模型组成一组,策略支持轮询均衡 / 故障转移,自动跳过不可用模型
  • 用量统计:每次请求记录 token 与费用,按天/按模型图表展示
  • 价格管理:Gemini 价格自动同步,其余上游支持手动设置(USD / 1M tokens)
  • Web 管理后台:上游管理、模型测试、分组、用量、价格、聊天测试

快速开始

npm install -g ai-api-gateway
ai-api-gateway        # 或 npx ai-api-gateway

启动后浏览器打开 http://127.0.0.1:3000

  1. 「上游管理」→ 添加上游(国内模型/中转选 OpenAI 兼容 类型)→ 同步模型
  2. 「模型测试」→ 探测全部模型确认可用性
  3. 「分组」→ 勾选模型建组,得到虚拟模型名
  4. 用任意 OpenAI 客户端调用 http://127.0.0.1:3000/v1/chat/completionsmodel 填虚拟模型名(或 上游ID:模型ID 直连)

环境变量

| 变量 | 默认 | 说明 | |------|------|------| | PORT | 3000 | 服务端口 | | ADMIN_TOKEN | 空 | 设置后管理 API 需要 Bearer 鉴权 | | PROBE_INTERVAL_MINUTES | 15 | 定时探测间隔(0 关闭) | | PRICE_SYNC_INTERVAL_MINUTES | 60 | 价格同步间隔(0 关闭) | | DATA_DIR | 安装目录下 data | SQLite 数据目录 |

开发

npm install
npm run dev          # 后端 :3000
cd web && npm install && npm run dev   # 前端 :5173(可选)
cd web && npm run build                # 构建前端到 server/public