Skip to main content

ai-auto-router-client

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.

Installation

pip install ai-auto-router-client

Quick Start (3-Line Drop-in)

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"])

Streaming Support

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)

Batch Queue & Overflow

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"])

Key Benefits

  • Zero Third-Party Dependencies: Written entirely in pure Python standard library (urllib, json). No httpx, requests, or heavy runtime bloat.
  • Strict Privacy / Core Isolation: Client never contains internal scoring logic or proprietary provider decision weights. All routing decisions are executed server-side.
  • Provider Key Forwarding: Passes keys transiently via HTTPS to your router; zero persistence of keys on disk.
  • Telemetry Outcome Reporting: Report user accept/reject outcomes to power your adaptive router learning.

License

Apache-2.0

Metadata

Release files for ai-auto-router-client 1.1.0

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

Source distribution (sdist)

Source distribution for ai-auto-router-client 1.1.0
File Size Uploaded
ai_auto_router_client-1.1.0.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ai-auto-router-client 1.1.0
File Interpreter ABI Platform
ai_auto_router_client-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.9 kB

Release files / ai_auto_router_client-1.1.0.tar.gz

Download URL ai_auto_router_client-1.1.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6615c4125cdae890d4e93d41152bc781dfc52b8b75c491eb7e1c76ce51c3c75b
BLAKE2b-256 checksum
How to use checksums
ba59d7f81eac5c969ea2fc343847f0c3f585d245533344b2e30d537d7fd6cdcc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / ai_auto_router_client-1.1.0-py3-none-any.whl

Download URL ai_auto_router_client-1.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba6b2bc4ad1b8dc3cdaf1884226b5958c3a1e9bde577e47e13cc75df6ab99ccb
BLAKE2b-256 checksum
How to use checksums
db8f1cc72bff96a105c4d238ade92bd4795e3d87b16506c27044b61ad423772c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.0

2 release files

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