zanii-llm-client
Python client for Zanii LLM: OpenAI-compatible inference where every call can produce a signed receipt on a public ledger.
pip install zanii-llm-client # add [verify] to check proofs client-side
from zanii_llm_client import Zanii
z = Zanii() # reads ZANII_LLM_API_KEY
answer = z.chat("Summarise this claim in two sentences.", model="glm-4.7-flash")
print(answer.text)
print(answer.cost_aed, "AED")
print(z.verify(answer.receipt).ok)
No dependencies. A dependency in a client package becomes a dependency in every application that installs it.
You may not need this
The API speaks the OpenAI protocol, so the openai package works with one changed base URL and will
keep working:
from openai import OpenAI
client = OpenAI(api_key="zlk_live_...", base_url="https://llm.zanii.agency/v1")
This package adds the parts no OpenAI client knows about.
answer.receipt, z.verify(...) |
the proof for a call, checked against the public ledger |
InsufficientCredit |
a typed 402 carrying the top-up link, not an opaque error |
z.usage(), z.balance() |
reconcile our invoice against your own records |
max_spend_micro |
a client-side ceiling; the request is never made |
thinking=False |
skip the model's reasoning when the question does not need it |
Reasoning costs money
These models reason before they answer. Reasoning tokens are billed like any other and come out of
max_tokens. Measured on glm-4.7-flash, "name one thing Sharjah is known for" costs 412 output
tokens and 4.4 seconds with reasoning on, and 22 tokens and 0.6 seconds with it off, for the same
answer.
z.chat("Name one thing Sharjah is known for.", model="glm-4.7-flash", thinking=False)
If answer.text comes back empty, answer.empty_because says why and answer.reasoning_tokens
says where the budget went.
Streaming
for piece in z.stream("Write three lines about Dubai.", model="glm-4.7-flash"):
print(piece, end="", flush=True)
print(z.last) # the receipt, once the stream ends
Verifying a receipt
check = z.verify(answer.receipt)
assert check.ok
assert check.detail["verified_locally"] # True with the [verify] extra installed
Verification fetches a Merkle inclusion proof from ledger.zanii.agency and checks it against a
signed tree head. It does not call Zanii LLM at all.
Parity
The TypeScript client @zanii/llm mirrors this one
method for method. A conformance suite runs the same cases through both and fails on a difference.
© Zanii, United Arab Emirates · llm.zanii.agency · info@zanii.agency
Release files for zanii-llm-client 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zanii_llm_client-0.1.0.tar.gz | 9.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zanii_llm_client-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.4 kB
Release files / zanii_llm_client-0.1.0.tar.gz
| Download URL | zanii_llm_client-0.1.0.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1a1744ea3879f9295785ccee7b5b96cbf05d8920c0c8306574eaa7e170c7371d
|
|
BLAKE2b-256 checksum How to use checksums |
1ad8291d1274cbe4f2f907d88114a676373d2e57d03996fc73bf587e5c471ce8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / zanii_llm_client-0.1.0-py3-none-any.whl
| Download URL | zanii_llm_client-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c79046ea0df2a4c34ad8d68f469094b42bfdba1aec46518f5df16bcf254b00c9
|
|
BLAKE2b-256 checksum How to use checksums |
79fd3093e0bb6d5d97f4faef75b8fcd841964bafd85526783a6d9cdd352ce1ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|