9router  by decolua

Universal AI router for cost-effective coding assistance

Created 3 months ago
2,224 stars

Top 19.9% on SourcePulse

GitHubView on GitHub
Project Summary

<2-3 sentences summarising what the project addresses and solves, the target audience, and the benefit.> 9Router is an open-source AI proxy designed to intelligently route requests to various AI models, prioritizing free and cost-effective tiers. It addresses the challenges of managing multiple AI subscriptions, hitting rate limits, and incurring high costs. By offering a universal, self-hostable endpoint, it enables developers and power users to ensure uninterrupted access to AI coding assistants while minimizing expenses.

How It Works

The system functions as a local HTTP proxy that translates requests between different AI provider APIs (OpenAI, Claude, Gemini) and routes them through a configurable 3-tier fallback system: premium subscriptions, cheaper paid models, and free unlimited tiers. This ensures continuous availability by automatically switching to lower-cost or free options when higher tiers are exhausted or unavailable. It also handles token refresh and multi-account load balancing.

Quick Start & Requirements

  • Installation: Install globally via npm: npm install -g 9router.
  • Prerequisites: Node.js and npm are required.
  • Configuration: Connect AI providers via a dashboard (defaulting to http://localhost:20128).
  • Links: 9Router Website, npm Package.

Highlighted Details

  • Smart 3-Tier Fallback: Seamlessly routes between Subscription, Cheap, and Free AI models.
  • Real-Time Quota Tracking: Monitors token consumption and reset countdowns for subscription maximization.
  • Universal Format Translation: Adapts requests between OpenAI, Claude, and Gemini formats.
  • Multi-Account Support: Distributes load and provides redundancy across multiple accounts per provider.
  • Custom Combos: Allows users to define unlimited model combinations for tailored fallback strategies.
  • Flexible Deployment: Supports Localhost, VPS, Docker, and Cloudflare Workers.

Maintenance & Community

The project is hosted on GitHub (github.com/decolua/9router) with an active issue tracker for support and contributions. The primary website is 9router.com.

Licensing & Compatibility

  • License: MIT License.
  • Compatibility: Designed for commercial use and integration with closed-source applications, as the MIT license is permissive. It's compatible with any CLI tool or application that supports custom OpenAI-compatible API endpoints.

Limitations & Caveats

The public cloud endpoint (https://9router.com) may return 500 errors for non-streaming requests if the upstream provider returns Server-Sent Events (SSE) data, requiring stream=true for such calls. Production deployments require changing default secrets (JWT_SECRET, INITIAL_PASSWORD) and enabling API key enforcement (REQUIRE_API_KEY) for enhanced security.

Health Check
Last Commit

1 day ago

Responsiveness

Inactive

Pull Requests (30d)
127
Issues (30d)
141
Star History
1,421 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.