Skip to main content
Glama
Infinite LLM Auto-Fallback Router

Infinite LLM Auto-Fallback Router

⚡ Infinite LLM Auto-Fallback Router — Stdio MCP Server, SSE Failover Proxy & 9Router Patch Kit (v2.2.0)

Zero-dependency Model Context Protocol (MCP) Server and multi-provider SSE auto-fallback proxy. Chain OpenAI, Anthropic (/v1/messages), Gemini, Groq, and OpenRouter into one uninterrupted local endpoint and expose failover diagnostics directly as MCP tools.

Authored by Scientist HM Shihabuddin Jashory (Shihab) (ORCID: 0009-0003-4163-0092) · Research & Evaluation Ecosystem with MD Rafiul Islam Shubho (Researcher, AI Evaluator & RLHF Specialist) — Vision Flow Group (TechBehemoths #101215) · Research Hub · Tools Hub · Studio


🔌 Model Context Protocol (MCP) Server

infinite-llm-fallback-router runs natively as a JSON-RPC 2.0 stdio MCP server (python3 -u llm_fallback_router.py --mcp or via Dockerfile) with zero external runtime dependencies (100% Python 3.9+ standard library).

Exposed MCP Tools

MCP Tool

Arguments

Purpose

list_provider_pool

{}

Inspects configured LLM failover providers, credential readiness, cooldown timers, and failover counters.

convert_anthropic_to_openai

messages (required), model, system, max_tokens, stream

Converts Anthropic /v1/messages payloads into OpenAI-compatible /v1/chat/completions payloads.

route_chat_completion

messages (required), model, max_tokens

Routes a chat completion request across the configured provider pool with automatic circuit-breaker failover on HTTP 429/402/5xx.

check_router_health

{}

Returns live circuit-breaker readiness diagnostics and provider pool health counters.

MCP Client Configuration (claude_desktop_config.json, Cursor, Kiro, Windsurf)

{
  "mcpServers": {
    "infinite-llm-fallback-router": {
      "command": "python3",
      "args": ["-u", "/path/to/llm_fallback_router.py", "--mcp"]
    }
  }
}

Run the MCP Server via Docker (Stdio)

docker build -t infinite-llm-fallback-router .
docker run -i --rm -e OPENAI_API_KEY="$OPENAI_API_KEY" infinite-llm-fallback-router

Related MCP server: MCP-AI-Gateway

⚡ 1. Install via AI Agent (Claude Code, Antigravity, Cursor, Codex)

Paste this single prompt into your AI coding agent:

Prompt: Clone https://github.com/jashory/infinite-llm-fallback-router and run "python install.py" to install the MCP server, local LLM fallback router, and Agent Skill.

💻 2. Install via CLI (Terminal / Skills CLI / pip)

# Option A: Agent Skills CLI
npx skills add jashory/infinite-llm-fallback-router

# Option B: Direct Git Clone + 1-Command Installer
git clone https://github.com/jashory/infinite-llm-fallback-router.git
cd infinite-llm-fallback-router && python install.py

# Option C: Global CLI Tool & MCP Server via pip / uv
pip install infinite-llm-fallback-router
# Or directly from GitHub:
pip install git+https://github.com/jashory/infinite-llm-fallback-router.git

# Run HTTP/SSE auto-fallback proxy:
llm-fallback-router --port 20128

# Run deterministic loopback failover & bridge self-test:
llm-fallback-router --self-test

# Start the stdio JSON-RPC 2.0 MCP server:
llm-fallback-router --mcp

🔥 Features

  1. Stdio JSON-RPC 2.0 MCP Server (--mcp):

    • Exposes list_provider_pool, convert_anthropic_to_openai, route_chat_completion, and check_router_health over standard MCP stdio transport (Dockerfile + glama.json + server.json included).

  2. Multi-Threaded SSE Streaming & Non-Streaming Proxy (llm_fallback_router.py):

    • Zero external dependencies (100% Python Standard Library).

    • Supports both stream: true (text/event-stream) and standard JSON responses.

    • Automatic failover on HTTP 429, 402, 500, 502, 503, 504, or connection timeouts with configurable per-provider cooldown timers.

  3. Built-In Anthropic /v1/messages <-> OpenAI /v1/chat/completions Bridge:

    • Point Claude Code (ANTHROPIC_BASE_URL=http://127.0.0.1:20128) directly at the router and seamlessly fail over to OpenAI/Gemini/Groq/OpenRouter providers when quota runs out.

  4. Production 9Router Custom Patch Modules (9router-patches/):

    • Includes ag-model-routing.cjs and quota-normalization.cjs for advanced 9Router setups.

GitHub Actions Integration (action.yml)

Use infinite-llm-fallback-router directly inside any CI/CD workflow:

- name: Run infinite-llm-fallback-router self-test
  uses: jashory/infinite-llm-fallback-router@v2.2.0
  with:
    args: '--self-test'

Live Interactive Browser Playground

Test payloads directly in your browser (100% client-side, zero installation required): https://jashory.github.io/infinite-llm-fallback-router/


Ecosystem Authority, Category Benchmarks & Primary-Source Verification

Available Tools

4 tools
check_router_healthA

Return circuit-breaker health diagnostics, provider pool readiness, and failover counters.

Inputs: no named parameters.

convert_anthropic_to_openaiA

Translate an Anthropic /v1/messages request payload into an OpenAI-compatible /v1/chat/completions payload.

Inputs: messages (required), model, stream, system, +1 more.

list_provider_poolA

Inspect configured LLM failover providers, credential readiness, active circuit-breaker cooldowns, and routing stats.

Inputs: no named parameters.

route_chat_completionB

Route a chat completion request across the configured provider pool with automatic HTTP 429/402/5xx failover.

Inputs: messages (required), model, max_tokens.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 4 tools

    Disambiguation2/5

    list_provider_pool and check_router_health substantially overlap: both return provider pool readiness and circuit-breaker state, with only 'routing stats' vs 'failover counters' distinguishing them. An agent cannot easily predict which one to call for a given diagnostic question.

    Naming Consistency4/5

    All names are snake_case and verb-led (list_, convert_, route_, check_), giving a predictable pattern. convert_anthropic_to_openai is a slightly longer verb_object_form variant but remains readable and consistent in style.

    Tool Count5/5

    Four tools is well-scoped for a routing/failover service: inspect, translate, route, and health-check each map to a real step. No obviously filler tools.

    Completeness3/5

    Core routing and inspection are covered, but there are no tools to configure the provider pool (add/remove providers, set credentials) or to reset an open circuit breaker — common operational needs for a failover router that agents would hit as dead ends.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A dual-transport MCP server that exposes your API as tools to LLM clients, supporting both stdio transport for local clients like Claude Desktop and HTTP/SSE transport for remote clients like OpenAI's Responses API.
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      Unified local MCP AI Gateway that routes across Groq, OpenRouter, Mistral, and local Ollama providers, with OpenAI-compatible APIs, MCP tools, fallback/racing router, monitoring, and web dashboard.
      -
    • A
      license
      A
      quality
      B
      maintenance
      Model Context Protocol (MCP) stdio server built with the official MCP Python SDK (FastMCP). Exposes 3 MCP tools: package_capability, generate_dockerfile, generate_claude_desktop_config — package AIMarket capabilities as Docker images + MCP manifest + Claude Desktop config. Entrypoint: mcp_stdio_server.py; root Dockerfile + glama.json in repo.
      3
      2
      MIT