The right model for every turn
A local, keyless model router for Oh My Pi. One OpenAI-compatible provider that picks a concrete OpenRouter model per turn from measured price and estimated task complexity — including mid-conversation.
Why this exists when OpenRouter already ships routers
OpenRouter has openrouter/auto and openrouter/pareto-code. Both are opaque, server-side, and — per Pareto's own docs — "you can't directly cap cost or latency per request." This router does the things a prompt classifier structurally cannot:
Agent-loop awareness
OpenRouter sees a prompt. We see omp's tool array, tool-result depth, and whether the previous tool call failed. Most agent turns are mechanical post-tool-result continuations — the largest cost lever in agent traffic, and invisible upstream.
Budget enforcement
Per-turn, per-conversation, and rolling-24h caps, checked against a cold-cache forecast before dispatch, with forced downgrade at the ceiling.
Mid-stream escalation
Hold the first N tokens; on a malformed tool call, refusal, empty completion, or repeated tool call, abort and re-dispatch upward. omp never observes the failure.
Cache-aware hysteresis
Switching models forfeits the warm prompt cache. The decision is arithmetic, not vibes: expected saving must beat the forfeited cache-read discount by a configured margin.
Closed-loop trust
Per-model escalation and error rates from your traffic demote cheap-but-flaky models automatically.
Explainability
Every decision — candidates, rejections, forecasts, reasons — is persisted and replayable via auto-model-router explain.
How it runs
auto-model-router runs embedded inside the omp process as an extension — no separate server, no orphaned process. It binds a free OS-assigned port and lives and dies with the omp session. For non-omp harnesses (Hermes, Claude, any OpenAI-compatible client), run it standalone with auto-model-router serve --port <n>.