tierproxy Python SDK¶
Official Python SDK for tierproxy — a
premium multi-provider proxy gateway built for AI/ML data-collection
pipelines. The SDK wraps the public REST API (/v1/me, /v1/usage/me,
/v1/usage/me/stream, /v1/health/upstreams) and ships ready-to-use
adapters for the most popular Python HTTP clients and scraping frameworks.
Contents
- Quickstart
- The integration ladder
- Cookbook — recipes
- Response caching
- Per-request cost attribution
- Multi-provider auto-failover
- Rate-limit learning
- JA3/JA4 TLS fingerprint rotation
- Cookies + streaming responses
- Observability with OpenTelemetry
- tierproxy vs the field
- FAQ
- How do I get an API key?
- Sync vs async — which should I use?
- Does
routing="cheapest"always pick the cheapest upstream? - How is monthly cost calculated?
- Why does my
with_browser_use.pykeep getting blocked? - Does the CLI work without an API key?
- What happens at month-end with usage rollovers?
- Can I use tierproxy with self-hosted gateway?
- What’s the difference between
tierproxy.get()andclient.get()? - How do I trace SDK calls with my existing OpenTelemetry setup?
- Why does my IDE not autocomplete tierproxy methods?
- Can I revoke an API key?
- What’s the rate limit?
- How do I report a bug?
- Is the gateway code open-source?
- Migrating to tierproxy
- Troubleshooting
- API Reference
Install¶
pip install tierproxy
Optional extras:
pip install "tierproxy[requests]" # adapter for the `requests` library
pip install "tierproxy[docs]" # build the documentation locally
At a glance¶
from tierproxy import TierProxy
with TierProxy() as client:
me = client.me.get()
print(me.client_id, me.used_bytes_month, "of", me.quota_bytes_month)
The SDK supports both synchronous (TierProxy) and asynchronous
(AsyncTierProxy) usage, exposes a typed exception hierarchy, includes a
configurable retry policy with exponential backoff + jitter, and streams
live usage deltas via Server-Sent Events.
See the Quickstart for a 5-minute walkthrough and the API reference for the complete public surface.
Performance¶
ProxyURL builds in well under 1 µs (basic), ~2 µs with full modifiers.
The smart pick selector chooses from 100 upstreams in ~17 µs, 1000 upstreams
in ~60 µs. See benchmarks.