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

Vertex entry point

Install axio-transport-anthropic[vertexai] to use Claude through Vertex without the Google transport package. Select --transport anthropic-vertex in REPL, or Anthropic Vertex AI in TUI. Set GOOGLE_CLOUD_PROJECT and optionally GOOGLE_CLOUD_LOCATION, or enter project and location in TUI settings. axio_transport_anthropic.VertexAITransport also accepts these fields directly. This entry point requires explicit selection and uses Google ADC.

When migrating from Google Vertex, remove anthropic/ from the model ID and copy project and location. Existing Google settings remain unchanged.

Metadata

Release files for axio-transport-anthropic 0.12.4

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.12.4
File Size Uploaded Provenance Actions
axio_transport_anthropic-0.12.4.tar.gz 24.7 kB With provenance Details for axio_transport_anthropic-0.12.4.tar.gz

Built distribution (wheel)

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

Total release size: 40.3 kB

Release files / axio_transport_anthropic-0.12.4.tar.gz

Download URL axio_transport_anthropic-0.12.4.tar.gz
Size 24.7 kB
Tags Source
SHA-256 checksum
How to use checksums
935e0f4846c1983c3d47f33a598f59c1da449f84ec36161fb1bab90add4b2e8f
BLAKE2b-256 checksum
How to use checksums
2890060e40132d312ebbbbd8ca4a6cb37e9c620cc8df617eb9c87ae83f165318
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 22, 2026.

Transparency log

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

Download URL axio_transport_anthropic-0.12.4-py3-none-any.whl
Size 15.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2fa47012755141124aa3727225dbcbe366f6655bfb4a2f85c35e6f6986c564e8
BLAKE2b-256 checksum
How to use checksums
484a38c3f4641201e6cdb44c017afb9885fe66450681c5d52a96f2d8bb4fbe99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 22, 2026.

Transparency log

Security for axio-transport-anthropic 0.12.4

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for axio_transport_anthropic-0.12.4.tar.gz

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 Nov 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.12.4 This release

2 release files Full provenance

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