Skip to main content

Free LLM Router Service based on LiteLLM

Project description

FreeRouter

🛠️ LiteLLM Configuration Management Tool - Automated Multi-Provider Configuration Generation

PyPI version License: MIT Python 3.8+

What is this?

FreeRouter is a configuration management tool for LiteLLM.

Core Features:

  • 📋 Automatically fetch model lists from Provider APIs
  • ⚙️ Generate LiteLLM config.yaml configuration files
  • 🚀 One-command startup of LiteLLM service

Important:

  • FreeRouter does not provide AI services; all APIs and routing are provided by LiteLLM
  • Recommend reading LiteLLM Documentation first
  • If you're familiar with writing LiteLLM configs manually, you may not need FreeRouter

Supported Providers

Provider Type Free
OpenRouter Text, Vision, Multimodal ✅ Partially Free
iFlow Text ✅ Fully Free
ModelScope Text ✅ Free Quota
OAI Any (OpenAI-compatible) Depends
Ollama Text, Vision ✅ Local Free
Static Any Depends

Free Providers:

Quick Start

1. Installation

pip install freerouter

Or from source:

git clone https://github.com/mmdsnb/freerouter.git
cd freerouter
pip install -e .

2. Initialize Configuration

freerouter init

3. Configure Providers

Edit .env to add API keys:

OPENROUTER_API_KEY=sk-or-v1-xxxxx
IFLOW_API_KEY=sk-xxxxx

Edit config/providers.yaml to enable services:

providers:
  # OpenRouter - Free models
  - type: openrouter
    enabled: true
    api_key: ${OPENROUTER_API_KEY}

  # iFlow - Chinese free models
  - type: iflow
    enabled: true
    api_key: ${IFLOW_API_KEY}

  # Ollama - Local models
  - type: ollama
    enabled: true
    api_base: http://localhost:11434

  # ModelScope - Chinese models (2000 calls/day free)
  - type: modelscope
    enabled: false
    api_key: ${MODELSCOPE_API_KEY}

  # OAI - Generic OpenAI-compatible API (auto-fetch models)
  - type: oai
    name: myservice
    enabled: false
    api_base: https://api.example.com/v1
    api_key: ${MYSERVICE_API_KEY}

  # Static - Custom service (single model, manual config)
  - type: static
    enabled: false
    model_name: gpt-3.5-turbo
    provider: openai
    api_base: https://your-api.com/v1
    api_key: ${YOUR_KEY}

4. Start Service

# Fetch models and start service
freerouter

# Or step by step
freerouter fetch   # Fetch model list
freerouter start   # Start service

Service will start at http://localhost:4000.

5. Use API

All API usage follows LiteLLM Documentation.

# List available models
curl http://localhost:4000/v1/models

# Call model (OpenAI-compatible API)
curl http://localhost:4000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-1234" \
  -d '{
    "model": "google/gemini-pro",
    "messages": [{"role": "user", "content": "Hello"}]
  }'

CLI Commands

freerouter              # Start service (default, auto fetch + start)
freerouter init         # Initialize config directory
freerouter fetch        # Fetch model list and generate config
freerouter start        # Start LiteLLM service (daemon mode)
freerouter stop         # Stop LiteLLM service
freerouter status       # Show service status (PID, URL, uptime, models)
freerouter reload       # Reload service (restart)
freerouter reload -r    # Reload with refresh (backup + fetch + restart)
freerouter restore <backup-file>  # Restore config from backup
freerouter restore <backup-file> -y  # Restore without confirmation
freerouter logs         # Show service logs in real-time
freerouter list         # List configured models (grouped by provider)
freerouter select       # Interactive model selector (filter config to selected models)
freerouter --version    # Show version
freerouter --help       # Show help

Config file search order:

  1. ./config/providers.yaml (current directory)
  2. ~/.config/freerouter/providers.yaml (user config)

License

MIT License - see LICENSE

Links


For issues, please visit Issues

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

freerouter-0.1.2.tar.gz (291.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

freerouter-0.1.2-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file freerouter-0.1.2.tar.gz.

File metadata

  • Download URL: freerouter-0.1.2.tar.gz
  • Upload date:
  • Size: 291.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for freerouter-0.1.2.tar.gz
Algorithm Hash digest
SHA256 022c50ca493b510f334cb2e1a522808c239630300fdd5e1d0362ef54e775f363
MD5 819edc43fabbd1f27bf1ae82fea9c6fa
BLAKE2b-256 5eb1032d302a83d3d8c07e45d43ed28c8a78299ccdf9d2a8ab8f5a61d9916f3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for freerouter-0.1.2.tar.gz:

Publisher: publish.yml on mmdsnb/freerouter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freerouter-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: freerouter-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for freerouter-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f19d8b730aa483e6efecefdbbc5f68ed3b739d0deb7be6bbc98e25657da7a03b
MD5 8c90b118efb7d67d2001098816ae7549
BLAKE2b-256 c061e314cada3fc6b1d7d3eae20368e31d102c3863210875da0a94c76c3db555

See more details on using hashes here.

Provenance

The following attestation bundles were made for freerouter-0.1.2-py3-none-any.whl:

Publisher: publish.yml on mmdsnb/freerouter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page