OpenFOC AI Router: the product work behind it
These five artifacts show how OpenFOC AI Router was framed, measured and decided, not just how it was coded. Each one summarises the project's own documents and links to them, so you can check every line. Read the case study.
What problem does it solve, and for whom?
Problem
Developers and learners who use AI tools daily hit free-tier rate limits, outages and retired models several times a day, and each tool needs its own provider settings.
Users
Individual developers, students and small teams on a Mac who want coding assistants and scripts to keep working without a paid plan.
Job to be done
"When one provider rate-limits me or goes down, I want my tools to keep getting answers from the next free option, then my own Mac, without changing their settings."
Constraints
- One OpenAI-compatible endpoint on 127.0.0.1:4141; every tool points at it once
- Free tiers only, plus local models (Ollama, LM Studio, oMLX) as the last resort
- Keys stay on the Mac: owner-only config in v0.1, macOS Keychain in v0.2; admin API locked to a per-launch token; browser pages blocked
Non-goals
- Reselling or pooling other people’s keys, or evading provider terms of service
- Hosted or multi-user deployment
Source: README ↗
How is quality defined and gated?
Unit tests drive the full router stack against a scripted mock provider, so every fallback rule is checked without keys or network. A simulated burst checks behaviour under quota pressure.
Test set
- 55 router tests across config, quota, fallback, streaming, timeouts, security, client keys, cache, task routing, load balancing, embeddings and the Anthropic API
- Simulated burst: 120 requests in one minute, mock Groq allows 30 per minute (then 429, retry-after 60 s), mock Gemini fails 5% of calls
- Task-classifier set: 100 labelled prompts, target 85% (npm run eval:tasks, needs a local embedding model)
Metrics
| Metric | Measured | Bar |
|---|---|---|
| Router tests (v0.2 branch, 26 Nov 2026) | 55 of 55 pass | All pass |
| Simulated burst served · Groq 30, Gemini 10, local 80 | 120 of 120 | — |
| Calls to a rate-limited provider before its retry-after | 0 | — |
| Mean attempts per request in the burst · One Gemini 503 starts a 30 s backoff, so most of the minute goes local | 2.42 | — |
| Task classifier (100 prompts) · A 26 Nov run picked a reranker as embedder; to re-run | Not measured | — |
Source: Router tests ↗
What does success mean, and what must not break?
My framing of metrics the project already measures.
Requests answered without the user changing tools or paying
The router is only worth running if tools keep working through limits and outages at no cost.
- Fallback success: Share of requests served (503 with attempts trail otherwise)
- Quota headroom: Requests per minute and per day left per provider; cooldowns from retry-after and rate-limit headers
- Latency: Per-target latency; latency strategy reorders only within a tier
- No wasted calls: Zero calls to a provider inside its cooldown
- Privacy: Loopback only; local-only clients never reach cloud providers; request bodies not logged by default
- Answer integrity: Streams fall back before the first byte
What was decided, and why?
| Decision | Date | Status | What and why |
|---|---|---|---|
| D1 Fall back only before the first streamed byte ↗ | 25 Nov 2026 | Adopted | Try the next target only until a provider starts streaming; after that, the answer comes from that provider alone. Why: A client must never see half an answer from one model spliced onto another. |
| D2 Cool down by the provider’s own signals ↗ | 25 Nov 2026 | Adopted | On 429, cool down for the time in retry-after or x-ratelimit reset headers; on 5xx or timeouts, back off exponentially from 30 s to 10 min; on 401/403, pause the provider for 10 min. Why: Re-hitting a rate-limited provider burns quota and adds latency for nothing. |
| D3 Cloud first, local last, even when balancing ↗ | 25 Nov 2026 | Adopted | Latency and balanced strategies reorder targets only within a tier, never across tiers. Why: Free cloud capacity gets used first and the Mac stays the safety net; balancing must not quietly change that order. |
| D4 Ship providers by today’s terms, not last year’s ↗ | 25 Nov 2026 | Adopted | Cerebras ships disabled (no standing free tier as of Nov 2026); GitHub Models is removed from stored configs after its retirement on 30 Jul 2026. Why: Free tiers change often; a stale provider list turns into silent failures. |
| D5 Keys in the macOS Keychain ↗ | 25 Nov 2026 | Adopted | v0.2 moves keys from an owner-only file to the Keychain, passed to the router over stdin and held only in memory. Why: A config file is easy to copy or commit by mistake. |
What shipped, what's weak, and what's next?
Status: v0.1.0 on main (25 Nov 2026); v0.2 local AI gateway in review as PR #1
Shipped
- Automatic fallback across Groq, Google Gemini, OpenRouter, Mistral and NVIDIA NIM free tiers, then local models
- Quota dashboard, built-in chat and named routes (auto, fast, long-context, local)
- v0.2: client keys and stats, SQLite request log, exact and semantic cache, embeddings, task routing, Anthropic /v1/messages for Claude Code, latency load balancing
Known limits
- Builds are unsigned and not notarized
- Free tiers change and may log prompts or train on them (Gemini’s free tier does)
- Task routing is opt-in and depends on a local embedding model
Next
- Signed and notarized releases
- Responses API and a rerank endpoint
- Tray pause and resume
- MCP gateway
Source: README roadmap ↗ · All product artifacts
Open it yourself: GitHub ↗ · v0.2 pull request ↗
What else should you know about these artifacts?
How is OpenFOC AI Router evaluated?
Unit tests drive the full router stack against a scripted mock provider, so every fallback rule is checked without keys or network. A simulated burst checks behaviour under quota pressure. Fall back on rate limits, outages, bad keys, retired models and context limits; return a request’s own 4xx to the client without trying others; never splice two providers into one streamed answer.
Which decisions shaped OpenFOC AI Router?
Fall back only before the first streamed byte (adopted, 25 Nov 2026): A client must never see half an answer from one model spliced onto another. Cool down by the provider’s own signals (adopted, 25 Nov 2026): Re-hitting a rate-limited provider burns quota and adds latency for nothing. Cloud first, local last, even when balancing (adopted, 25 Nov 2026): Free cloud capacity gets used first and the Mac stays the safety net; balancing must not quietly change that order. Ship providers by today’s terms, not last year’s (adopted, 25 Nov 2026): Free tiers change often; a stale provider list turns into silent failures. Keys in the macOS Keychain (adopted, 25 Nov 2026): A config file is easy to copy or commit by mistake.
What are the known limits of OpenFOC AI Router?
Builds are unsigned and not notarized. Free tiers change and may log prompts or train on them (Gemini’s free tier does). Task routing is opt-in and depends on a local embedding model.