axio-transport-anthropic
Anthropic Claude transport for axio.
Streams Claude responses over the Anthropic Messages API using aiohttp and
SSE parsing. Supports direct API, Vertex AI, prompt caching, extended thinking,
and automatic retry on rate-limit and overload errors.
Features
- All Claude models — Opus, Sonnet, Haiku; configurable via
ANTHROPIC_MODELS - Vertex AI — use Claude via Google Cloud with ADC authentication
- Prompt caching —
cache_control: ephemeralapplied automatically to the system prompt and the last tool definition - Extended thinking —
ReasoningDeltaevents emitted for thinking blocks - Retry logic — automatic backoff on 429 / 529; honours
Retry-Afterheader - TUI integration — settings screen for API key and model selection
Installation
pip install axio-transport-anthropic
With the TUI settings screen:
pip install "axio-transport-anthropic[tui]"
With Vertex AI support:
pip install "axio-transport-anthropic[vertexai]"
Usage
import asyncio
import aiohttp
from axio import Agent
from axio.context import MemoryContextStore
from axio_transport_anthropic import AnthropicTransport, ANTHROPIC_MODELS
async def main() -> None:
async with aiohttp.ClientSession() as session:
transport = AnthropicTransport(
api_key="sk-ant-...",
model=ANTHROPIC_MODELS["claude-sonnet-4-6"],
session=session,
)
agent = Agent(system="You are helpful.", tools=[], transport=transport)
ctx = MemoryContextStore()
print(await agent.run("Hello!", ctx))
asyncio.run(main())
Set the API key via environment variable instead of passing it directly:
export ANTHROPIC_API_KEY="sk-ant-..."
Vertex AI
transport = AnthropicTransport(
vertexai=True,
project="my-gcp-project",
location="us-east5",
session=session,
)
# Uses Application Default Credentials (gcloud auth application-default login)
Models
| Model ID | Context | Max output | Notes |
|---|---|---|---|
claude-opus-4-6 |
1 M | 128 k | Most capable |
claude-sonnet-4-6 |
1 M | 64 k | Balanced (default) |
claude-haiku-4-5-20251001 |
200 k | 64 k | Fastest / cheapest |
claude-opus-4-5 |
200 k | 64 k | — |
claude-sonnet-4-5 |
200 k | 64 k | — |
Configuration
| Parameter | Default | Description |
|---|---|---|
api_key |
"" |
Anthropic API key |
model |
claude-sonnet-4-6 |
Active model |
base_url |
https://api.anthropic.com/v1 |
API base URL |
vertexai |
False |
Use Vertex AI backend |
project |
"" |
GCP project ID (Vertex AI) |
location |
"" |
GCP region, e.g. us-east5 (Vertex AI) |
max_retries |
10 |
Max retry attempts on 429/529 |
retry_base_delay |
5.0 |
Base delay (seconds) for exponential backoff |
License
MIT
Metadata
Release files for axio-transport-anthropic 0.11.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| axio_transport_anthropic-0.11.0.tar.gz | 24.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| axio_transport_anthropic-0.11.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.9 kB
Release files / axio_transport_anthropic-0.11.0.tar.gz
| Download URL | axio_transport_anthropic-0.11.0.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
00910c094db2a0c02dbbb38e462e3ac7aec2c87079a9ac3f5420a7cfaae91607
|
|
BLAKE2b-256 checksum How to use checksums |
92c6cd4d672c5fa3c06fbc5ea2a3ef6f29b1c53dfe3c62169053e406f227b9bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.
Transparency logRelease files / axio_transport_anthropic-0.11.0-py3-none-any.whl
| Download URL | axio_transport_anthropic-0.11.0-py3-none-any.whl |
|---|---|
| Size | 14.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
648978679f484e1e8828255b3358c5d827a597bfbda5d6cae13397548dc65c29
|
|
BLAKE2b-256 checksum How to use checksums |
e76affaa394cfc07f70a003a29595c72e613985c6c1a463030e324ba9ab96e30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 29, 2026.
Transparency log