James Schwahn
← All work

Policy-routed model gateway

A model router that refuses to guess.

One OpenAI-compatible endpoint in front of hundreds of model offers. An offer is routable only with explicit evidence of its pricing terms; routing accounts for capability, context fit, quota, health and session stickiness, with circuit breakers and stream deadlines.

Role
Architect and sole engineer
Period
Nov 2026
Maturity
Functional prototype
Signals
LLM gateway & routing · Cost governance · Reliability

The problem

Teams wire applications to whichever model is convenient, with no policy for cost, health, quotas or fallbacks — and unknown pricing turns into surprise bills.

admitApplicationsOpenAI-compatibleAdmission policyevidence requiredRouterhealth · quota · stickyCircuit breakersdeadlinesModel offersmany providers
Control pointComponentExternal

What I did

  • Designed the admission policy: unknown pricing is rejected, paid overflow is blocked.
  • Implemented health, quota and sticky routing with circuit breakers and an encrypted key vault.
  • Wrote roughly 200 tests around routing and failure handling.

Key decisions

Admission by evidence, not by catalogue

The expensive failure in model routing is silent cost drift. Requiring evidence before an offer becomes routable makes cost a policy, not a hope.

Evidence

251

FreeAIMesh routes across hundreds of model offers, admitting only those with explicit evidence of their pricing terms.

Offers passing the routing policy at capture time; varies daily. Source: Overview screen of the locally running instance (not part of the repository audit).

Self-reported

Nov 2026

Outcome & limits

Outcome

  • Runs locally as a single-user gateway; its router logic was ported into a separate content platform.

Known limitations

  • Single user, running locally; which clients route through it has not been measured.
  • No CI pipeline yet.

Stack

  • Node.js
  • Electron
  • SQLite
  • AES-GCM vault