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

@sryzzz99/llm-router

v1.0.0

Published

LLM Router local routing proxy for OpenAI-compatible Chat Completions APIs.

Readme

LLM Router

LLM Router is a small local routing proxy for OpenAI-compatible Chat Completions APIs.

Public Model Semantics

LLM Router currently accepts exactly one client-facing request model ID: auto.

config.publicModels can still define aliases such as flash and pro, but those aliases are internal routing vocabulary. They are used by routing.tiers.*, response headers, traces, and diagnostics — not as public request IDs.

The sample config.example.json publishes:

  • flash
  • pro

These example aliases are not protocol constants. You can rename them, remove them, or add more aliases as long as auto remains the router entry and routing.tiers.*.publicModel points to alias entries.

auto is routed locally with a Flash-first policy. Simple summaries, short text, ordinary Q&A, lightweight code edits, simple agentic work, and routine structured output usually land on flash. Complex reasoning and natural multi-file debugging or repair workflows usually land on pro.

Clients, OpenClaw, and SDK integrations should always send auto. Routed aliases such as flash and pro appear in x-xy-router-model, traces, and internal configuration only.

Routing Thresholds

routing.tierBoundaries and routing.confidenceThreshold are the only public scoring knobs.

  • routing.tierBoundaries controls the score boundaries between SIMPLE, MEDIUM, COMPLEX, and REASONING.
  • routing.confidenceThreshold controls when a score is treated as ambiguous by the built-in classifier.

Dimension weights, keyword lists, token thresholds, and confidence steepness remain internal implementation constants and are not part of the public config surface.

Install

npm install
npm run build

Documentation

Reference Project

For related routing and OpenClaw ecosystem context, see BlockRunAI/ClawRouter.

OpenClaw Compatibility

For OpenClaw v2026.4.11 and v2026.3.24, LLM Router does not register a provider and does not declare providers in openclaw.plugin.json.

When loaded by OpenClaw, the router still writes or repairs models.providers.xiaoyiprovider so that:

  • baseUrl points to the local router API, for example http://127.0.0.1:8402/v1
  • api is openai-completions
  • models only exposes auto, even if the routing config contains aliases such as flash and pro

Existing apiKey, api_key, headers, request, and unknown provider fields are preserved across Gateway restarts. The router only repairs its managed fields.

CLI Usage

# 启动代理(必须提供配置文件)
llm-router --config config.json

# 自定义端口
llm-router --config config.json --port 9000

# Override API key
llm-router --config config.json --api-key sk-your-key

注意:v0.2.0 起不再支持纯环境变量启动。所有基础配置必须通过 --config 指定,运行时覆写项再通过 CLI 参数传入。

OpenClaw Plugin Usage

# 内联配置
openclaw config set plugins.entries.llm-router.config.config '{"version":1,...}'

# 文件路径
openclaw config set plugins.entries.llm-router.config.configPath "/path/to/config.json"

# 查看 Router 注入的 provider 配置
openclaw config get models.providers.xiaoyiprovider

OpenClaw 应始终向本地 Router 请求 auto,再由 Router 在内部决定最终落到哪 个 alias / physical model。

API

Implemented:

GET  /health
POST /v1/chat/completions

Not implemented:

GET /v1/models

Unsupported model IDs return HTTP 400. Supported request IDs are currently only auto. Configured aliases remain internal routing outputs and are surfaced via response headers, not accepted in request bodies.

Response Headers

The proxy adds routing headers:

  • x-xy-router-model
  • x-xy-router-actual-model
  • x-xy-router-tier
  • x-xy-router-trace
  • x-xy-router-routed
  • x-xy-router-fallback
  • x-xy-router-upstream

x-xy-router-model is the routed alias chosen inside the router. x-xy-router-actual-model is the physical upstream model ID used in the forwarded request.

Phase 2 Candidate: Response Cache

Response caching is intentionally not included in v0.2.0.

It is reserved as a future opt-in cost optimization for non-streaming, deterministic requests. A cache key must include at least model, messages, tools, temperature, max_tokens, and baseUrl, and it must distinguish between routed aliases and the resolved physical upstream model.

License

This project is licensed under the MIT License. See LICENSE.