Catalog PyPI
PACKAGE EXPLORERView in registry

ai-llm-router

PyPI

Intelligent routing of LLM API calls across multiple providers with automatic fallbacks, cost optimization, and monitoring

aianthropicapicost-optimizationfallbackllmopenairouter
Versions collected1
Direct dependencies17From release 0.1.0
Last observed21 Oct, 11:11 UTC

README

Version 0.1.0 documentation

AI LLM Router

Intelligent routing of LLM API calls across multiple providers with automatic fallbacks, cost optimization, caching, health monitoring, and retry logic.

Features

  • Multi-Provider Support: OpenAI, Anthropic, and extensible for other providers
  • Intelligent Routing: Priority-based, cost-optimized, and round-robin strategies
  • Automatic Fallbacks: Seamless failover between providers
  • Cost Optimization: Track and optimize API usage costs
  • Caching: Redis-based response caching for improved performance
  • Health Monitoring: Real-time provider health checks
  • Retry Logic: Configurable retry mechanisms with exponential backoff
  • Async Support: Full async/await support for high-performance applications
  • Streaming: Support for streaming responses
  • CLI Interface: Command-line tool for easy integration
  • Metrics: Prometheus-compatible metrics collection

Installation

pip install ai-llm-router

Quick Start

from llm_router import LLMRouter, RouterConfig
from llm_router.providers import OpenAIProvider, AnthropicProvider

# Configure providers
config = RouterConfig(
    providers=[
        OpenAIProvider(api_key="your-openai-key"),
        AnthropicProvider(api_key="your-anthropic-key")
    ],
    strategy="priority"
)

# Create router
router = LLMRouter(config)

# Make a request
response = await router.chat_completion(
    messages=[{"role": "user", "content": "Hello, world!"}],
    model="gpt-4"
)

CLI Usage

After installation, you can use the CLI:

ai-llm-router chat --provider openai --model gpt-4 --message "Hello, world!"

Documentation

For detailed documentation, examples, and API reference, visit our GitHub repository.

Author

Sherin Joseph - LinkedIn

License

MIT License - see LICENSE file for details.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.030 Jun 202517

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
llm-router/llm-router

Shared repository data · GitHub

License detected in repository
Not collected

Repository

PENDING
sherin-sef-ai/llm-router

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:11 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:16a9781fde63d50b2aa2f9c2c900b88bf7742c4712c6765c396ff4f7805b3ad8