Skip to content

About

Open-source, self-hosted BYOK LLM API router with an OpenAI-compatible interface, multi-provider failover, model aliases, circuit breakers, usage analytics, and secure key management.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

10 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Free LLM Router πŸš€

License: MIT Node.js Version TypeScript

Bring your own LLM API keys and route OpenAI Chat Completions, OpenAI Responses/Codex, and Claude Code through one gateway with a beautiful, self-hosted dashboard.

Free LLM Router handles provider failover, request deduplication, analytics, rate-limit cooldowns, and moreβ€”making it easier, cheaper, and more reliable to use AI in your applications.

Feature Showcase

πŸ“– What is this product?

Imagine you have several different AI assistants (like different brands of smart speakers or chat apps) that you pay for separately. Each one has its own strengthsβ€”some are fast, some are cheap, some are good at specific tasks like coding or understanding images.

Free LLM Router is like a smart switchboard that lets you use ALL of these AI assistants through ONE simple connection, without having to manage each service separately.

How it works

  1. You sign in once β€” Log into the dashboard with your Clerk account.
  2. You add cloud keys or pair Ollama β€” Connect hosted AI services, private models on a computer you control, or both.
  3. You get one master key β€” The system gives you a special code (starting with flm_) that you use in your apps.
  4. Your apps talk to the router β€” Instead of your app talking directly to each AI service, it talks to this router.
  5. The router chooses the best AI β€” Behind the scenes, it picks an eligible cloud or local model based on capabilities, policy, speed, availability, health, quotas, and local routing gates.

✨ Key Features

  • One Connection, Many AIs: Talk to OpenRouter, Groq, Anthropic, OpenAI, DeepSeek, Together AI, and more through one simple API.
  • Automatic Failover & Circuit Breakers: If an AI service is having issues, the router silently switches to another one.
  • Rate-Limit & Quota Protection: Automatically honors Retry-After headers and tracks your free-tier limits to avoid unexpected charges.
  • Request Deduplication: Coalesces identical in-flight requests and briefly reuses successful responses, saving provider quota.
  • Model Aliases & Capabilities: Create virtual models (like vision-router) that only route to providers with specific capabilities.
  • Comprehensive Dashboard: Manage cloud and local providers with matching card flows, test routed, exact cloud, or exact Local LLM prompts in the Playground, and inspect detailed request analytics and performance timings.
  • Full Compatibility: Works out of the box as an OpenAI-compatible endpoint, Codex CLI gateway, and Claude Code gateway.
  • Private Local Ollama Nodes: Pair Ollama through a protected loopback agent and ngrok tunnel, inspect connections in Providers, manage routing gates, limits, lifecycle, and model capabilities under Settings β†’ Router & Policies β†’ Local LLM Properties, and test exact local models in the Playground.

πŸš€ Getting Started

Prerequisites

1. Installation

git clone https://github.com/Pr0fess0rOP/free-llm-router.git
cd free-llm-router
npm install

2. Configuration

Create a .env file in the root directory:

# Required for Clerk authentication
CLERK_SECRET_KEY=sk_test_your_clerk_secret_key
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_your_clerk_publishable_key

# Recommended when deployed behind Vercel, a reverse proxy, or a custom domain
CLERK_AUTHORIZED_PARTIES=https://your-dashboard.example.com

# Strongly recommended for production (encrypts stored API keys)
# Generate with: openssl rand -base64 32 | tr '+/' '-_' | tr -d '='
ACCOUNT_ENCRYPTION_KEY=your_32_byte_base64url_secret

3. Start the Server

npm run dev

The dashboard will start at http://localhost:8787.

4. Create a Router & Connect Models

  1. Open http://localhost:8787 and sign in.
  2. Create your first router to generate your flm_... router key.
  3. Go to the Providers page and add your API keys for services like Groq or OpenRouter.
  4. Optionally open Providers β†’ Local LLMs and pair an Ollama computer.
  5. Head to the Playground to test a routed request, exact hosted model, or exact Local LLM immediately.

For detailed setup instructions, see Getting Started.

To connect Ollama running on your own computer, see Connect a private Ollama node.


πŸ“š Documentation

Detailed documentation has been moved to the docs/ folder to keep this README concise:


🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines to learn how to get started, run tests, and submit pull requests.

πŸ›‘οΈ Security

Please review our Security Policy for information on reporting vulnerabilities and our security practices.

πŸ’¬ Support & Community


πŸ“„ License

This project is licensed under the MIT License.

About

Open-source, self-hosted BYOK LLM API router with an OpenAI-compatible interface, multi-provider failover, model aliases, circuit breakers, usage analytics, and secure key management.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

10 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages