Skip to content

Repository files navigation

FreeCodeAI Logo

FreeCodeAI

One command. 15+ free AI models. Auto-fallback. Code validation. Live execution.
Stop paying $200/month for AI coding. Every free LLM provider, one endpoint.

Cost: $0 15+ Providers 5M+ tokens/day MIT License Stars

$ freecodeai start

  ╔══════════════════════════════════════════════╗
  ║           FreeCodeAI Gateway v1.0            ║
  ║                                              ║
  ║  Endpoint: http://localhost:3377/v1          ║
  ║  Strategy: auto                              ║
  ║  Providers: 13                               ║
  ║                                              ║
  ║  Point your AI tool here. Start coding.      ║
  ╚══════════════════════════════════════════════╝

  ✅  Groq        llama-3.3-70b-versatile   healthy
  ✅  Gemini      gemini-2.0-flash          healthy
  ✅  Cerebras    llama-3.3-70b             healthy
  ✅  Mistral     mistral-small-latest      healthy
  ✅  OpenRouter  qwen3-coder:free          healthy
  ✅  SambaNova   Llama-3.1-405B            healthy
  ✅  DeepSeek    deepseek-chat             healthy
  ✅  Cohere      command-r-plus            healthy
  ○   [+ 5 more providers]


The Problem

You're coding with AI. You hit a rate limit. You switch tabs, log into another provider, paste your prompt again. Repeat 5x a day.

FreeCodeAI fixes this. One endpoint, 15+ free providers, automatic failover, zero cost.

You → FreeCodeAI (localhost:3377) → Groq → ❌ limit → Gemini → ❌ limit → Cerebras → ✅ response
                                    You never notice the switching ↑

Quick Start

npx freecodeai setup    # get API keys (interactive wizard)
npx freecodeai start    # start the gateway

Point any AI tool to http://localhost:3377/v1 and start coding. That's it.

Or with Docker:

docker run -d --env-file .env -p 3377:3377 -p 3378:3378 freecodeai/freecodeai

Works With

Tool Config
Cline Set API Base to http://localhost:3377/v1
Continue Set apiBase in config.json
Cursor Set OpenAI Base URL in settings
Copilot Use as OpenAI-compatible endpoint
Claude Code Set OPENAI_API_BASE env var
Any OpenAI SDK Point base_url to localhost:3377/v1

Features

Auto-Fallback Gateway

15+ providers behind one endpoint. Rate limit on Provider A? Silent switch to Provider B. You keep coding.

const res = await fetch("http://localhost:3377/v1/chat/completions", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "auto",
    messages: [{ role: "user", content: "Write a React hook for debounce" }]
  })
});

Code Trust & Validation

No other tool does this. Send the same prompt to 3 models, compare outputs, get the best answer with a confidence score.

freecodeai validate "Write a merge sort in Python"

# ┌─────────────┬──────────┬─────────┬────────────┐
# │ Model       │ Correct  │ Time    │ Confidence │
# ├─────────────┼──────────┼─────────┼────────────┤
# │ Gemini 2.5  │ ✅       │ 1.2s    │ 95%        │
# │ Llama 3.3   │ ✅       │ 0.4s    │ 92%        │
# │ Qwen3 Coder │ ✅       │ 0.8s    │ 97% ← Best │
# └─────────────┴──────────┴─────────┴────────────┘

Code Execution — Prove It Works

Add "execute": true to any request and FreeCodeAI will actually run the generated code and tell you if it passed or failed. JavaScript and Python supported.

const res = await fetch("http://localhost:3377/v1/chat/completions", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    model: "auto",
    execute: true,                    // ← add this
    messages: [{ role: "user", content: "Write a Python factorial function and test it" }]
  })
});

const data = await res.json();
console.log(data._execution);
// {
//   ran: true,
//   passed: true,        ← code actually executed without errors
//   language: "python",
//   durationMs: 34,
//   stdout: "120\n1",   ← real output from running the code
//   error: null
// }

The gateway also tracks each provider's pass rate over time — how often does their generated code actually run? That data feeds into routing, so the best-performing provider gets picked first.

GET http://localhost:3377/api/quality

{
  "groq":    { "requests": 42, "executions": 40, "passes": 37, "pass_rate": 93 },
  "gemini":  { "requests": 38, "executions": 35, "passes": 34, "pass_rate": 97 },
  "mistral": { "requests": 21, "executions": 19, "passes": 15, "pass_rate": 79 }
}

No other gateway does this. OmniRoute routes. FreeCodeAI routes, validates, and proves the answer works.

Live Dashboard

Real-time provider health, execution stats, and a Provider Quality table with live pass rates. Run freecodeai dashboard → opens localhost:3378.

Smart Routing

Strategy What it does
auto Priority-ordered fallback through all providers
round-robin Distributes evenly across providers
quality-first Routes by real-world pass rate — self-improving
speed-first Races all providers, returns the fastest response
validate Sends to 3 models in parallel, returns best answer

quality-first — the self-improving router

Every time you add "execute": true to a request, FreeCodeAI runs the generated code and records whether it passed or failed. After 5 executions, a provider is considered "proven" and gets ranked by its actual pass rate. Unproven providers fall back to the static priority order.

Week 1: no data → static order (gemini > mistral > groq...)
Week 2: Groq has 94% pass rate, Gemini has 87% → Groq moves to #1
Week 3: new provider added → starts unproven, earns its rank

Use it per-request or set it as your default:

// Per-request
{ "model": "quality-first", ... }

// Or as gateway default
STRATEGY=quality-first npm start

Check the current ranking anytime:

curl http://localhost:3377/api/quality

# {
#   "groq":    { "executions": 142, "passes": 134, "pass_rate": 94 },
#   "gemini":  { "executions": 98,  "passes": 85,  "pass_rate": 87 },
#   "mistral": { "executions": 61,  "passes": 48,  "pass_rate": 79 }
# }

Free Providers (No Credit Card Required)

Provider Daily Limit Speed Best Model
Google Gemini 1M TPM ⚡ Fast Gemini 2.5 Flash
Groq 1K RPD ⚡⚡ Ultra Llama 3.3 70B
Cerebras 1M tokens ⚡⚡ Ultra Llama 3.3 70B
OpenRouter 20 RPM Medium Qwen3 Coder
Mistral AI ~1B/month ⚡ Fast Mistral Small 4
GitHub Models Varies Medium Llama 3.1 8B
NVIDIA NIM 91 endpoints ⚡ Fast Nemotron-3
Cloudflare 10K neurons ⚡ Fast Llama 3.2
Cohere ~100 RPD Medium Command R+
SambaNova 200K tokens ⚡ Fast Llama 3.1 405B
HuggingFace 2K RPD Varies Many
DeepSeek 10M trial ⚡ Fast DeepSeek R1
Chutes.ai Varies Medium DeepSeek R1
Alibaba/Qwen 1M/month ⚡ Fast Qwen 3.6 Plus
OVHcloud 12 RPM Medium Qwen, Mistral

Combined: ~5M+ free tokens per day.

Configuration

# freecodeai.config.yml
port: 3377
dashboard_port: 3378
strategy: auto
validation_models: 3
fallback_timeout: 5000

See docs/configuration.md for full provider config.

Architecture

┌──────────────┐     ┌───────────────────────────────────────────┐
│   VS Code    │────▶│           FreeCodeAI Gateway               │
│   Cursor     │     │  ┌─────────┐  ┌─────────────────────────┐ │
│   Cline      │     │  │ Router  │──│ Provider Pool            │ │
│   Claude Code│     │  │         │  │ ✅ Gemini  97% pass rate │ │
└──────────────┘     │  │  auto / │  │ ✅ Groq    93% pass rate │ │
                     │  │validate │  │ ✅ Cerebras 91% pass rate│ │
                     │  └────┬────┘  └─────────────────────────┘ │
                     │       │                                    │
                     │       ▼                                    │
                     │  ┌──────────┐  ┌──────────┐               │
                     │  │Validator │  │ Executor │               │
                     │  │ 3-model  │─▶│ JS/Python│               │
                     │  │ parallel │  │ sandbox  │               │
                     │  └──────────┘  └────┬─────┘               │
                     │                     │                      │
                     │               Quality Store                │
                     │            (pass rates per provider)       │
                     │                                            │
                     │  ┌──────────────────────────────────────┐  │
                     │  │  Dashboard  localhost:3378           │  │
                     │  │  Provider health + Quality table     │  │
                     │  └──────────────────────────────────────┘  │
                     └───────────────────────────────────────────┘

Contributing

See CONTRIBUTING.md. Priority areas: new providers, routing strategies, validation heuristics, dashboard UI.

git clone https://github.com/jahanzaibkhan1/FreeCodeAI.git
cd freecodeai && npm install && npm run dev

Roadmap

  • Multi-provider gateway with auto-fallback
  • CLI setup wizard
  • Code validation across 3 models in parallel
  • Live health dashboard
  • Docker support
  • GitHub Actions CI/CD
  • MCP server for Claude Code
  • Sandboxed code execution (JS + Python)
  • Per-provider quality scoring (pass rate tracking)
  • Quality-first routing (self-improving, driven by real pass rates)
  • VS Code extension (native)
  • Auto-discovery from cheahjs/free-llm-api-resources
  • Token compression
  • Team mode (shared provider pool)

The Story

I'm a QA Automation Engineer from Pakistan. AI coding tools were transforming how fast people ship software — but the good ones cost $20–$200/month, and the free tiers ran out mid-session constantly.

I got tired of switching tabs, re-pasting prompts, losing context. Every provider has free limits. Nobody had connected them. So I spent my weekends building this.

If you're a developer who can't justify $200/month for AI tools, this is for you.

License

MIT © Muhammad Jahanzaib


Stop paying for AI coding. Start using FreeCodeAI.
Get started in 30 seconds →

About

Free OpenAI-compatible gateway — chains 15 AI providers with auto-fallback. Never hit rate limits again.

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages