Skip to main content

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)
  • Full API coverage for conversations, history, credits, usage, keys, memory, optimization, and settings.

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.

Additional API Helpers

  • conversations(), create_conversation(), update_conversation(), delete_conversation()
  • history(), get_history_detail()
  • credits_wallet(), credits_transactions(), credits_packs(), credits_purchase(), credits_confirm_checkout(), credits_update_auto_topup(), credits_balance()
  • usage_summary(), usage_recent()
  • keys_info(), generate_api_key(), revoke_api_key()
  • memory_list(), memory_search(), memory_delete(), memory_clear()
  • optimization_* helpers, including policy/report/evaluate/replay/test suites/regression schedules
  • settings_* helpers, including provider keys, privacy, and copilot state/ask endpoints

Additional API Helper Examples

Dashboard/API Health Check (Read-only)

from llmwise import LLMWise

client = LLMWise()

print("models:", len(client.models()))
print("balance:", client.credits_balance())
print("usage:", client.usage_summary(days=7))
print("conversations:", client.conversations(limit=5))

Conversation Lifecycle

from llmwise import LLMWise

client = LLMWise()

convo = client.create_conversation()
convo_id = convo["id"]
client.update_conversation(convo_id, title="API smoke room")
history = client.history(limit=10)
client.delete_conversation(convo_id)

print("history entries:", history.get("total", 0))

Credits & Cost

from llmwise import LLMWise

client = LLMWise()

print("wallet:", client.credits_wallet())
print("recent usage:", client.usage_recent(days=7, limit=5))
print("packs:", client.credits_packs())

Settings and Optimization

from llmwise import LLMWise

client = LLMWise()

print("copilot:", client.settings_copilot_state())
print("privacy:", client.settings_privacy())
print("policy:", client.optimization_policy())
print("report:", client.optimization_report(days=1))

Smoke Script

Run all read-only SDK health checks:

LLMWISE_API_KEY=mm_sk_... python examples/smoke.py

Metadata

Release files for llmwise 0.1.2

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

Source distribution (sdist)

Source distribution for llmwise 0.1.2
File Size Uploaded
llmwise-0.1.2.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llmwise 0.1.2
File Interpreter ABI Platform
llmwise-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.3 kB

Release files / llmwise-0.1.2.tar.gz

Download URL llmwise-0.1.2.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7b4873a05d77b321c23f32174d40244c4e0a89cb7cb2f7230002e96ea503f828
BLAKE2b-256 checksum
How to use checksums
2eccec7cf4a662c350bc41fd3f6eed6c3b315e62c57a66b44358e369065ab371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 15, 2026.

Transparency log

Release files / llmwise-0.1.2-py3-none-any.whl

Download URL llmwise-0.1.2-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c17c5eddf31ae6b55081c1e64f2563ff2f7080e52c3c92b439b72815b18415f1
BLAKE2b-256 checksum
How to use checksums
c38f0179aa257c8801b9b8579433eaa0bfdd815859d62160bacd66150d8961b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

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