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

@0xki/kirouter

v1.0.8

Published

Multi-provider LLM gateway with unified API, dashboard, and key rotation

Readme

KiRouter

Multi-provider LLM gateway with unified OpenAI-compatible API, key rotation, real-time dashboard, and budget tracking.

npm version license node

Quick Start

npm install -g @0xki/kirouter
kirouter

Dashboard: http://localhost:8090

Features

  • Unified API — OpenAI-compatible /v1/chat/completions for all providers
  • Key rotation — automatic failover across multiple API keys
  • 22 providers — OpenAI, Anthropic, Grok, Gemini, DeepSeek, and more
  • Real-time dashboard — stats, sparklines, trends, and health monitoring
  • Budget tracking — per-provider spend limits and usage analytics
  • SQLite persistence — request history, audit logs, and backups
  • Auto-update — checks npm registry on startup, one-command upgrade

CLI Options

kirouter                    # Start on port 8090
kirouter --port 3000        # Start on custom port
kirouter --update           # Check for updates and install
kirouter --version          # Show version
kirouter --help             # Show help

Update

npm i -g @0xki/kirouter@latest --prefer-online

API Example

curl http://localhost:8090/v1/chat/completions \
  -H "Authorization: Bearer $(cat ~/.kirouter/.gateway_key)" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}]
  }'

Model format: {provider}/{model_id} — e.g., openai/gpt-4o, anthropic/claude-opus-4-6, grok/grok-chat-fast

Configuration

Data is stored in ~/.kirouter/ (auto-created):

~/.kirouter/
├── .gateway_key            # Auto-generated API/admin key (chmod 600)
├── providers.json          # Provider configs and API keys
├── provider-key-stats.json # Provider-key usage and budget state
└── ki-gateway.db           # SQLite request and audit logs

Environment Variables

| Variable | Default | Description | |---|---|---| | KIGW_PORT | 8090 | Gateway port (--port sets this) | | KIGW_DATA_DIR | ~/.kirouter | Mutable state directory | | PORT | — | Legacy port alias; KIGW_PORT wins | | KIGW_HOST | 127.0.0.1 | Listen address | | KI_DATA_DIR | — | Legacy data-directory alias | | KI_GATEWAY_VERSION | package version | Version string | | KIGW_SESSION_TTL_MS | 86400000 | Admin-session lifetime in milliseconds | | KIGW_MAX_ADMIN_SESSIONS | 100 | Maximum concurrent in-memory admin sessions (oldest idle session is evicted) | | KIGW_TRUST_PROXY | 0 | Trust sanitized X-Forwarded-Host/X-Forwarded-Proto from a controlled reverse proxy | | KIGW_FORCE_SECURE_COOKIES | 0 | Force Secure admin cookies behind a trusted HTTPS proxy | | KIGW_ALLOW_SESSION_NO_ORIGIN | 0 | Allow session mint/write without Origin only for controlled local tools/tests | | KIGW_CHAT_BODY_LIMIT | 2097152 | Maximum /v1/chat/completions JSON body (2 MiB) | | KIGW_ADMIN_BODY_LIMIT | 1048576 | Maximum normal admin JSON body (1 MiB) | | KIGW_RESTORE_BODY_LIMIT | 8388608 | Maximum restore JSON body (8 MiB) | | KIGW_ALLOW_PRIVATE_NETWORKS | 0 | Explicitly allow custom private/loopback upstreams and proxies; keep disabled unless trusted |

Admin Security

The browser exchanges the gateway master key for an opaque, server-side admin session. The master key is not persisted in localStorage, cookies, or SSE URLs. Mutating dashboard requests require both a CSRF token and a matching same-origin Origin/Referer; logout revokes the server session.

Configuration backups use schema version 2 and redact provider keys, credential-bearing proxy URLs, and error details. Plaintext secret export is unsupported. Restore validates the full document and reuses redacted keys that already exist on the same instance; it does not migrate secrets to a fresh host. Provider configuration and key statistics are staged together; an on-disk restore journal completes an interrupted two-file replacement on the next startup.

KiRouter defaults to port 8090. Port 20128 is reserved for 9router in Ki’s stack and is not used as the KiRouter default.

Custom provider and proxy URLs are restricted to public HTTP(S) destinations by default to reduce SSRF risk. Private, loopback, link-local, metadata, multicast, and reserved destinations require the explicit KIGW_ALLOW_PRIVATE_NETWORKS=1 opt-in. DNS is checked and pinned for direct requests, redirects are revalidated, and proxied redirects are rejected. The default local grok2api upstream therefore also requires this opt-in.

When an upstream is reached through a remote HTTP(S) proxy, KiRouter validates both the configured upstream and proxy endpoint before dispatch, but the remote proxy ultimately resolves the CONNECT destination itself. End-to-end DNS pinning therefore applies only to direct requests. Use only trusted remote proxies with their own private-network/metadata egress controls.

Development

git clone https://github.com/0xKii/kirouter.git
cd kirouter
npm install
npm install -g .
kirouter

License

MIT © 2026 0xki