Skip to main content

Lightweight Python SDK for the LLMWise multi-model API (chat, compare, blend, judge, failover).

Project description

LLMWise Python SDK

Lightweight Python client for the LLMWise multi-model API:

  • Chat (single model + Auto routing)
  • Failover routing (primary + fallback chain)
  • Compare (run 2+ models in parallel)
  • Blend (synthesize answers from multiple models, supports MoA / Self-MoA)
  • Judge (model-vs-model evaluation)

This SDK is intentionally small: it depends only on httpx.

Install

pip install llmwise

Quickstart (Chat)

from llmwise import LLMWise

client = LLMWise("mm_sk_...")

resp = client.chat(
    model="auto",
    messages=[{"role": "user", "content": "Write a haiku about rate limits."}],
    stream=False,
)

print(resp["content"])

Streaming (Chat)

from llmwise import LLMWise

client = LLMWise("mm_sk_...")

for event in client.chat_stream(
    model="claude-sonnet-4.5",
    messages=[{"role": "user", "content": "Explain recursion to a 10-year-old."}],
):
    if event.get("event") == "done":
        print(f"\n\ncharged={event.get('credits_charged')} remaining={event.get('credits_remaining')}")
        break
    delta = event.get("delta")
    if delta:
        print(delta, end="", flush=True)

Failover (Chat + Routing)

from llmwise import LLMWise

client = LLMWise("mm_sk_...")

for event in client.chat_stream(
    model="claude-sonnet-4.5",
    routing={"fallback": ["gpt-5.2", "gemini-3-flash"], "strategy": "rate-limit"},
    messages=[{"role": "user", "content": "Summarize this in 3 bullets: ..."}],
):
    # route/trace events are emitted when failover triggers
    if event.get("event") in {"route", "trace"}:
        continue
    if event.get("event") == "done":
        break
    if event.get("delta"):
        print(event["delta"], end="", flush=True)

Compare (2+ models)

from llmwise import LLMWise

client = LLMWise("mm_sk_...")

events = client.compare_stream(
    models=["gpt-5.2", "claude-sonnet-4.5", "gemini-3-flash"],
    messages=[{"role": "user", "content": "Draft a short product description for a credit-based LLM gateway."}],
)

by_model = {}
for ev in events:
    if ev.get("event") == "summary":
        print("summary:", ev)
    if ev.get("event") == "done":
        break
    if ev.get("delta"):
        by_model.setdefault(ev["model"], "")
        by_model[ev["model"]] += ev["delta"]

Configure

Environment variables:

  • LLMWISE_API_KEY
  • LLMWISE_BASE_URL (default: https://llmwise.ai/api/v1)

Notes

  • Authentication uses Authorization: Bearer <mm_sk_...> (or a Clerk JWT).
  • Streaming uses Server-Sent Events (SSE) and yields parsed JSON dictionaries.

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

llmwise-0.1.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

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

llmwise-0.1.1-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file llmwise-0.1.1.tar.gz.

File metadata

  • Download URL: llmwise-0.1.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llmwise-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9be2e011d93688f912155920d869438b96d973aa16b162da199c7a76bab638b0
MD5 bcc73bd01bbdf4be2b451481596aadbe
BLAKE2b-256 9a10f879439ba0e44a14cd31e06774e26403cc17cad6dd5298629c6e805d6161

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmwise-0.1.1.tar.gz:

Publisher: publish-pypi.yml on LLMWise-AI/llmwise-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llmwise-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: llmwise-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llmwise-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73d2199ebfa539eeb50ca115e1715c56b22a4a37ebf41fa1b4ff7d55ebbe2373
MD5 49bf0061fc81037e6967e032c0475f2f
BLAKE2b-256 932009459ba955f1bfa4f694f9f8f13a536dfcc8918bab212b180d515ba395e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for llmwise-0.1.1-py3-none-any.whl:

Publisher: publish-pypi.yml on LLMWise-AI/llmwise-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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