ai newsMi., 4. Nov.
EilmeldungGDPx Benchmark: Opus 5.5 vs Gemini 4 Carbon

Run Claude Code and the OpenAI SDK on free LLM tiers with FreeLLMAPI

Almost every AI lab now has a free tier: a few million tokens a month, a few thousand requests a day. One tier on its own is a toy. Stacked together behind one endpoint, they are enough to run side projects, experiments and even a coding agent without a bill. That is the idea behind FreeLLMAPI. tas

dev.toMittwoch 05:10 · 04.11.3 Min. Lesezeit
Bild: dev.to

Almost every AI lab now has a free tier: a few million tokens a month, a few thousand requests a day. One tier on its own is a toy. Stacked together behind one endpoint, they are enough to run side projects, experiments and even a coding agent without a bill. That is the idea behind FreeLLMAPI.

tashfeenahmed/freellmapi is a self-hosted server that aggregates the free tiers of 34 LLM providers behind a single OpenAI-compatible /v1 API. Per the README it stores your provider keys encrypted, routes each request to the best available model, falls over to the next provider when one is rate-limited, and tracks per-key usage so you stay under every free-tier cap. The README puts the stacked total at roughly 7.4 billion tokens a month across 635 free model endpoints.

This post covers the install, connecting Claude Code, and calling it from Python.

You add keys for the providers you want (Google, Groq, Cerebras, Mistral, OpenRouter, Cloudflare, Cohere, NVIDIA, Hugging Face and more) and order them in a fallback chain. For each request the router picks the highest-priority model with a healthy key that is under all its rate limits, decrypts the key in memory and calls the provider. On a 429 or 5xx it cools that key down and retries the next model in your chain.

A few details make it practical for agents:

With Docker, the one-liner sets up ~/freellmapi, generates an encryption key, pulls the image and starts the container:

curl -fsSL https://freellmapi.co/install.sh | bash Enter fullscreen mode Exit fullscreen mode Read the script first if you prefer; the README links it. Re-running it keeps your.env and encryption key and updates the container.

On Windows or macOS there is also a desktop tray app on the Releases page, which runs the router and dashboard locally with no account to set up. From source:

npm install && npm run dev Enter fullscreen mode Exit fullscreen mode That gives you the server on port 3001 and the dashboard on 5173.

Open http://localhost:3001, add provider keys on the Keys page, reorder the Fallback Chain, and copy the unified API key from the Keys page header. The Playground shows which provider served each test message, with model ID and latency, which is a quick way to confirm your keys work.

The README gives a setup command that reads your live catalog, backs up the existing config and merges into it:

npx freellmapi setup-claude --url http://localhost:3001 --api-key <unified-key> Enter fullscreen mode Exit fullscreen mode Every generator supports --dry-run so you can see the change first. If you would rather keep credentials out of config files, npx freellmapi launch starts Claude Code against the router and launch-codex does the same for Codex. The supported list also covers Gemini CLI, Cursor, Cline, Roo Code, OpenCode, Aider, Goose, Crush, Zed and more.

Any OpenAI client works. Set the base URL to your server:

from openai import OpenAI client = OpenAI ( base_url = " http://localhost:3001/v1 ", api_key = " freellmapi-your-unified-key ", ) resp = client. chat. completions. create ( model = " auto ", # or "auto:fast", "auto:smart", a profile, or a model id messages = [{ " role ": " user ", " content ": " Summarise the fall of Rome in one sentence. " }], ) print ( resp. choices [ 0 ]. message. content ) Enter fullscreen mode Exit fullscreen mode Every response carries an X-Routed-Via: <platform>/<model> header, so you can log which provider actually answered.

From the builds tracked on the FreeLLMAPI page:

They overlap but aim at different jobs. LiteLLM is an AI gateway and Python SDK for calling 100+ providers through one OpenAI-format interface, with cost tracking, guardrails and load balancing, and it is the usual pick when you are paying for production traffic. FreeLLMAPI is local-first and single-user by design, and its catalog and router are built specifically around free-tier quotas.

Source repo: tashfeenahmed/freellmapi. License: MIT.

Want the setup commands for 50 AI repos people actually ship with? Get the free AI Repos That Actually Ship pack: https://dedupedai.com/ship-pack/?utm_source=devto&utm_medium=article&utm_campaign=shippack

Quelle: dev.to (dev.to). Original öffnen