open-index/open-npm huggingface dataset:
npm package: @rungate/llmrouter
Description: Minimal OpenClaw-first LLM router.
Latest version: 0.1.3

# llm_router

Minimal OpenClaw-first LLM router.

For the end-to-end runtime walkthrough of how the router itself works, see [docs/REQUEST_FLOW.md](docs/REQUEST_FLOW.md).

Included in this reset:

- local OpenAI-compatible proxy
- simple prompt classifier
- x402 payment retry client
- OpenClaw plugin with `/wallet`

Not included yet:

- advanced routing heuristics
- weighted scoring
- provenance receipts
- complex fallback chains

## Dev

```bash
npm install
npm run typecheck
npm run dev:proxy
```

## Production Install

Install the published package into OpenClaw:

```bash
openclaw plugins install @rungate/llmrouter
openclaw gateway restart
```

Or use the installer script from this repo:

```bash
bash scripts/install-openclaw.sh
```

Recommended production environment:

```bash
INFERENCE_PROVIDER_BASE_URL=https://api.rungate.ai
X402_NETWORK=eip155:8453
```

`llm_router` remains local-only in this setup. OpenClaw still talks to the local proxy at `http://127.0.0.1:3000/v1`; the remote upstream is configured by environment.

If `INFERENCE_PROVIDER_BASE_URL` is unset, the router defaults to `https://api.rungate.ai`.

## Local OpenClaw Install

For local unpublished development, install from a packaged tarball:

```bash
npm run build
npm pack
openclaw plugins install ./rungate-llmrouter-0.1.0.tgz
openclaw gateway restart
```

For Docker/tempclaw-style testing, stage the tarball into the container and install it there with:

```bash
openclaw plugins install /staging/rungate-llmrouter-0.1.0.tgz
```

The installer script is for real OpenClaw installs, not tempclaw. Tempclaw should keep using the explicit install flow so restart and verification stay visible.

## Environment

For local development, override the production default upstream:

```bash
LLM_ROUTER_HOST=127.0.0.1
LLM_ROUTER_PORT=3000
INFERENCE_PROVIDER_BASE_URL=http://127.0.0.1:8787
X402_NETWORK=eip155:84532
```

## OpenClaw Models

- `llmrouter/auto`
- `llmrouter/simple`
- `llmrouter/coding`
- `llmrouter/reasoning`

Image requests still route automatically to the vision-capable upstream model through `llmrouter/auto`.

## Release Workflow

```bash
npm run typecheck
npm run build
npm pack
npm publish
```

Use `npm pack` as the final sanity check before publishing. The packed artifact should contain the built plugin entrypoint in `dist`, the plugin manifest, and only runtime files.