MonoLLM Documentation

MonoLLM is a unified Python framework for accessing multiple Large Language Model providers through a single, consistent interface. It simplifies LLM integration by abstracting away provider-specific differences while maintaining full access to advanced features.

Note

MonoLLM v0.1.2 introduces comprehensive testing utilities, improved reasoning model support, and enhanced provider compatibility.

Key Features

Unified Interface

Access OpenAI, Anthropic, Google, Qwen, DeepSeek, and other providers through one API

Advanced Capabilities
  • Streaming responses for real-time interaction

  • Reasoning models with thinking steps (QwQ, o1, DeepSeek R1)

  • Multi-turn conversations with context management

  • Automatic model capability detection

Developer Experience
  • Type-safe async/await API

  • Comprehensive error handling

  • Flexible configuration management

  • Built-in retry mechanisms and rate limiting

Production Ready
  • Proxy support for enterprise environments

  • Token usage tracking and cost management

  • Extensive logging and monitoring

  • Comprehensive test suite

Quick Start

Installation

Install MonoLLM using pip:

pip install monollm

Or from source:

git clone https://github.com/cyborgoat/MonoLLM.git
cd MonoLLM
pip install -e .

Basic Usage

import asyncio
from monollm import UnifiedLLMClient, RequestConfig

async def main():
    async with UnifiedLLMClient() as client:
        config = RequestConfig(model="gpt-4o", temperature=0.7)
        response = await client.generate("Explain quantum computing", config)
        print(response.content)

asyncio.run(main())

Configuration

Set up your API keys:

export OPENAI_API_KEY="your-openai-key"
export ANTHROPIC_API_KEY="your-anthropic-key"
export DASHSCOPE_API_KEY="your-qwen-key"
export DEEPSEEK_API_KEY="your-deepseek-key"

Supported Providers

Provider

Models

Special Features

Status

OpenAI

GPT-4o, GPT-4o-mini, o1, o1-mini

Reasoning models, MCP

✓ Full support

Anthropic

Claude 3.5 Sonnet, Claude 3.5 Haiku

MCP integration

✓ Full support

Qwen/DashScope

QwQ-32B, Qwen3 series

Thinking steps, Chinese

✓ Full support

DeepSeek

DeepSeek V3, DeepSeek R1

Code reasoning

✓ Full support

Google

Gemini 2.0 Flash, Gemini 2.5 Pro

Multimodal (planned)

✓ Basic support

Volcengine

Doubao models

Enterprise features

✓ Basic support

Documentation Sections

Getting Help

License

MonoLLM is released under the MIT License. See the LICENSE file for details.

Indices and Tables