Skip to main content

axio-transport-anthropic

PyPI Python License: MIT

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: ephemeral applied automatically to the system prompt and the last tool definition
  • Extended thinking — ReasoningDelta events emitted for thinking blocks
  • Retry logic — automatic backoff on 429 / 529; honours Retry-After header
  • 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.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for axio-transport-anthropic 0.11.1
File Size Uploaded
axio_transport_anthropic-0.11.1.tar.gz 24.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for axio-transport-anthropic 0.11.1
File Interpreter ABI Platform
axio_transport_anthropic-0.11.1-py3-none-any.whl Python 3 none any Details

Total release size: 39.0 kB

Release files / axio_transport_anthropic-0.11.1.tar.gz

Download URL axio_transport_anthropic-0.11.1.tar.gz
Size 24.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0f573670ae6d4990eb254ddc30a6abafdf9ab86e4c7bc205db1fec6380e6a3c4
BLAKE2b-256 checksum
How to use checksums
44721a1fbeba972c20920aefb6cc58cd155160184e4f00df55e5ffe1d01cfbdf
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

Release files / axio_transport_anthropic-0.11.1-py3-none-any.whl

Download URL axio_transport_anthropic-0.11.1-py3-none-any.whl
Size 15.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d519f8fe1418fe2e73abb6bbcfd224f46865f78357f6e794e7959fcfbde23b5c
BLAKE2b-256 checksum
How to use checksums
b78f3ccf75ca785711723faaf454558f0a7cef3d92136d41933739a4bd478f68
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

Release history Release notifications | RSS feed

0.11.3

2 release files

0.11.2

2 release files

This release

0.11.1 This release

2 release files

0.11.0

2 release files

0.10.1

2 release files

0.10.0

2 release files

0.9.9

2 release files

0.9.8

2 release files

0.9.7

2 release files

0.9.6

2 release files

0.9.5

2 release files

0.9.4

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page