Official Python SDK for tierproxy — premium multi-provider proxy infrastructure for AI/ML pipelines.
Project description
tierproxy — Python SDK
🚧 Preview release. Gateway is not yet generally available. Join the waitlist at hello@tierproxy.com. SDK is functional but
tierproxy doctoragainst a live gateway requires invitation.
Premium multi-provider proxy infrastructure for AI/ML pipelines. Built for engineers who measure cost, latency, and success rate twice — and write Python.
Install
pip install tierproxy
Quickstart — five-second flavor
import tierproxy
r = tierproxy.get("https://example.com", country="US")
print(r.text)
That's it. (Set TIERPROXY_API_KEY env var first.)
Three lines, persistent session
from tierproxy import TierProxy
with TierProxy() as g:
print(g.me.get().client_id)
r = g.get("https://example.com", country="US", session_id="s1")
Auto-pick the cheapest healthy upstream every request
g = TierProxy(routing="cheapest") # also: "fastest", "most_reliable", "balanced"
g.get("https://example.com") # picks via /v1/health/upstreams under the hood
Cost guardrails
g = TierProxy(
monthly_budget_usd=200.0, # raises BudgetExceededError before going over
)
Power-user knobs
import httpx
from tierproxy import TierProxy
from tierproxy.retry import RetryPolicy
g = TierProxy(
api_key="tp_live_...",
base_url="https://my-self-hosted-gw:8444",
timeout=10.0,
retry_policy=RetryPolicy(max_retries=5, retry_on_status=frozenset({500, 502})),
http_client=httpx.Client(verify=False), # custom transport
user_agent_suffix="my-app/2.3", # attribution
)
Raw modes (Playwright, curl, etc.)
from tierproxy import ProxyURL
p = ProxyURL(api_key="tp_live_...", country="US", mode="username_encoding")
print(p.http_url()) # http://customer-tp_live_...-cc-US:x@gw.tierproxy.com:443
How tierproxy compares
| tierproxy | Smartproxy SDK | Bright Data SDK | Oxylabs SDK | DataImpulse | |
|---|---|---|---|---|---|
| Multi-provider routing | ✅ | ❌ | ❌ | ❌ | ❌ |
| Client-side smart selector (cost-aware) | ✅ | ❌ | ❌ | ❌ | ❌ |
| Live usage streaming (SSE) | ✅ | ❌ | ❌ | ❌ | ❌ |
| MCP server (Claude/Cursor/Cline) | ✅ | ❌ | ❌ | ❌ | ❌ |
| OpenTelemetry built-in | ✅ | ❌ | ❌ | ❌ | ❌ |
| Sync + async parity | ✅ | partial | partial | partial | partial |
| AI/ML framework examples shipped | 8 | 0 | 1 | 0 | 0 |
| Type-safe (Pydantic v2 + mypy strict) | ✅ | ❌ | ❌ | partial | ❌ |
| OpenAPI 3.1 spec | ✅ | ❌ | ❌ | ❌ | ❌ |
Pip-installable CLI (tierproxy doctor) |
✅ | ❌ | ❌ | ❌ | ❌ |
| Per-request cost attribution (lazy) | ✅ | ❌ | ❌ | ❌ | ❌ |
| JA3/JA4 TLS fingerprint rotation | ✅ | ❌ | ❌ | ❌ | ❌ |
| Rate-limit learning + auto-failover | ✅ | ❌ | ❌ | ❌ | ❌ |
| License | Apache 2.0 | proprietary | proprietary | proprietary | proprietary |
Features
- Five-second quickstart —
import tierproxy; tierproxy.get(url, country="US") - Layered API — five integration levels from one-liner to power-user knobs
- Smart routing —
routing="cheapest"auto-picks healthy upstream per request - Cost guardrails —
monthly_budget_usd=refuses requests that would exceed budget - Per-request cost attribution —
client.cost_for(resp)returns USD; lazy 30s cache, no per-request overhead - Client-side response caching —
cache_ttl=300, cache_max_response_size=262144LRU with size cap - Multi-provider auto-failover —
auto_failover=Trueretries with next-best upstream on 429/5xx - Rate-limit learning —
client.rate_limits.get()surfaces gateway-aggregated 429s per target domain - JA3/JA4 TLS rotation — per-upstream fingerprint randomization (gateway side; see tls-fingerprint guide)
- Cookie persistence — cookies stick to
session_idacross multi-step crawls - Streaming responses —
client.get(url, stream=True)returns iterator (large files, SSE) - Live SSE stream —
for delta in g.usage.stream()tails month-to-date bytes - MCP server —
tierproxy-mcpexposes proxy as tools to Claude/Cursor/Cline - 8 framework integrations — LangChain, LlamaIndex, Crawl4AI, Playwright, Firecrawl, Browser-Use, CrewAI
- OpenTelemetry opt-in —
pip install tierproxy[otel]for distributed tracing - Geo + sticky sessions — countries, cities, 1-1440min session pins
- Dual URL syntax — headers (httpx/requests) AND username-encoding (Playwright)
- Type-safe end-to-end — Pydantic v2 models, mypy strict, full IDE autocomplete
See examples/ for LangChain/LlamaIndex/Crawl4AI/Playwright and
examples/levels.py for a runnable demo of every level.
Use with your favorite AI/agent framework
| Framework | Example | Notes |
|---|---|---|
| LangChain | with_langchain.py |
RAG document loaders through proxy |
| LlamaIndex | with_llamaindex.py |
SimpleWebPageReader through proxy |
| Crawl4AI | with_crawl4ai.py |
Playwright crawler + tierproxy |
| Firecrawl (hot) | with_firecrawl.py |
Self-hosted Firecrawl + residential IPs |
| Browser-Use (hot) | with_browser_use.py |
LLM-driven autonomous browser |
| CrewAI (hot) | with_crewai.py |
Multi-agent scraper crew + cost-aware routing |
| Playwright | with_playwright.py |
Direct Playwright with tierproxy |
| MCP (Claude/Cursor/Cline/Windsurf) (unique) | mcp_claude_desktop.md |
Native tool integration via tierproxy-mcp |
MCP server (Claude Desktop / Cursor / Cline / Windsurf)
pip install tierproxy[mcp]
Then add to your MCP client config:
{
"mcpServers": {
"tierproxy": {
"command": "tierproxy-mcp",
"env": { "TIERPROXY_API_KEY": "tp_live_..." }
}
}
}
Now your AI assistant can call fetch_url(url, country="US"), inspect health
and usage, and route through the cheapest healthy upstream — no glue code,
no httpx imports, no boilerplate.
Project details
Release history Release notifications | RSS feed
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 tierproxy-0.2.0.tar.gz.
File metadata
- Download URL: tierproxy-0.2.0.tar.gz
- Upload date:
- Size: 85.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b733d6a006e18dddbf270369cf94e67d6bc1e4ef5701d4d6acd6170de85669b4
|
|
| MD5 |
17b806299ce192295a1013482506d3ea
|
|
| BLAKE2b-256 |
19604e52f778ec12c29bca22fca4ef854ea00e0533a1673a9410b9dfd717e012
|
Provenance
The following attestation bundles were made for tierproxy-0.2.0.tar.gz:
Publisher:
release.yml on tierproxy/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tierproxy-0.2.0.tar.gz -
Subject digest:
b733d6a006e18dddbf270369cf94e67d6bc1e4ef5701d4d6acd6170de85669b4 - Sigstore transparency entry: 1565586454
- Sigstore integration time:
-
Permalink:
tierproxy/python-sdk@53d7cc244767c85d637aa56346ecd161c2cd346d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/tierproxy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@53d7cc244767c85d637aa56346ecd161c2cd346d -
Trigger Event:
push
-
Statement type:
File details
Details for the file tierproxy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: tierproxy-0.2.0-py3-none-any.whl
- Upload date:
- Size: 42.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7ce64f58a004852af6a4c5653ba2bfe79ef16e765aca7c4db27baf2a510f336
|
|
| MD5 |
70bd53fdd189a516e665a31724d29040
|
|
| BLAKE2b-256 |
ee87ef297de9e14f053f932bc8275f52efd7aa2e9f8d40c3dd18e15ed04b8f6c
|
Provenance
The following attestation bundles were made for tierproxy-0.2.0-py3-none-any.whl:
Publisher:
release.yml on tierproxy/python-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tierproxy-0.2.0-py3-none-any.whl -
Subject digest:
f7ce64f58a004852af6a4c5653ba2bfe79ef16e765aca7c4db27baf2a510f336 - Sigstore transparency entry: 1565586670
- Sigstore integration time:
-
Permalink:
tierproxy/python-sdk@53d7cc244767c85d637aa56346ecd161c2cd346d -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/tierproxy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@53d7cc244767c85d637aa56346ecd161c2cd346d -
Trigger Event:
push
-
Statement type: