AINPM.in / Work / OpenFOC AI Router
Case study · Developer tool · Cost and reliability

Free AI that keeps answeringOpenFOC AI Router: one endpoint, every free tier

OpenFOC AI Router gives every AI tool on a Mac one local, OpenAI-compatible endpoint and spreads the requests across the free tiers of five providers, with your own models as the last resort. When a provider rate-limits, fails or retires a model, the request moves on by itself, so coding assistants and scripts keep working at ₹0 per request.

  • TypeScript router (Bun)
  • Tauri v2 menu-bar app
  • OpenAI + Anthropic APIs
  • Loopback only
  • MIT
Router tests and a simulated burstv0.2 branch (PR #1), run on 26 Nov 2026 with the project’s own mock providers; no keys, no network
  • Router tests passing55 / 55
  • Simulated burst requests served120 / 120
Calls to a rate-limited provider before its retry-after
0
Cost per request on free tiers
₹0

The burst is a simulation: 120 requests in one simulated minute, the mock Groq allows 30 per minute and the mock Gemini fails 5% of calls. Source: Router tests ↗

01 · The problem

Who is it for, and what job does it do?

Free AI tiers are generous in total but small one by one: a provider might allow 30 requests a minute or 50 a day. A developer using an assistant all day hits those limits, an outage or a retired model several times a day, and every tool has its own provider settings to change.

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.
02 · How it works

What happens when a provider says no?

Each request walks an ordered route, for example auto: Groq, then Gemini, then local. Targets are skipped if disabled, missing a key, cooling down or out of local quota. Every response says which provider answered and after how many attempts.

Provider responseWhat the router doesWhy
429 rate limitCools the provider down for the time in its retry-after or rate-limit reset headers, then tries the next targetRe-hitting a limited provider wastes quota and time
5xx, timeout, network errorBacks off exponentially, 30 s up to 10 min, then next targetOutages usually last longer than one retry
401 or 403Pauses the provider for 10 min, then next targetA bad key won't fix itself mid-request
404 retired model, 413 context too longNext target; context errors cause no cooldownAnother model may accept the same request
Other 4xxReturns the error to the client without trying othersThe request itself is invalid, so every provider would refuse it
Everything exhausted503 with an attempts trail naming each target and why it failedA clear failure beats a silent one
Answer integrity: fallback happens only before the first streamed byte. A client never sees half an answer from one model spliced onto another.
03 · Evidence

How do you know the fallback works?

Run on 26 Nov 2026 against the v0.2 branch with the project's own mock providers: no API keys, no prompts sent anywhere.

Scenario (mock providers)Result
All healthyServed by the first target (Groq), 1 attempt
Groq returns 429 with retry-after 20 sServed by Gemini on attempt 2; the next request skips Groq
Groq network error, Gemini bad keyServed by the local model on attempt 3
Invalid request (400)Returned to the client after 1 upstream call
Everything down503 with the trail: Groq down, Gemini down, local down
Burst: 120 requests in one simulated minute (Groq allows 30, Gemini fails 5%)120 of 120 served: Groq 30, Gemini 10, local 80; 2.42 attempts on average; 0 calls to Groq after its limit
What the burst taught: one transient Gemini 503 started a 30-second backoff, so most of the minute went to the local model. That keeps answers flowing but leans on the Mac. A shorter first backoff for a single 5xx is worth testing against real traffic.

The 55 unit tests cover config migration, quota rules, every fallback case, streaming, header-only timeouts, server security (foreign browser origins blocked, admin token required, keys never returned), client keys and limits, the cache, task routing, load balancing, embeddings and Anthropic translation. Read the tests.

04 · Decisions

What was decided, and what was dropped?

DecisionWhy
Free tiers and local models onlyThe job is "keep working at no cost". A paid fallback would hide the moment you run out.
Cloud first, local last, even when balancingLatency and balanced strategies reorder only within a tier, so free cloud capacity is used before the Mac.
Ship providers by today's termsCerebras ships disabled (no standing free tier as of Nov 2026). GitHub Models is removed from stored configs after its retirement on 30 Jul 2026.
Local-only by designBound to loopback, browser pages blocked, admin API locked to a per-launch token, keys in the macOS Keychain in v0.2, request bodies not logged by default.
Opt-in task routingClassifying prompts as coding, reasoning or long-context needs a local embedding model. It never blocks: without one, requests go to auto.
05 · Limits

Where does it fall short?

  • Unsigned builds. macOS asks you to approve the app on first launch; signed and notarized releases are on the roadmap.
  • Free tiers move. Limits and model IDs change often; the app's model discovery shows what is live today.
  • Privacy depends on the provider. Some free tiers log prompts or train on them. Use a local-only client key for anything sensitive.
  • Task classifier not yet measured. Its 100-prompt check needs a local embedding model; a 26 Nov run picked a reranker instead, so it will be re-run before any accuracy is claimed.

More on the design: builder's note on routing across free tiers.

Proof of skill

What does this project prove, and how can you check it?

Employers trust skills they can verify. Each claim below links to its place in the skills matrix, and every piece of evidence is public.

Skills demonstrated

Evidence you can open

See the product artifacts: brief, eval spec, metrics tree, decisions

Last public activity 25 November 2026 · checked 28 November 2026

06 · FAQ

Frequently asked questions

What is OpenFOC AI Router?

An open-source macOS menu-bar app by Ian Pinto that gives every AI tool one OpenAI-compatible endpoint on 127.0.0.1:4141. It spreads requests across the free tiers of Groq, Google Gemini, OpenRouter, Mistral and NVIDIA NIM, with local models through Ollama, LM Studio or oMLX as the last resort. When a provider rate-limits, fails or retires a model, the request moves to the next one.

Does it cost anything?

No. It routes only to free tiers and local models, so the cost per request is zero within each provider’s free quota. The trade-off is that free tiers change often and some may log prompts or use them for training; Gemini’s free tier does.

Can a client get half an answer from two models?

No. The router falls back only before the first byte of a streamed answer. Once a provider starts streaming, the answer comes from that provider alone.

Can I use it with Claude Code or Cursor?

Yes. Any tool that takes an OpenAI-compatible base URL can point at http://127.0.0.1:4141/v1. The v0.2 release in review adds an Anthropic-compatible /v1/messages endpoint so Claude Code can run on free and local models.

How was it tested?

On 26 Nov 2026, 55 of 55 router tests passed on the v0.2 branch. They drive the full router stack against a scripted mock provider, so no keys or network are needed. A simulated burst of 120 requests in one minute was served in full, and the router made no calls to a rate-limited provider before its retry-after time.

More work

Other case studies