← Back to Plugins
Tools

Psi Router

psifactory By psifactory 👁 63 views ▲ 0 votes

Smart LLM routing plugin for OpenClaw — 5-tier classification routes requests to the cheapest capable model via OpenRouter

GitHub

Install

openclaw plugins install @psifactory/openclaw-psi-router

Configuration Example

{
  "agents": {
    "list": [
      {
        "id": "main",
        "model": "psi-router/auto"
      }
    ]
  }
}

README

# @psifactory/openclaw-psi-router

Smart LLM routing for OpenClaw — saves **40-60% on LLM costs** by routing each request to the cheapest capable model via OpenRouter.

## How it works

```
User request → psi-router (classifies) → OpenRouter → Optimal model
```

**5-tier classification:**

| Tier | Model | Use case |
|---|---|---|
| **SIMPLE** | Sonnet 4.6 | Greetings, thanks, acknowledgments |
| **MEDIUM** | Sonnet 4.6 | Explanations, status checks, summaries |
| **COMPLEX** | Opus 4.6 | Analysis, code, multi-step tasks |
| **REASONING** | Opus 4.6 | Math, formal logic, architecture |
| **RESEARCH** | Perplexity Sonar Pro | Web research, current events |

Classification uses a cheap, fast LLM (Gemini Flash, ~$0.00003/call) with 1h cache.

## Install

```bash
openclaw plugins install @psifactory/openclaw-psi-router
openclaw onboard --openrouter-api-key <your-key>
```

Get your OpenRouter key at https://openrouter.ai/keys

## Usage

Set your agent model to one of:

- `psi-router/auto` — balanced (default)
- `psi-router/eco` — prefer cheaper models (downgrades COMPLEX → MEDIUM)
- `psi-router/premium` — prefer higher quality (upgrades SIMPLE → MEDIUM)

```json
{
  "agents": {
    "list": [
      {
        "id": "main",
        "model": "psi-router/auto"
      }
    ]
  }
}
```

## Cost comparison

Example for 100 requests/day with typical workload:

| Setup | Daily cost |
|---|---|
| Always Opus 4.6 | ~$15-20 |
| psi-router/auto | ~$6-10 |
| psi-router/eco | ~$3-5 |

## How classification works

1. **Rule-based** fast-path for obvious RESEARCH queries
2. **LLM classifier** (Gemini Flash) for everything else
3. **1h cache** prevents redundant classifications
4. **Tool safety**: RESEARCH/SIMPLE with tools → fallback to MEDIUM

## License

MIT — based on ideas from [ClawRouter](https://github.com/clawrouter/clawrouter) (MIT)

## Links

- GitHub: https://github.com/psifactory/openclaw-psi-router
- OpenRouter: https://openrouter.ai
- OpenClaw: https://openclaw.ai
tools

Comments

Sign in to leave a comment

Loading comments...