Skip to main content

Lightweight LLM API Orchestrator - A fast, multi-provider LLM client with rate limiting and key rotation

Project description

LLMAO Logo

LLMAO

Lightweight LLM API Orchestrator

One interface for all your LLM APIs, fast and simple

Python Rust License CI


A unified Python interface for multiple LLM providers with automatic key rotation and rate limit handling. Built with Rust core for performance.

Installation

pip install llmao-py

Quick Start

from llmao import LLMClient

client = LLMClient()

response = client.completion(
    model="groq/llama-3.1-70b-versatile",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response["choices"][0]["message"]["content"])

Model Format

Use provider/model routing:

# OpenAI
client.completion(model="openai/gpt-4o", messages=[...])

# Anthropic
client.completion(model="anthropic/claude-3-5-sonnet-20241022", messages=[...])

# Groq
client.completion(model="groq/llama-3.3-70b-versatile", messages=[...])

# Cerebras
client.completion(model="cerebras/llama3.1-70b", messages=[...])

Supported Providers

View all providers
Provider Environment Variable
OpenAI OPENAI_API_KEY
Anthropic ANTHROPIC_API_KEY
Groq GROQ_API_KEY
Cerebras CEREBRAS_API_KEY
Together TOGETHER_API_KEY
OpenRouter OPENROUTER_API_KEY
DeepSeek DEEPSEEK_API_KEY
Mistral MISTRAL_API_KEY
Fireworks FIREWORKS_API_KEY
Perplexity PERPLEXITY_API_KEY
SambaNova SAMBANOVA_API_KEY
NVIDIA NVIDIA_API_KEY
Hyperbolic HYPERBOLIC_API_KEY
DeepInfra DEEPINFRA_API_KEY
Novita NOVITA_API_KEY
Xiaomi MiMo XIAOMI_MIMO_API_KEY
Venice AI VENICE_AI_API_KEY
GLHF GLHF_API_KEY
Lepton LEPTON_API_KEY
Anyscale ANYSCALE_API_KEY
Ollama OLLAMA_API_KEY
LM Studio LMSTUDIO_API_KEY

Key Rotation

Automatic failover when rate limited. Configure multiple keys in your config.json:

{
  "openai/gpt-4": {
    "keys": ["sk-key1", "sk-key2", "sk-key3"],
    "rotation_strategy": "round_robin"
  }
}

Or use environment variables (suffix with _2, _3, etc.):

export OPENAI_API_KEY="sk-key1"
export OPENAI_API_KEY_2="sk-key2"
export OPENAI_API_KEY_3="sk-key3"

Configuration

LLMAO supports multiple configuration methods. See the examples/ directory for complete, runnable code for each scenario.

Contributing Providers

Want to add a new provider to LLMAO's built-in registry?

The registry.json file contains provider metadata (base URLs, default headers, etc.). Fork the repository, add your provider, and submit a pull request:

{
  "your_provider": {
    "base_url": "https://api.yourprovider.com/v1",
    "api_key_env": "YOUR_PROVIDER_API_KEY"
  }
}

Once merged, all users can use your provider without specifying base_url!

API Reference

from llmao import LLMClient, completion

# Client-based
client = LLMClient(config_path="./config.json")
client.completion(model, messages, temperature=0.7, max_tokens=100)
client.providers()  # List available providers
client.provider_info("openai")  # Get provider details

# Quick function
completion(model, messages, **kwargs)

Development

# Build from source
pip install maturin
maturin develop

# Run tests
cargo test

License

MIT

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

llmao_py-0.0.1.tar.gz (45.9 kB view details)

Uploaded Source

Built Distributions

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

llmao_py-0.0.1-cp39-abi3-win_amd64.whl (1.7 MB view details)

Uploaded CPython 3.9+Windows x86-64

llmao_py-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ x86-64

llmao_py-0.0.1-cp39-abi3-macosx_11_0_arm64.whl (1.6 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

llmao_py-0.0.1-cp39-abi3-macosx_10_12_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9+macOS 10.12+ x86-64

File details

Details for the file llmao_py-0.0.1.tar.gz.

File metadata

  • Download URL: llmao_py-0.0.1.tar.gz
  • Upload date:
  • Size: 45.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for llmao_py-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9fa2b5f072af00049c9723ff56527e45c2858325a608c7255b5537a78356523a
MD5 d11d31acde2deaaacf0b8e265ec9dcb5
BLAKE2b-256 d14d2da408af4a212739ecde31d174b0e67b396c7125d060c419005fe561e954

See more details on using hashes here.

File details

Details for the file llmao_py-0.0.1-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: llmao_py-0.0.1-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for llmao_py-0.0.1-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2f428959f4d0e181647759c36c55604e787aeebb25da8694812b8519c73ea3dd
MD5 1422ae4df99256baba6d76614a51ae91
BLAKE2b-256 82f77c74973bdb9d9ec74bdf8d53d339ed7ae4f3d54fb2f36a74766b5d3f9f35

See more details on using hashes here.

File details

Details for the file llmao_py-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for llmao_py-0.0.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 07c8a5fbaec4126a08e05a9b27e9eb2f0e867b9bc32ee7c27fd860c6a659dc87
MD5 3461cca82f9b8abc42441039f166705c
BLAKE2b-256 a66b4b1feb9ab0c9891128d1189a14e36602ac10e62d028ca1652a781e0bf414

See more details on using hashes here.

File details

Details for the file llmao_py-0.0.1-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for llmao_py-0.0.1-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ccad7edfc1cd773c9ec188ef3933d265103c47a36267b37dc43b04e9ceedd69c
MD5 92245615f786f5feff1db4229107f172
BLAKE2b-256 afb996fa5ae5f11e17e361db3111e6fbeafdc0500a4189b1f5e7ce239b6e9c67

See more details on using hashes here.

File details

Details for the file llmao_py-0.0.1-cp39-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for llmao_py-0.0.1-cp39-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3f380da5e57615e6b24691682db92acac22eb80ba1a45d393329487eecdf2f6e
MD5 88510ac197edd7e30a0b728f27aee218
BLAKE2b-256 46a1e9548c94bdce6fd2016333793300e93244471d8b546692f2cfeeb4a44cb6

See more details on using hashes here.

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