Observed since 21 Oct, 09:58 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Thin, zero-dependency BYOK Python client for AI Auto Router
A lightweight, zero-external-dependency Python client for the AI Auto Router BYOK gateway.
Connects your application directly to your AI Auto Router instance using standard library primitives (urllib). Completely decouples client-side request orchestration from your private routing algorithms, Jev decision trees, and provider quality scoring.
pip install ai-auto-router-client
from ai_auto_router_client import AutoRouterClient
# Defaults to the hosted API (https://api.sentiogate.dev). Self-hosting? Pass base_url="http://localhost:8000".
router = AutoRouterClient(api_key="sg_live_...")
resp = router.chat(
messages=[{"role": "user", "content": "Explain raft consensus in 2 sentences"}],
provider_keys={"openai": "sk-...", "anthropic": "sk-ant-..."}
)
print(resp["choices"][0]["message"]["content"])
for chunk in router.stream_chat(
messages=[{"role": "user", "content": "Write a quicksort in Python"}],
provider_keys={"openai": "sk-..."}
):
delta = chunk.get("choices", [{}])[0].get("delta", {}).get("content", "")
print(delta, end="", flush=True)
The default request timeout is 130 s (the community pool can take up to the server's 120 s deadline); pass timeout=<seconds> to change it.
With a SentioGate API key and no provider keys, requests are served by the free community pool:
model: "auto" (default) or "sentiogate-community"; responses report the model as
sentiogate-community. Routing options (difficulty, mode, constraints, hedging*, plugins, cascade)
don't apply on the community pool and are ignored.sentiogate-community (chat or batch) returns 403 community_pool_disabled_with_byok. Use "auto" or a
provider/model id to route with your own keys instead.upstream_rate_limited
with Retry-After set to the seconds left on the shared cooldown (60 s to 15 min). While the pool tests
recovery, waiting callers get Retry-After: 5. The 5-hour window being full returns 429
community_pool_exhausted (not worth retrying soon).Every failure raises RouterClientError with status_code, code (e.g. upstream_rate_limited),
error_type, retry_after (seconds, from the Retry-After header) and response_body. Streaming errors arrive
before the first chunk and raise the same way.
from ai_auto_router_client import AutoRouterClient, RouterClientError
# Retries are off by default. max_retries > 0 retries only transient 429s, only after the server's
# Retry-After (at least 1 s), and never when that is longer than max_retry_wait seconds.
router = AutoRouterClient(api_key="sg_live_...", max_retries=2, max_retry_wait=30)
try:
router.chat(messages=[{"role": "user", "content": "hi"}])
except RouterClientError as e:
if e.code == "upstream_rate_limited":
print(f"Community pool cooling down; retry in {e.retry_after:.0f}s")
Enqueue non-urgent tasks or absorb capacity limits asynchronously:
# 1. Enqueue batch job
enq = router.enqueue_batch(
messages=[{"role": "user", "content": "Generate 10 synthetic test cases"}],
model="sentiogate-community"
)
print(f"Enqueued job: {enq['job_id']}")
# 2. Poll result
status = router.poll_batch(enq["job_id"])
if status.get("status") == "completed":
print(status["response"]["choices"][0]["message"]["content"])
urllib, json). No httpx, requests, or heavy runtime bloat.Apache-2.0
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.2.0 | 20 Oct 2026 | 0 |
This describes our collected data; it is not a security assessment.
Observed since 21 Oct, 09:58 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:d27183d9c3d5402c1a76fa04eef3f943c97d9d60600a8be81701ecc4e7ae5be0