multi-llm-provider
Unified multi-provider LLM interface supporting Claude, OpenAI, Mistral, Ollama, and Clipboard.
Installation
pip install multi-llm-provider
Optional providers
Install only the providers you need:
pip install multi-llm-provider[claude] # Anthropic Claude
pip install multi-llm-provider[openai] # OpenAI GPT
pip install multi-llm-provider[mistral] # Mistral AI
pip install multi-llm-provider[ollama] # Ollama (local)
pip install multi-llm-provider[all] # All providers
Quick start
from multi_llm_provider import AIProvider, AIProviderFactory
# Create an analyzer for Claude
analyzer = AIProviderFactory.create(
provider=AIProvider.CLAUDE_API,
model="claude-sonnet-4-20250514",
system_prompt="You are a helpful assistant.",
)
# Analyze content
result = analyzer.analyze("Explain quantum computing in simple terms.")
print(result)
Supported providers
| Provider | Enum value | Required extra |
|---|---|---|
| Anthropic Claude | AIProvider.CLAUDE_API |
claude |
| OpenAI GPT | AIProvider.OPENAI_API |
openai |
| Mistral AI | AIProvider.MISTRAL_API |
mistral |
| Ollama (local) | AIProvider.OLLAMA |
ollama |
| Clipboard (manual) | AIProvider.CLIPBOARD |
none |
Architecture
All providers implement the AIAnalyzer abstract base class:
from multi_llm_provider import AIAnalyzer
class AIAnalyzer(ABC):
@abstractmethod
def analyze(self, content: str) -> str:
"""Send content to the LLM and return the response."""
...
The AIProviderFactory creates the appropriate analyzer based on the provider enum:
analyzer = AIProviderFactory.create(
provider=AIProvider.OPENAI_API,
model="gpt-4o",
system_prompt="You are a data analyst.",
temperature=0.7,
max_tokens=4096,
)
Clipboard provider
The ClipboardAnalyzer copies content to the system clipboard with instructions,
then waits for the user to paste the LLM response back. Useful for manual workflows
or when API access is not available.
Error handling
from multi_llm_provider import ConfigError, WorkflowError
try:
result = analyzer.analyze("some content")
except WorkflowError as e:
print(f"LLM call failed: {e}")
except ConfigError as e:
print(f"Configuration error: {e}")
Development
git clone https://github.com/stephanejouve/multi-llm-provider.git
cd multi-llm-provider
poetry install --with dev,extras
poetry run pytest tests/ -v
poetry run black src/ tests/ --check --line-length=100
poetry run ruff check src/
poetry run isort src/ tests/ --check-only --profile black --line-length=100
License
MIT
Metadata
Release files for multi-llm-provider 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| multi_llm_provider-0.1.0.tar.gz | 11.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| multi_llm_provider-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.4 kB
Release files / multi_llm_provider-0.1.0.tar.gz
| Download URL | multi_llm_provider-0.1.0.tar.gz |
|---|---|
| Size | 11.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02d645b2bcdc88be06141e5302b9ab0445242e3b7dda8e7b917101adb4c5f33e
|
|
BLAKE2b-256 checksum How to use checksums |
57803d79e4fd8c46de643f4d0018f7a8d87a90a675d54fec57c0522eb0956fd0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.11 Darwin/20.6.0
|
Release files / multi_llm_provider-0.1.0-py3-none-any.whl
| Download URL | multi_llm_provider-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9b2185ec0a30e5ad45388da73f76f9251927035795b0194c017c334623d35bb
|
|
BLAKE2b-256 checksum How to use checksums |
22b5cb752acd6c563df9b02346fa9d15a94646783bcf0f12515d5a612ae75f19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.13.11 Darwin/20.6.0
|
Security for multi-llm-provider 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.