Learn how to stack the free tiers of 14 different AI providers behind a single OpenAI-compatible API gateway running on your machine.
FreeLLMAPI is an open-source proxy that combines the free tiers of 14 different AI providers into a single endpoint. You point your existing OpenAI code at localhost, and the proxy handles model selection, failover routing, and limit tracking automatically.
Juggling 14 SDKs and rate limits in your application code is messy. Here is what FreeLLMAPI does instead.
Change exactly one line of code in your apps. Point the OpenAI SDK to http://localhost:3001/v1 using a single unified API key generated in your dashboard.
If Gemini hits its rate limit (429) or fails (5xx), the proxy instantly reroutes your request to Llama 3.3 or another backup model in your custom priority list.
Your API keys from upstream providers are stored locally in a SQLite database, encrypted using AES-256-GCM. Your application code only sees the proxy key.
You don't need keys from all 14 providers. Stacking just 3 or 4 gives you a massive pool of daily free tokens.
| Provider | Available Models | Sign Up | Best For |
|---|---|---|---|
| Gemini 2.5 Pro / Flash | Get key | Excellent general reasoning & speed | |
| Groq | Llama 3.1 / Qwen / Kimi | Get key | Ultra-fast text completions |
| Cerebras | Llama 3.3 / Qwen | Get key | Realtime generation speed |
| SambaNova | Llama 3.3 70B | Get key | High capacity Llama models |
| Mistral | Mistral Large / Codestral | Get key | Great coding capabilities |
| GitHub Models | GPT-4o / Llama / Phi | Get key | Access OpenAI and MS models free |
| NVIDIA NIM | Full NIM Catalog | Get key | Specialized model catalog |
| OpenRouter | Free-tier models | Get key | Aggregated open models |
Let's get the gateway running on your local machine.
Ensure you have Node.js 20+ and npm installed. Verify by running:
node --version # Should show v20.x or higher
npm --version # Should show 10.x or higherOpen your terminal and run the following commands to clone the source code and install dependencies:
git clone https://github.com/tashfeenahmed/freellmapi.git
cd freellmapi
npm installThe gateway encrypts your upstream API keys locally. Copy the template configuration file and generate a random 256-bit AES encryption key in your .env file:
cp .env.example .env
echo "ENCRYPTION_KEY=$(node -e "console.log(require('crypto').randomBytes(32).toString('hex'))")" >> .envRun the development command. This launches both the proxy server backend (port 3001) and the admin dashboard frontend (port 5173):
npm run devNavigate to http://localhost:5173 in your browser to access the admin console:
freellmapi-xxxxxx) from the top of the Keys page. This is the only key you will expose to your apps.Simply swap the base_url and api_key in your standard OpenAI client. Set the model to "auto" to let the proxy select the best available model, or name one explicitly:
from openai import OpenAI
client = OpenAI(
base_url="http://localhost:3001/v1",
api_key="freellmapi-your-unified-key",
)
response = client.chat.completions.create(
model="auto", # Let the proxy select from your fallback chain
messages=[{"role": "user", "content": "Explain recursion in one sentence."}],
)
print(response.choices[0].message.content)curl http://localhost:3001/v1/chat/completions \
-H "Authorization: Bearer freellmapi-your-unified-key" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"messages": [{"role": "user", "content": "Hello!"}]
}'Be realistic about what a free gateway can and cannot do for your stack.
Free tiers top out at models like Gemini 2.5 Flash/Pro and Llama 3.3 70B. You will not get access to premium models like GPT-4o or Claude 3.5 Sonnet without active subscriptions.
The proxy focuses on standard text completions. Advanced features like tool/function calling or structured output may not work consistently across all aggregated providers yet.
I use local routing tools like FreeLLMAPI when building mockups or during the initial phases of my projects. If you get stuck, let me know.