Works with the AI Agents you already use
Free LLM Router & Failover Gateway
by Jace Reid
Pools your free LLM tiers behind one local OpenAI/Anthropic-compatible API and fails over to the next best model when a provider answers 429, 402 or 5xx — so agents stop dying at the daily quota.
$5
Free LLM Router & Failover Gateway
Example session with this skill installed
My agent keeps dying when Groq's free tier hits its daily limit. Set up the free-LLM router with my provider keys so it fails over automatically, and show me the ranking it will use for a request that needs tool calls.
- Read your context and instructions
- Compiled the free llm router
What it set up
A config with three providers. This run uses the three mock upstreams shipped in the package, so every number below is reproducible without a key: busy (rating 99, always answers 429), good (rating 90, OpenAI wire) and claudish (rating 85, Anthropic wire).
$ node scripts/gateway.mjs --config examples/gateway.demo.json --list
3 free models, best first:
1. busy-gpt [busy/openai] rating 99 context 200000 tools vision json
2. good-model [good/openai] rating 90 context 131072 tools json
3. claude-mock [claudish/anthropic] rating 85 context 200000 tools
$ node scripts/gateway.mjs --config examples/gateway.demo.json --route '{"tools":true,"tokens":4000}'
tools ≤4000tok → busy/busy-gpt (r99) → good/good-model (r90) → claudish/claude-mock (r85)
The order is the answer to "what happens when Groq is out": the best model is tried first, and the next two are already queued with the requirements checked (tool support, context size).
The failover, live
A request arrives; the top model's provider is out of quota. The client gets a normal 200 and never learns about the 429:
POST /v1/chat/completions {"model":"auto","messages":[{"role":"user","content":"What is 2+2?"}]}
HTTP/1.1 200
x-gateway-provider: good
x-gateway-model: good-model
x-gateway-rating: 90
{"id":"chatcmpl-mock","object":"chat.completion","model":"good-model",
"choices":[{"index":0,"message":{"role":"assistant","content":"Echo: What is 2+2?"},"finish_reason":"stop"}],
"usage":{"prompt_tokens":9,"completion_tokens":4,"total_tokens":13}}
The gateway log for that request
chat.completions ≤1035tok → busy/busy-gpt(r99) → good/good-model(r90) → claudish/claude-mock(r85)
busy: HTTP 429 ({"error":{"message":"free tier exhausted for today","type":"rate_limit_error"}}) — cooling down 60s
good/good-model served in 3ms
Cross-wire, including tools
An Anthropic-shaped client sends a tool definition; the model that wins sits on an OpenAI-wire provider. The request is rewritten up and the tool call comes back as an Anthropic tool_use block:
→ {"type":"message","model":"good-model",
"content":[{"type":"text","text":"Let me check the weather."},
{"type":"tool_use","id":"call_mock_1","name":"get_weather","input":{"city":"Paris"}}],
"stop_reason":"tool_use","usage":{"input_tokens":9,"output_tokens":4}}
Streaming works in both directions too: an OpenAI client streamed by the Anthropic-wire provider receives ordinary OpenAI chunks and ending data: [DONE].
Health after that traffic
GET /healthz
{"ok":true,"uptime_s":1,"providers":[
{"id":"busy","wire":"openai","models":1,"cooldown_s":60,"ok":0,"failed":1},
{"id":"good","wire":"openai","models":1,"cooldown_s":0,"ok":3,"failed":0},
{"id":"claudish","wire":"anthropic","models":1,"cooldown_s":0,"ok":1,"failed":0}]}
Next steps
- Run
--checkwith your real keys first: it probes each provider's/modelsroute and names the key that is rejected. - Swap
examples/gateway.demo.jsonforexamples/gateway.config.example.jsonand adjust the ratings to your own benchmarks. - If a provider's daily quota is the usual failure, raise
cooldown_secondsso it is retried less often.
Connects securely to your tools. The creator never sees your data.
About this skill
Free tiers are the cheapest way to run an agent, and the flakiest: the key that worked all morning answers 429 at 3 p.m., a provider retires a model id, and one endpoint speaks OpenAI's wire while your client speaks Anthropic's.
This skill is one Node file that sits between your client and every free tier you already have, and makes them look like a single reliable API.
What it does
- One endpoint, both wires.
POST /v1/chat/completionsfor OpenAI clients,POST /v1/messagesfor Anthropic clients, JSON or streaming. If the winning provider speaks the other wire, the request and the answer are translated - system prompt, images, tools, tool calls, stop sequences, max_tokens, JSON mode, stop reasons and usage counts. - Quality-ordered routing. Every model carries your rating; a request goes to the highest-rated free model that can do what it asks (tools / vision / JSON / context size).
- Failover instead of failure. A provider answering 402, 429 or 5xx, rejecting its key, timing out or unreachable is cooled down and the next candidate serves the request. The client never sees the 429.
- Visible decisions.
x-gateway-provider,x-gateway-modelandx-gateway-ratingon every answer, one log line per request, and/healthzwith per-provider cooldowns and counters.
What you need
One config file listing the free tiers you have (base URL, wire, key env var, models, your rating), the keys in environment variables, and Node 18+. The package ships a starting config for Groq, Cerebras, Gemini's OpenAI-compatible endpoint and an OpenRouter free model - model ids and free-tier terms change, so verify them before trusting a route.
node scripts/gateway.mjs --config gateway.config.json
# gateway: listening on http://127.0.0.1:8787 — 4 free models over 4 providers, cooldown 60s
Then point any OpenAI SDK at http://127.0.0.1:8787/v1, or any Anthropic SDK at http://127.0.0.1:8787.
Honest limits
- No keys of its own: you bring the free tiers; nothing is scraped or borrowed.
- Two upstream wires only (OpenAI
/chat/completions, Anthropic/messages). Gemini works through its OpenAI-compatible base URL, not its native wire. - Cooldowns are time-based, not quota-aware: a provider whose daily quota is gone is retried once per cooldown and fails again (one wasted request).
- Ratings and capabilities are your claims;
--checkonly verifies that keys authenticate. - Provider-specific extras (reasoning traces, prompt caching, audio) are not translated.
- No auth on the local port: it binds 127.0.0.1, but any process on the machine can spend your quota.
- Stateless: chat history is whatever the client sends, so mid-conversation failover is safe.
Requires Node 18+. No native Gemini wire support. Provider-specific extras like prompt caching are dropped during wire translation. Local port has no built-in auth.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 8 days ago
- Software
Node.js 18+
Needs a free-tier API key for at least one provider (Groq, Cerebras, Gemini or OpenRouter all work). Keys are read from the environment variables named in gateway.config.json (key_env) and never sent to the client.
Permissions
File Scopes
What's inside
Frequently Asked Questions
New in LLM Ops
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for LLM Ops.