Anthropic provider for lmux
Project description
lmux-anthropic
Anthropic provider for lmux. Wraps the anthropic SDK.
Supports chat completions and streaming.
Part of the lmux ecosystem: standardized interface, cost tracking on every response, and registry-based routing across providers.
Auth
Set ANTHROPIC_API_KEY in your environment. The default AnthropicEnvAuthProvider reads it automatically.
from lmux_anthropic import AnthropicProvider
provider = AnthropicProvider()
Usage
Chat
from lmux import UserMessage
response = provider.chat("claude-sonnet-4-20250514", [UserMessage(content="Hello")])
print(response.content)
print(response.cost)
Streaming
for chunk in provider.chat_stream("claude-sonnet-4-20250514", [UserMessage(content="Hello")]):
if chunk.delta:
print(chunk.delta, end="")
Async
All methods have async variants: achat, achat_stream.
Registry
Use with the lmux registry to route across multiple providers:
from lmux import Registry
registry = Registry()
registry.register("anthropic", provider)
response = registry.chat("anthropic/claude-sonnet-4-20250514", messages)
Provider Params
from lmux_anthropic import AnthropicParams
response = provider.chat(
"claude-sonnet-4-20250514",
messages,
provider_params=AnthropicParams(inference_geo="us"),
)
| Parameter | Type | Description |
|---|---|---|
thinking |
dict |
Extended thinking configuration |
metadata |
dict[str, str] |
Request metadata |
top_k |
int |
Top-k sampling |
service_tier |
"auto" | "standard_only" |
Service tier selection |
inference_geo |
"us" |
Inference geography (affects cost) |
Constructor Options
AnthropicProvider(
auth=..., # AuthProvider[str], default: AnthropicEnvAuthProvider()
base_url=..., # Optional base URL override
timeout=..., # Request timeout in seconds
max_retries=..., # Max retry attempts
default_max_tokens=..., # Default max tokens (default: 4096)
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lmux_anthropic-0.4.0.tar.gz.
File metadata
- Download URL: lmux_anthropic-0.4.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
beb9f1870218e9bb8aa967be4106b7ff804a7216e1ded58a922a9f757852fa5e
|
|
| MD5 |
9db557a151453595a5ed69bfb955144c
|
|
| BLAKE2b-256 |
f0a51b0b1b4ce6cf70eecd27432f49c1e3c9b26c2067b009d085176489569d3b
|
Provenance
The following attestation bundles were made for lmux_anthropic-0.4.0.tar.gz:
Publisher:
publish.yml on cluebbehusen/lmux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lmux_anthropic-0.4.0.tar.gz -
Subject digest:
beb9f1870218e9bb8aa967be4106b7ff804a7216e1ded58a922a9f757852fa5e - Sigstore transparency entry: 1245340227
- Sigstore integration time:
-
Permalink:
cluebbehusen/lmux@7b16cd678e57ff68f40dd70dba8425a10fbec7df -
Branch / Tag:
refs/tags/lmux-anthropic-v0.4.0 - Owner: https://github.com/cluebbehusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7b16cd678e57ff68f40dd70dba8425a10fbec7df -
Trigger Event:
push
-
Statement type:
File details
Details for the file lmux_anthropic-0.4.0-py3-none-any.whl.
File metadata
- Download URL: lmux_anthropic-0.4.0-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b06e141b46eefd1ecefd9c883f0e30468b830c85bcadadcbd447e9f3a48af1c5
|
|
| MD5 |
d822619268cd05c543452e8f80fe43cc
|
|
| BLAKE2b-256 |
a91cee9edae6863c61af45afe8a4a5e60a91948648efe3626ef92915322720dc
|
Provenance
The following attestation bundles were made for lmux_anthropic-0.4.0-py3-none-any.whl:
Publisher:
publish.yml on cluebbehusen/lmux
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lmux_anthropic-0.4.0-py3-none-any.whl -
Subject digest:
b06e141b46eefd1ecefd9c883f0e30468b830c85bcadadcbd447e9f3a48af1c5 - Sigstore transparency entry: 1245340232
- Sigstore integration time:
-
Permalink:
cluebbehusen/lmux@7b16cd678e57ff68f40dd70dba8425a10fbec7df -
Branch / Tag:
refs/tags/lmux-anthropic-v0.4.0 - Owner: https://github.com/cluebbehusen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7b16cd678e57ff68f40dd70dba8425a10fbec7df -
Trigger Event:
push
-
Statement type: