any-llm-sdk
What it is and what it does
any-llm-sdk is a Python wrapper that abstracts away the differences between multiple LLM provider APIs—OpenAI, Anthropic, Mistral, Ollama, and others—into a single, consistent interface. Instead of learning and maintaining separate code paths for each provider, you call the same `completion()` function and change only the provider and model name strings to switch between them. It leverages each provider's official SDK under the hood, so compatibility is tied directly to those libraries.
The package offers two usage patterns: stateless direct functions for scripts and notebooks, and a reusable `AnyLLM` class for production applications that need connection pooling and multiple requests. It supports streaming, the OpenAI-style Responses API, and tool calling where providers implement them. The main dependencies are pydantic, openai, anthropic, rich, httpx, and typing_extensions, making it lightweight for a multi-provider abstraction.
Use it for:
- Switch LLM providers in production without rewriting application code—useful when costs, availability, or performance favor a different provider.
- Build multi-provider fallback logic: try one provider, fall back to another if it fails or is unavailable.
- Prototype and experiment with different LLM models and providers in notebooks without changing imports.
- Migrate from LiteLLM to a library that uses official SDKs directly, preserving existing API keys and environment variables.
- Support multiple LLM backends in a single application, letting users or deployments choose their preferred provider.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides a unified Python interface to communicate with multiple LLM providers (OpenAI, Anthropic, Mistral, Ollama, and others) using a single API, letting you switch providers by changing a string parameter.
Yes. The package is actively maintained, has no known vulnerabilities, uses official provider SDKs for compatibility, and solves a real pain point for multi-provider LLM applications. Low install friction and permissive licensing make it a straightforward addition. Install it if you need to support multiple LLM providers or want the flexibility to switch between them without code changes.
Install
any-llm-sdk on PyPI
pip
pip install any-llm-sdkuv
uv add any-llm-sdkpoetry
poetry add any-llm-sdkInstalling any-llm-sdk
Before you install
Low install friction with a pure-Python wheel and seven runtime dependencies. Active maintenance with a release 3 days old and 2153 repository stars. Requires Python 3.11 or newer.
License in practice
Licensed under Apache-2.0 (permissive), allowing commercial and private use with minimal restrictions; you must include a copy of the license and note any modifications.
Quickstart
pip install 'any-llm-sdk[mistral]'
from any_llm import completion
import os
os.environ['MISTRAL_API_KEY'] = 'your-key'
response = completion(
model='mistral-small-latest',
provider='mistral',
messages=[{'role': 'user', 'content': 'Hello!'}]
)
print(response.choices[0].message.content)
Python 3.11 or newer required; API keys for chosen providers must be set as environment variables or passed directly.
Verify before relying
- Whether all listed providers (Azure/Microsoft Foundry, Mistral, Ollama, etc.) are equally well-maintained and tested.
- Performance characteristics and latency overhead of the unified interface compared to direct provider SDKs.
- Streaming and tool-use feature parity across all supported providers.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 7 — pydantic, openai, openresponses-types, anthropic, rich, httpx, typing_extensions |
| Maintenance | actively maintained — 3 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 157,653/month — #10,748 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: any_llm_sdk-1.25.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
litellm-enterpriseLiteLLM Enterprise provides a unified Python…
unclear · top 5,000 on PyPI
chatlasChatlas provides a unified Python interface for…
permissive · top 15,000 on PyPI
unclecode-litellmUnified Python interface to call many LLM…
permissive · top 5,000 on PyPI
llama-index-llms-litellmIntegrates LiteLLM with LlamaIndex to provide…
permissive · top 15,000 on PyPI
genai-pricesCalculates pricing for LLM API calls across…
permissive · top 1,000 on PyPI
openrouterA Python SDK for accessing 400+ AI models…
permissive · top 5,000 on PyPI
astra-assistantsWraps OpenAI's Assistants API as a drop-in…
unclear · top 15,000 on PyPI
anthropicProvides Python bindings to the Claude API,…
permissive · top 1,000 on PyPI
fhlmifhlmi provides a unified async Python interface…
permissive · top 15,000 on PyPI