Registry / llm-agents / any-llm-sdk

any-llm-sdk

JSON →
library1.17.0pypypi✓ verified 83d ago

The Any-LLM SDK provides a unified Python interface for interacting with various Large Language Model (LLM) providers through the Any-LLM gateway. It aims to abstract away provider-specific complexities, offering a consistent API for chat completions, embeddings, and more. The current version is 1.13.0, and it maintains a rapid release cadence with frequent updates and improvements.

pip install any-llm-sdk
INSTALL
IMPORT
SIG · ANY-LLM-SDK
A
any-llm-sdk
llm-agentspythonv1.17.0
Install
6.5s avg
Import
Disk
75MB
Pass rate
6/ 10
Env Coverage6 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.17.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✓ —
✓ 6.9s
py 3.12
✓ —
✓ 6.2s
py 3.13
✓ —
✓ 6.45s
py 3.9
✕ build_error
✕ build_error
75MB installed
● package 75MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AnyLLM
from any_llm import AnyLLM
from any_llm_sdk import Gateway
AnyLLMError
from any_llm import AnyLLMError
LLMProvider
from any_llm import LLMProvider

Initializes the Any-LLM Gateway client using environment variables for the gateway URL and API key, then sends a simple chat completion request to a specified model. The `messages` types from `any_llm_sdk.types` (re-exporting Anthropic types) are used for constructing the payload.

import os from any_llm_sdk import Gateway from any_llm_sdk.types import messages # Ensure these environment variables are set: # os.environ['ANY_LLM_GATEWAY_URL'] = 'YOUR_GATEWAY_URL' # os.environ['ANY_LLM_GATEWAY_API_KEY'] = 'YOUR_API_KEY' try: gateway = Gateway( base_url=os.environ.get('ANY_LLM_GATEWAY_URL', 'https://gateway.any-llm.ai'), api_key=os.environ.get('ANY_LLM_GATEWAY_API_KEY', '') ) messages_payload = [ messages.UserMessage(content='Hello, what is the capital of France?') ] chat_completion = gateway.chat.completions.create( model='gpt-4o', messages=messages_payload, max_tokens=100 ) print(chat_completion.choices[0].message.content) except Exception as e: print(f"An error occurred: {e}") print("Please ensure ANY_LLM_GATEWAY_URL and ANY_LLM_GATEWAY_API_KEY environment variables are set.")
Debug
Known issues
breakingAs of v1.13.0, the `anthropic` SDK is now a required dependency, similar to `openai`. Users upgrading or installing might encounter new dependency conflicts if they weren't explicitly managing `anthropic` before.
fix
Ensure `anthropic` is compatible with your environment or explicitly install `pip install any-llm-sdk anthropic`.
affects: >=1.13.0
breakingFor Anthropic provider users, v1.9.0 introduced a breaking change regarding adaptive thinking. Older models now require manual specification of the 'thinking budget' parameter, which is no longer set by default.
fix
Review Anthropic provider calls and explicitly add the 'thinking_budget' parameter if you were relying on the default behavior for older models.
affects: >=1.9.0
gotchaThe SDK relies on `ANY_LLM_GATEWAY_URL` and `ANY_LLM_GATEWAY_API_KEY` environment variables. If these are not set, the `Gateway` client will fail to initialize or authenticate, leading to `ConfigurationError` or `AuthenticationError`.
fix
Always set `ANY_LLM_GATEWAY_URL` and `ANY_LLM_GATEWAY_API_KEY` in your environment before running applications that use the SDK.
affects: All versions
gotchaWhile the SDK abstracts providers, specific models (e.g., 'gpt-4o', 'claude-3-opus-20240229') must be available via your configured Any-LLM Gateway. Using a non-existent or unsupported model will result in an API error.
fix
Verify that the model name you are using (`model='...'`) is correctly configured and available through your Any-LLM Gateway instance.
affects: All versions
Upgrade
Version history
1.17.0latest on PyPI · released Jun 5, 2026
Audit
Dependencies
openairequiredRequired for core functionality and API type compatibility.
anthropicrequiredRequired for core functionality and API type compatibility, as of v1.13.0.
Agent activity
44 hits · last 30 days
node
40
OpenAI (training)
1
Resources
any-llm-sdk — pip install any-llm-sdk · libregistry