Skip to main content

Python SDK for Kronaxis Router - intelligent LLM proxy

Project description

Kronaxis Router Python SDK

Zero-dependency Python client for Kronaxis Router.

pip install kronaxis-router

Quick Start

from kronaxis_router import KronaxisRouter, Tier

router = KronaxisRouter("http://localhost:8050", service="my-app")

# Simple chat (auto-classified tier)
response = router.chat("What is the capital of France?")

# Force tier 2 (cheap model) for extraction
data = router.chat(
    "Extract the email from: Contact us at hello@example.com",
    tier=Tier.LIGHT,
    call_type="extraction",
)

# Force tier 1 (powerful model) for reasoning
plan = router.chat(
    "Design a 3-phase migration strategy for...",
    tier=Tier.HEAVY,
    max_tokens=2000,
)

# LoRA adapter routing
email = router.chat(
    "Draft a cold outreach email...",
    model="sdr",  # Routes to backend with SDR adapter
    system="You are a sales development representative.",
)

# Batch submit (50% off)
job = router.batch_submit(
    backend="cloud-fast",
    requests=[
        {"custom_id": "1", "body": {"model": "default", "messages": [{"role": "user", "content": "..."}], "max_tokens": 100}},
        {"custom_id": "2", "body": {"model": "default", "messages": [{"role": "user", "content": "..."}], "max_tokens": 100}},
    ],
    callback_url="https://my-app.com/webhook",
)
print(f"Batch job: {job['id']}")

# Check costs
costs = router.costs()
print(f"Today's spend: ${costs['daily'].get('my-app', 0):.4f}")

API

  • router.chat(prompt, *, system, model, max_tokens, temperature, tier, priority, call_type)
  • router.chat_messages(messages, *, model, max_tokens, temperature, tier, priority, call_type)
  • router.batch_submit(requests, backend, callback_url)
  • router.batch_status(job_id)
  • router.batch_results(job_id)
  • router.costs(period)
  • router.health()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kronaxis_router-0.1.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kronaxis_router-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file kronaxis_router-0.1.0.tar.gz.

File metadata

  • Download URL: kronaxis_router-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for kronaxis_router-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4604343da4f60579dea75933849f942f85f69e844e9af33e3c8881a26f0fedf9
MD5 87058792de7786635b283ecfe011e5a0
BLAKE2b-256 a707c0f264f2e562f54611d529b775fa4bbe76f353d369cac954b56e7fc09676

See more details on using hashes here.

File details

Details for the file kronaxis_router-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kronaxis_router-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 53b233438942080afcfc66dfa9cdeb5862fffa4128a58257f84b32db29a1234f
MD5 f280234635d710b94ec19c70a221d74f
BLAKE2b-256 cb34b61f84346be74b3eae6e449c450846ee348c03a35b4baddf0e2cf4a24393

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page