Skip to main content

Python SDK — zeq.py

One file, standard library only, Python 3.8+. Self-hosted like the CLI — no PyPI, no pip, no external registry. Every node serves it, with a published sha256 pin at /cli/zeq.py.sha256.

curl -fsSO https://zeqsdk.com/cli/zeq.py # or any Zeq origin
# optional: verify the pin
[ "$(shasum -a 256 zeq.py | awk '{print $1}')" = "$(curl -fsSL https://zeqsdk.com/cli/zeq.py.sha256 | awk '{print $1}')" ] && echo "pin OK"

Every numeric fact returned comes from the live kernel — the client adds nothing and rounds nothing (the framework's ≤0.1% tolerance applies). It is a thin shim over the same JSON the HTTP API speaks, so anything zeq.py does, any language can do.

Library

from zeq import Zeq

z = Zeq("https://zeqstate.com", key="zeq_ak_...") # or no key, then z.demo_key()

# clock + catalogue
print(z.pulse()) # current Zeqond, phase, system-clock status
print(z.protocols("compute")) # the compute protocols, with endpoints

# compute + verify
env = z.compute("NM19", mass=5, acceleration=2)
print(env["result"]["value"], env["result"].get("unit", ""))
print(z.verify(env)) # Ed25519 + independent recompute (verifier mesh)

# reproducibility — prove this node computes the reference physics
print(z.conformance()["ok"]) # True = every golden vector matched

# multi-scale physics — the master-equation ODE solver
sol = z.solve("two-body orbit, sun and earth")
print(sol["errorPct"], sol["energy"])

The Zeq class methods:

MethodWhat it does
pulse()The node's clock — Zeqond, phase.
operators(search=None)The operator catalogue from the live registry; pass a search term to filter.
protocols(category=None)The protocol catalogue — named formulas with endpoint, method, auth. Filter by category.
compute(op, **inputs)Run an operator, get the signed CKO envelope back. Operator prefix → kernel domain inference mirrors the CLI (QM, NM, GR, CS, TD, EM).
solve(prompt, **params)The HULYAS master-equation ODE solver from a natural-language prompt — multi-scale physics beyond a single operator. Returns the trajectory, energy, error %, and master-equation terms.
multibody(prompt, bodies)N-body gravitational solve (2–16 bodies); each body carries mass + initial state.
conformance()Golden-vector conformance — proves this node computes the framework's reference physics bit-for-bit. The open-science reproducibility check; no key needed.
verify(env)Verify an envelope — Ed25519 signature + independent recompute via the node's verify surface.
node_identity()The origin's published Ed25519 node identity.
demo_key()Mint a demo key for keyless experimentation.

Errors raise ZeqError with .status and .payload carrying the node's structured error body.

Command line

The same file doubles as a CLI:

python3 zeq.py pulse
python3 zeq.py operators energy
python3 zeq.py compute NM19 mass=5 acceleration=2
python3 zeq.py conformance # reproducibility check — exits with the node's verdict
python3 zeq.py solve "projectile launched at 45 degrees"
python3 zeq.py protocols compute
python3 zeq.py verify envelope.json
python3 zeq.py --version

For open science

Two of these are the point of an open, verifiable framework:

  • conformance() lets anyone, in any pipeline, confirm a node computes the same physics as the reference corpus — the reproducibility primitive. It pairs with the reproducibility CI gate so a paper or repo can fail its build if the node drifts.
  • verify(env) re-derives a published result independently — a reviewer checks your number without trusting your node.

Both speak plain JSON, so a lab that prefers R, Julia, or Fortran can hit the same endpoints directly; zeq.py is just the batteries-included Python door.

Honest limits

  • It's a thin HTTP client — fully offline verification (Ed25519 + recompute with no node in the loop) is the job of the served verifier scripts; z.verify() calls the node's verify surface.
  • solve() in default mode auto-tunes α and can carry a visible error % on an underspecified prompt; the /api/solve/strict path tunes β until error ≤ 0.1% — reach for it when you need the tight bound.
  • Don't paste the file's contents into a terminal — download it (the header says so for a reason).

Source: served per-node at /cli/zeq.py (canonical copy in apps/zeq-dev/public/cli/zeq.py); pinned at /cli/zeq.py.sha256.