Open source · August 26, 2026
freelm: Routing Across Free LLM Providers
How freelm routes one OpenAI-compatible call across nine free-tier providers: interleaved candidates, quota state, a free-only guard, and since 0.5 a race against slow providers.
By Shihab Shahriar Antor · Updated 2026-10-10
freelm is an OpenAI-compatible Python and JavaScript client, and an optional local endpoint, that routes across the free tiers of Google AI Studio, Groq, OpenRouter, Cloudflare Workers AI, Mistral, NVIDIA NIM, Z.ai, and Cohere, with Kilo Gateway and OVHcloud as keyless fallbacks. It is designed for development workloads that can use provider free tiers and need a clear failure path when one source is unavailable. Version 0.5.0 was released on 10 October 2026; the current provider list is on the product page.
Routing and failover
The client tracks local quota state, rotates keys, opens circuit breakers after failures, and interleaves candidate models across providers. That prevents a provider with a long model list from consuming every attempt before the router reaches a healthy alternative. Quotas are scoped the way each provider applies them: a 429 on Gemini, Groq, Z.ai, or Cohere sets aside only that model for that key, while an account-wide limit cools the whole key.
Slow providers are raced
Errors are cheap to recover from because they arrive quickly. A provider that accepts a request and then goes quiet is not. Since 0.5, an attempt that runs for three times that provider's usual latency (clamped to a few seconds) gets a parallel attempt on the next provider, and the first answer wins. In the published simulation, run on 10 October 2026 with fake providers on localhost, a hung provider cost 6.3 seconds where 0.4 failed after its 60 second deadline, and a stream that stalled before its first token cost 3.3 seconds. Routing then ranks the slow provider lower, so the next call does not wait. The scripts are in the repository's benchmarks folder.
Free-only as a guard
OpenRouter and Kilo mix free and paid models in one catalogue, and Z.ai bills every model except its Flash family. freelm rejects non-free identifiers on those providers by default instead of relying on naming convention alone. Users can explicitly opt out of that guard when they intend to use paid capacity.
Limits change
Provider rate limits and catalogues are external facts and change frequently. The library's live model discovery and configurable quotas are more durable than a static comparison table. Documentation should timestamp any specific provider limit rather than presenting it as permanent.