A free multi-source GenAI orchestration library for automatic model selection and routing
Project description
OpenMux
Free Multi-Source GenAI Orchestration Library
OpenMux is a Python library that automatically selects, routes, and combines outputs from free GenAI models and API providers. It creates a unified interface for discovering, connecting, and using open-access models across the AI ecosystem โ including OpenRouter, HuggingFace, Together AI, Mistral, Ollama, LM Studio, and other publicly available sources.
๐ Quick Start
from openmux import Orchestrator, TaskType
# Initialize
orchestrator = Orchestrator()
# Process a query
response = orchestrator.process("What is Python?")
print(response)
# Process with specific task type
code_response = orchestrator.process(
"Write a fibonacci function",
task_type=TaskType.CODE
)
# Multi-model processing
combined = orchestrator.process_multi(
query="Explain quantum computing",
num_models=2,
combination_method="summarize"
)
๐ Features
-
๐ Automatic Provider Discovery
- Maintains updated list of free GenAI model providers
- Automatic metadata updates from central registry
- Focus on free and open-source endpoints
-
๐ฏ Task Auto-Classification
- Intelligent query analysis for task classification
- Supports: chat, code, TTS, audio, embeddings, image
- Lightweight local classifier with manual override options
-
โก Smart Model Selection
- Automatic model selection based on capability metadata
- Response quality tracking
- Latency and uptime monitoring
- Transparent selection reasoning
-
๐ Multi-Model Routing
- Parallel query processing across multiple models
- Configurable response combination methods
- Support for text and embeddings (multimodal planned)
-
๐พ Offline & Local Fallback
- Local model hosting support via Ollama, LM Studio
- Bundled lightweight open models
- Hardware-aware automatic mode switching
- Configurable fallback settings
๐ Project Structure
openmux/
โโโ core/ # Core orchestration
โ โโโ orchestrator.py # Main orchestrator
โ โโโ selector.py # Model selection logic
โ โโโ router.py # Query routing
โ โโโ combiner.py # Response combination
โ โโโ fallback.py # Fallback handling
โโโ providers/ # Provider implementations
โ โโโ base.py # Base provider interface
โ โโโ openrouter.py # OpenRouter integration
โ โโโ huggingface.py # HuggingFace integration
โ โโโ ollama.py # Ollama integration
โ โโโ registry.py # Provider registry
โโโ classifier/ # Task classification
โ โโโ classifier.py # Main classifier
โ โโโ task_types.py # Task type definitions
โโโ cli/ # Command-line interface
โ โโโ main.py # CLI implementation
โโโ utils/ # Utility functions
โโโ config.py # Configuration management
โโโ logging.py # Logging utilities
๐ฆ Installation
From TestPyPI (Current)
# Using pip
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ openmux
# Using uv (recommended)
UV_HTTP_TIMEOUT=300 uv pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ openmux
From PyPI (Coming Soon)
pip install openmux
# or using uv
uv pip install openmux
From Source
# Clone the repository
git clone https://github.com/mdnu838/OpenMux.git
cd OpenMux
# Create virtual environment
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install in development mode
uv pip install -e ".[dev]"
Environment Setup
-
Copy the example environment file:
cp .env.example .env
-
Add your API keys to
.env:# OpenRouter (required for online models) OPENROUTER_API_KEY=your_key_here # HuggingFace (optional) HF_TOKEN=your_token_here # Ollama (for local models) OLLAMA_URL=http://localhost:11434
-
Never commit your
.envfile! It's already in.gitignore.
๐งช Testing
# Run all tests
pytest tests/ -v
# Run unit tests only
pytest tests/unit/ -v
# Run with coverage
pytest tests/ --cov=openmux --cov-report=term-missing
# Run mock-based tests (no API keys needed)
pytest tests/unit/ tests/integration/test_orchestrator_mock.py -v
Test Status: 12/12 core tests passing (100% success rate)
๐ค Contributing
We welcome contributions! All feature changes require a branch and Pull Request.
Quick Contribution Guide
- Fork and clone the repository
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes following our code style
- Add tests for new functionality
- Run tests:
pytest tests/ -v - Format code:
black openmux/ tests/ - Create Pull Request to
mainbranch
See CONTRIBUTING.md for detailed guidelines.
Branching Strategy
main- Production-ready code (protected)mvp-alpha- Alpha testing branch (protected)feature/*- New featuresbugfix/*- Bug fixesdocs/*- Documentation updates
All PRs require:
- โ Passing CI/CD checks
- โ Code review approval
- โ โฅ90% test coverage
- โ Updated documentation
๐ Documentation
- ๐ Quick Reference - Common use cases
- ๐๏ธ Architecture - System design
- ๐งช Testing Strategy - Testing guidelines
- ๐ค Contributing Guide - How to contribute
- ๐ Development Guide - Developer setup
- ๐ฆ Publishing Guide - Release process
- ๐ Test Results - Current test status
- ๐ Project Definition - Original requirements
๐ Security
- Never commit API keys or secrets to the repository
- Use
.envfile for sensitive data (already in.gitignore) - Report security issues via GitHub Issues or contact maintainers
See SECURITY.md for more details.
๐ Project Status
Current Version: 0.1.0
Status: Alpha - Published to TestPyPI
Test Coverage: 100% (core components)
Recent Updates
- โ Published to TestPyPI
- โ Fixed packaging to include all subpackages
- โ Complete orchestration engine
- โ Mock-based integration tests
- โ Classifier fully functional
- โ GitHub Actions CI/CD workflows
- โ Comprehensive documentation
See CHANGELOG.md for detailed version history.
๐ ๏ธ Development
Quick Setup
# Clone the repository
git clone https://github.com/mdnu838/OpenMux.git
cd OpenMux
# Set up the development environment
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
# Run tests
pytest tests/ -v
Workflow
- All feature changes require a separate branch
- Create PR to
mainfor review - CI/CD automatically runs tests
- Merge to
maintriggers PyPI publish
See CONTRIBUTING.md for detailed guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
Built with:
- uv - Fast Python package manager
- pytest - Testing framework
- aiohttp - Async HTTP client
- pydantic - Data validation
- rich - Beautiful terminal output
Star โญ this repo if you find it useful!
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openmux-0.1.5.tar.gz.
File metadata
- Download URL: openmux-0.1.5.tar.gz
- Upload date:
- Size: 25.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4f98579fe8126bc407a4a9c7c1c0a56d3318893d6e9de8decc957937b410e62
|
|
| MD5 |
4a1926d8c8c3dd4a8bf0c5e2d07a00b1
|
|
| BLAKE2b-256 |
9fd0e4675d6cc9594339738aa62fa8005444b2ff8dd96112939390e717ab4f9d
|
File details
Details for the file openmux-0.1.5-py3-none-any.whl.
File metadata
- Download URL: openmux-0.1.5-py3-none-any.whl
- Upload date:
- Size: 32.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dcd8484143d4dfb7c0f377332289487bbe095bd36e678e9c7d072f918f9dbdd
|
|
| MD5 |
35d2b388262046802958a844fce855ef
|
|
| BLAKE2b-256 |
e0152207cd36b9d5c7421454aa3118f3541fc48f64ab8dbcf62c84661047f7f5
|