skillfed

any-llm-sdk

any-llm-sdk v1.25.0 157.7K downloads/30d#10,748 on PyPI2,153
Permissive license Apache-2.0 Active released

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-sdk

uv

uv add any-llm-sdk

poetry

poetry add any-llm-sdk

Installing 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

unified llm apiswitch between llm providersmulti-provider language modelopenai anthropic mistral interfacellm abstraction layerprovider-agnostic llm clientsingle interface multiple llms
llm-abstractionmulti-providerapi-wrapper

More Artificial Intelligence packages