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

kiro-bridge

v1.2.1

Published

Streaming proxy bridge for Kiro API with web UI

Downloads

288

Readme

🌉 Kiro Bridge

具有智能账户管理的 Kiro API 流式代理桥

npm version Node.js Version License GitHub Stars PRs Welcome

English | 简体中文


✨ 特性

  • 🚀 零配置启动 - 无需凭证即可启动,通过 API 添加
  • 🔄 自动令牌刷新 - 支持 AWS SSO OIDC 的无缝令牌管理
  • 🎯 智能速率限制 - 令牌桶算法防止账户封禁
  • 📊 Web 管理界面 - 基于 React 的监控和管理仪表板
  • 🔌 多协议支持 - 兼容 Anthropic 和 OpenAI API
  • 🐳 Docker 就绪 - 使用 Docker/Docker Compose 一键部署
  • 💾 数据库支持 - SQLite 存储凭证管理
  • 🌊 流式支持 - 完整的 SSE 流式传输和重试逻辑
  • 📈 健康监控 - 自动健康检查和故障转移
  • 🔐 默认安全 - 凭证加密和安全存储

📦 安装

快速开始 (npx)

npx kiro-bridge start

全局安装

npm install -g kiro-bridge
# 或
pnpm add -g kiro-bridge

Docker

docker run -p 3000:3000 -v ~/.kiro:/root/.kiro ghcr.io/xniec/kiro-bridge:latest

🚀 快速开始

1. 启动服务器

kiro-bridge start

服务器将在 http://localhost:3000 启动,包含:

  • 🎨 管理界面: http://localhost:3000
  • 🔌 API 端点: http://localhost:3000/api
  • ❤️ 健康检查: http://localhost:3000/api/system/health

2. 添加凭证

上传凭证文件:

curl -X POST http://localhost:3000/api/credentials/upload \
  -F "file=@/path/to/credential.json"

或扫描目录:

curl -X POST http://localhost:3000/api/credentials/scan \
  -H "Content-Type: application/json" \
  -d '{"directory": "/path/to/credentials"}'

3. 开始使用

curl -X POST http://localhost:3000/v1/messages \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-5-sonnet-20241022",
    "messages": [{"role": "user", "content": "你好!"}],
    "max_tokens": 1024
  }'

📖 文档

配置

通过环境变量配置:

# 服务器
PORT=3000
HOST=0.0.0.0

# 速率限制
RATE_LIMIT_ENABLED=true
RATE_LIMIT_PER_ACCOUNT_RPM=60
RATE_LIMIT_GLOBAL_RPM=120

# 历史管理
HISTORY_MAX_MESSAGES=30
HISTORY_MAX_CHARACTERS=150000

API 端点

凭证管理

  • POST /api/credentials/upload - 上传凭证文件
  • POST /api/credentials/json - 从 JSON 添加凭证
  • POST /api/credentials/scan - 扫描目录获取凭证
  • GET /api/credentials - 列出所有凭证
  • DELETE /api/credentials/:id - 删除凭证

代理端点

  • POST /v1/messages - Anthropic Messages API
  • POST /v1/chat/completions - OpenAI Chat Completions API

监控

  • GET /api/system/health - 健康检查
  • GET /api/runtime/accounts - 账户状态和指标
  • GET/PATCH /api/runtime/load-balancer - 负载均衡策略与分布状态
  • GET/POST /api/runtime/usage - 用量查询与强制刷新

CLI 命令

# 启动服务器
kiro-bridge start [选项]

# 选项:
#   --port <port>        监听端口(默认:3000)
#   --host <host>        绑定主机(默认:0.0.0.0)
#   --no-ui              禁用管理界面
#   --log-level <level>  日志级别(debug|info|warn|error)

🐳 Docker 部署

Docker Run

docker run -d \
  --name kiro-bridge \
  -p 3000:3000 \
  -v ~/.kiro:/root/.kiro \
  -e RATE_LIMIT_ENABLED=true \
  ghcr.io/xniec/kiro-bridge:latest

Docker Compose

version: '3.8'
services:
  kiro-bridge:
    image: ghcr.io/xniec/kiro-bridge:latest
    ports:
      - "3000:3000"
    volumes:
      - ~/.kiro:/root/.kiro
    environment:
      - NODE_ENV=production
      - RATE_LIMIT_ENABLED=true
      - RATE_LIMIT_PER_ACCOUNT_RPM=60
    restart: unless-stopped

🏗️ 架构

┌─────────────────────────────────────────────────────────┐
│                     Kiro Bridge                         │
├─────────────────────────────────────────────────────────┤
│                                                         │
│  ┌──────────────┐    ┌──────────────┐                 │
│  │  管理界面    │    │  代理 API    │                 │
│  │  (React)     │    │  (Fastify)   │                 │
│  └──────┬───────┘    └──────┬───────┘                 │
│         │                   │                          │
│         └───────┬───────────┘                          │
│                 │                                       │
│         ┌───────▼────────┐                            │
│         │   账户管理器   │                            │
│         │  - 负载均衡    │                            │
│         │  - 速率限制    │                            │
│         │  - 健康检查    │                            │
│         └───────┬────────┘                            │
│                 │                                       │
│         ┌───────▼────────┐                            │
│         │   凭证池       │                            │
│         │  (SQLite DB)   │                            │
│         └────────────────┘                            │
└─────────────────────────────────────────────────────────┘

🛠️ 开发

前置要求

  • Node.js >= 20.0.0
  • pnpm >= 8.0.0

设置

git clone https://github.com/xNieC/kiro-bridge.git
cd kiro-bridge
pnpm install
pnpm build

开发命令

pnpm dev              # 以监视模式运行后端
pnpm dev:frontend     # 运行前端开发服务器
pnpm build            # 构建所有包
pnpm typecheck        # 类型检查所有包
pnpm test             # 运行测试
pnpm clean            # 清理构建产物

项目结构

kiro-bridge/
├── packages/
│   ├── backend/      # Fastify 服务器、代理引擎、CLI
│   ├── frontend/     # React 管理界面
│   └── shared/       # 共享 TypeScript 类型
├── dist/             # 打包输出(可部署)
├── scripts/          # 构建脚本
└── Dockerfile        # Docker 配置

🤝 贡献

欢迎贡献!请随时提交 Pull Request。

  1. Fork 本仓库
  2. 创建你的特性分支 (git checkout -b feature/amazing-feature)
  3. 提交你的更改 (git commit -m '添加某个很棒的特性')
  4. 推送到分支 (git push origin feature/amazing-feature)
  5. 打开一个 Pull Request

📄 许可证

本项目采用 MIT 许可证 - 详见 LICENSE 文件。

🙏 致谢

  • 使用 FastifyReact 构建
  • 灵感来自对可靠 Kiro API 访问的需求
  • 感谢所有贡献者和用户

📮 支持


Colin 用 ❤️ 制作

⭐ 在 GitHub 上给我们一个星标 — 这对我们很重要!