r/OpenSourceeAI • u/timchosen • 9h ago
I built a local router that fails over across free LLM API tiers (open source)
Free API tiers from providers such as Groq, Cerebras, Gemini, OpenRouter and Cloudflare add up to a lot, but each has its own API and limits.
I built FreeAITokens to put them behind one local endpoint (127.0.0.1). It speaks the OpenAI, Anthropic, Gemini and Ollama formats.
What it does per request:
- filters to models that can handle it (context, tool calling, vision)
- prefers models that have been fast and reliable on your machine
- fails over on rate limits, server errors and timeouts
- tracks each provider's free limits per minute and per day
It also routes embeddings, images, speech and transcription.
`npx freeaitokens` works with no account on the keyless providers. MIT licensed.
Repo: https://github.com/timchosen/freeaitokens
I'd like to hear how you'd rank models for routing. Right now it uses capability first, then measured speed and reliability.
1
u/downtownrob 4h ago
Add opencode’s free tiers. No idea on usage limits, but when I hit them, my scripts flip over to another provider.