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
orchestrator = Orchestrator()
response = orchestrator.process("What is Python?")
print(response)
code_response = orchestrator.process(
"Write a fibonacci function",
task_type=TaskType.CODE
)
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)
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ openmux
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
uv pip install openmux
From Source
git clone https://github.com/mdnu838/OpenMux.git
cd OpenMux
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
Environment Setup
-
Copy the example environment file:
cp .env.example .env
-
Add your API keys to .env:
OPENROUTER_API_KEY=your_key_here
HF_TOKEN=your_token_here
OLLAMA_URL=http://localhost:11434
-
Never commit your .env file! It's already in .gitignore.
🧪 Testing
pytest tests/ -v
pytest tests/unit/ -v
pytest tests/ --cov=openmux --cov-report=term-missing
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
main branch
See CONTRIBUTING.md for detailed guidelines.
Branching Strategy
main - Production-ready code (protected)
mvp-alpha - Alpha testing branch (protected)
feature/* - New features
bugfix/* - Bug fixes
docs/* - Documentation updates
All PRs require:
- ✅ Passing CI/CD checks
- ✅ Code review approval
- ✅ ≥90% test coverage
- ✅ Updated documentation
📖 Documentation
🔒 Security
- Never commit API keys or secrets to the repository
- Use
.env file 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
git clone https://github.com/mdnu838/OpenMux.git
cd OpenMux
uv venv
source .venv/bin/activate
uv pip install -e ".[dev]"
pytest tests/ -v
Workflow
- All feature changes require a separate branch
- Create PR to
main for review
- CI/CD automatically runs tests
- Merge to
main triggers 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!