GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - naranor/ai-revolver: AI Revolver: A smart proxy for free LLM providers

BranchesTags
Open more actions menu

Latest commit

 

History

30 Commits
30 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.idea
.idea
 
 
.interface-design
.interface-design
 
 
backend
backend
 
 
docs
docs
 
 
frontend
frontend
 
 
infra
infra
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
THIRD_PARTY_LICENSES.md
THIRD_PARTY_LICENSES.md
 
 
architecture.svg
architecture.svg
 
 
build.ps1
build.ps1
 
 
build.sh
build.sh
 
 
docker-compose.yml
docker-compose.yml
 
 

Repository files navigation

🔫 AI Revolver

A smart proxy service designed specifically for free LLM providers.

License: MIT Go Version Build Status Docker

While it was created specifically for the OpenClaw agent, it can be seamlessly used with any other AI agents.


Architecture


✨ The Killer Feature: Transparent Rate-Limit Failover

When a provider hits its rate limit, the proxy instantly and invisibly switches your agent to the next available provider. By pooling together multiple providers with free models, AI Revolver creates the effect of a single, unlimited LLM for your workflows.

🚀 Features

  • ⚡ Resilient Failover: Automatic retry on backup providers when an attempt times out or fails (per-candidate timeout defaults to 300s, up to 5 attempts).
  • 🤖 Multiple Providers: Support for OpenRouter, Groq, OpenAI, Ollama, and more.
  • 🧠 Auto Mode: Automatic model selection based on priority and availability.
  • 🛡️ Context-Aware: Upstream requests are cancelled immediately when a client disconnects.
  • 🔌 Streamable HTTP (MCP): Full support for MCP clients via the /mcp endpoint.
  • 📊 Built-in Analytics: Statistics storage in SQLite with a sleek Web UI for monitoring.
  • 🚀 High Performance: Async logging (zerolog) and DB writes with a worker pool.

📸 Web UI

Built-in React dashboard for monitoring, configuration, and live testing.

Performance

Real-time telemetry: request counts, success rate, latency, and per-model health.

Performance dashboard — global telemetry and model stats

Loadout

Manage providers, API keys, model payloads, priorities, and rate limits.

Loadout — provider and model configuration

Ballistics

Interactive chat playground with tool-use support and model probing.

Ballistics — live model testing

🛠️ Tech Stack

Category Technology Description
Backend Go 1.24+ Core proxy logic and API
Frontend React 18 Web UI for configuration and monitoring
Database SQLite Fast, local storage for statistics
Deployment Docker Multi-stage build with Nginx and Supervisor

🚦 Quick Start

Option 1: Docker (Recommended)

The fastest way to get started.

# Clone the repository
git clone https://github.com/naranor/ai-revolver.git
cd ai-revolver

# Start the service
docker-compose up -d

The Web UI will be available at http://localhost:8080, and the API at http://localhost:8080/api/v1.

Option 2: Manual Build

Prerequisites: Go 1.24+, Node.js 18+

# Build the project
./build.sh --no-test

# Run the proxy
cd build
./ai-revolver -port 8081 -latency-threshold 10000

⚙️ Configuration & Usage

The configuration is stored in data/config.json. You can edit it manually or via the Web UI.

📝 Example Configuration (config.json)
{
  "providers": [
    {
      "name": "openai",
      "api_key": "your-api-key",
      "base_url": "https://api.openai.com/v1",
      "enabled": true,
      "models": [
        {
          "name": "gpt-4o-mini",
          "max_tokens": 256000,
          "thinking": false,
          "reasoning": true,
          "tools": true
        }
      ],
      "rate_limit": 30,
      "priority": 1
    }
  ],
  "auto_mode": {
    "enabled": true,
    "fallback_strategy": "round-robin"
  },
  "max_retries": 5,
  "connect_timeout_seconds": 5,
  "response_timeout_seconds": 300,
  "warmup_enabled": true,
  "warmup_interval": 180,
  "warmup_debounce": 60
}
🔀 Model Selection Algorithm
  1. Tiered selection — candidates are ordered: Active → Degraded (high EWMA latency) → BlockedTemp (sorted by latency within each tier).
  2. Round-robin within tiers — model[0] from all providers, then model[1], etc.
  3. Last successful model priority — within the Active tier, the last successful model is tried first.
  4. Health checks — model status is updated per provider:model pair:
    • EWMA latency > threshold (default 10000 ms) → Degraded (lower priority, not blocked).
    • 5xx / network timeout → BlockedTemp after 1 failure (exponential backoff).
    • 429 / 400 / other errors → BlockedTemp for 5 minutes.
    • 401 / 404 → BlockedFatal (permanently skipped).
  5. Rate limit check — provider is skipped when current_usage >= rate_limit.
  6. Failover limit — up to max_retries attempts per request (default 5).
  7. Fallback — if all models are blocked, selects the blocked model with the lowest EWMA latency.
💻 CLI Options
Option Default Description
-port 8081 Port to listen on
-latency-threshold 10000 Latency threshold in ms to mark model as degraded (0 = disable)
-block-duration 5 Failure-tracker cleanup window in minutes (0 = disable cleanup)
-max-idle-conns 100 Maximum idle connections in pool
-max-idle-conns-per-host 20 Maximum idle connections per host (prevents blocking)
-idle-conn-timeout 90s Idle connection timeout
-stream-buffer-size 2MB Buffer size for streaming responses
-config data/config.json Path to config file
-stats data/stats.db Path to stats database
-debug false Enable debug logging
-trace false Enable trace logging for all payloads and responses

🔌 API Endpoints

Endpoint Method Description
/api/v1/chat/completions POST Proxy request to model
/mcp POST Streamable HTTP (MCP) endpoint
/api/v1/test POST Test model (probe)
/api/v1/stats GET Request statistics
/api/v1/config GET/PUT Configuration management
/health GET Health check
🤖 MCP Integration Example
# MCP exposes config/stats/ops tools; LLM traffic uses /api/v1/chat/completions
curl -X POST http://localhost:8081/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "read_stats",
      "arguments": {}
    }
  }'

🤝 Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

Please check out our Contributing Guidelines for more details.

📜 License

Distributed under the MIT License. See LICENSE for more information.

About

AI Revolver: A smart proxy for free LLM providers

Resources

Readme
MIT license

Contributing

Contributing
Activity

Stars

1 star

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.