A Zero-Config, Self-Healing Free-Tier Maximizer designed for content creators and indie hackers. It runs locally or on edge functions, aggregates free-tier AI endpoints, and automatically handles failovers silently.
Note
I’m stopping active development of FreeFlowAI because OmniRoute already does this (free-tier routing + failover) exceptionally well.
I’ve been using OmniRoute for my own use case, but I’m keeping this repo public so the work can be available for everyone to fork, review, and improve.
You can run FreeFlowAI in two ways:
Deploy FreeFlowAI once (e.g., to Cloudflare Workers or Vercel Edge). All your projects, tools, and pipelines point their client SDKs to this single, shared proxy URL.
- Why it's better: Manage all your API keys in one dashboard. If rate-limits occur, all connected applications immediately share the routing/fallback cache, reducing redundant timeouts.
Copy the source code directly into your repository to package it along with your application or API routes.
To use FreeFlowAI, you need to obtain API keys for the AI providers you want to use. Here's how to get them:
- Visit Requesty AI
- Sign up or log in
- Go to API Keys section
- Create a new API key
- Add to
.envasREQUESTY_API_KEY
Free Tier Details:
- Models: xai/grok-4, various open-source models
- Base URL: https://router.requesty.ai/v1/chat/completions
- API Key Format:
rqsty-sk-...
- Visit Groq Cloud
- Sign up or log in (no credit card required for free tier)
- Go to API Keys
- Create a new API key
- Add to
.envasGROQ_API_KEY
Free Tier Details:
- Models: Llama 3.3 70B, Mixtral 8x7B, Llama 3.1 8B
- Limits: 30 requests per minute (RPM), 1,000 requests per day (RPD)
- Speed: Blazing fast inference (up to 100x faster than other free tiers)
# .env file
GROQ_API_KEY="your-groq-api-key"
GROQ_MODELS="llama3-70b-8192,mixtral-8x7b-32768,llama3-8b-8192"# .env file
GROQ_API_KEY="your-groq-api-key"
GROQ_MODELS="llama3-70b-8192"- Visit OpenRouter.ai
- Sign up or log in
- Go to API Keys
- Create a new API key
- Add to
.envasOPENROUTER_API_KEY
FreeFlowAI supports load balancing across multiple OpenRouter models using round-robin. By default, it uses a list of popular models. You can customize this list:
# .env file (comma-separated model IDs)
OPENROUTER_MODELS="meta-llama/llama-3-8b-instruct,nousresearch/hermes-2-pro-mistral-7b,mistralai/mistral-7b-instruct-v0.2,google/gemini-1.5-flash-001,anthropic/claude-3-haiku-20240307"If you only want to use one specific OpenRouter model:
# .env file
OPENROUTER_MODELS="meta-llama/llama-3-8b-instruct"OpenRouter's free tier availability may vary over time. If you encounter model not found errors, check the OpenRouter Models page for the latest available models and update your configuration accordingly.
- Visit Hugging Face
- Sign up or log in
- Go to Access Tokens
- Create a new token with "write" permissions
- Add to
.envasHF_API_KEY - Optional: Set
HF_MODEL_IDto specify a custom model (default:mistralai/Mistral-7B-Instruct-v0.2)
- Visit Google AI Studio
- Sign up or log in with your Google account
- Go to API Keys
- Create a new API key
- Add to
.envasGEMINI_API_KEY
If you want to add a custom fallback endpoint that supports the OpenAI API spec:
- Set
FALLBACK_BASE_URLto your proxy URL - Set
FALLBACK_API_KEYto your proxy's API key - Set
FALLBACK_MODELto the default model name
You can host FreeFlowAI easily across multiple platforms:
This project is optimized to run on the Edge with Cloudflare Workers.
- Deploy:
npm install -g wrangler # Install wrangler globally wrangler login # Log into your Cloudflare account # Set your API keys as secure environment variables wrangler secret put OPENROUTER_API_KEY wrangler secret put HF_API_KEY wrangler secret put GEMINI_API_KEY wrangler secret put PROXY_SECRET_TOKEN # Optional custom client auth token wrangler deploy # Deploy to Cloudflare Edge
Deploy seamlessly using the pre-configured vercel.json rewrite rules:
- Connect this repository to your Vercel dashboard.
- Set your environment variables in Vercel Project Settings:
OPENROUTER_API_KEY,HF_API_KEY,GEMINI_API_KEY,PROXY_SECRET_TOKEN
- Hit Deploy. Vercel will automatically compile it under the Edge runtime.
Build and run the container locally or push it to any cloud container service:
- Build:
docker build -t freeflow-ai-proxy . - Run:
docker run -p 8787:8787 \ -e GEMINI_API_KEY="your-key" \ -e OPENROUTER_API_KEY="your-key" \ -e HF_API_KEY="your-key" \ freeflow-ai-proxy
To run it on your own machine in the background:
- Install dependencies:
npm install
- Set up environmental keys inside
.env(copied from.env.example). - Run or build:
npm run dev # Development mode (hot reload) npm run build && npm start # Production mode
If you are pair programming with an Antigravity AI Agent, you can use the built-in skill to automatically integrate or completely remove FreeFlowAI from your codebase.
Ask your agent to trigger the freeflow-integration skill:
"Install FreeFlowAI into my project pointing to my proxy URL at https://freeflow-ai.my-subdomain.workers.dev/v1"
The agent will:
- Configure
.envor.env.localautomatically. - Scan the codebase for
new OpenAI(...)client initializations. - Automatically wrap them to point to your new proxy.
If you decide to remove it, simply tell the agent:
"Uninstall FreeFlowAI from my codebase"
The agent will run the uninstallation script, restoring all modified files back to their exact original states and cleaning up environment configurations.
Once your server is running (either locally at http://localhost:8787 or hosted on Cloudflare Workers), point any standard OpenAI SDK or HTTP client to it. The proxy ignores the requested model and cascades through the enabled free-tier models.
import OpenAI from "openai";
const openai = new OpenAI({
baseURL: "http://localhost:8787/v1", // Point to your proxy URL
apiKey: process.env.FREEFLOW_PROXY_TOKEN || "none", // Proxy authentication
});
async function main() {
const stream = await openai.chat.completions.create({
model: "gpt-4", // The proxy ignores this and uses the free tiers!
messages: [{ role: "user", content: "Hello, who are you?" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || "");
}
}
main();If a tier fails (e.g., rate limit, timeout, 503), the proxy intercepts the error and immediately attempts the next tier in the cascade. For streaming requests, if the stream disconnects mid-flight, the proxy injects an inline error message and closes the stream gracefully to prevent client crashes.