# any-llm

A Python library that provides one unified interface for calling any LLM provider, such as OpenAI, Anthropic, Azure, Mistral or Ollama, so switching providers is a one-line change rather than a code rewrite.

any-llm gives Python code a single function for calling a large language model, with the provider selected by a string in the model name rather than by importing a different client library. Switching from OpenAI to Anthropic, Azure or Microsoft Foundry, Mistral, Ollama or another supported provider needs no other code changes, and a project migrating from LiteLLM keeps its existing API keys and environment variables.

It installs with extras for just the providers a project needs, or all of them, and any OpenAI-compatible gateway or local server that is not explicitly listed can still be used through a generic custom-endpoint path rather than needing its own dedicated provider integration. It builds on each provider's official SDK for compatibility and stays framework-agnostic so it can be reused across different projects.

A separate companion project, Otari Gateway, adds budget management, API key management, usage analytics and multi-tenant support on top. any-llm is written in Python and released under the Apache-2.0 license.

Website: https://docs.mozilla.ai/any-llm
