Python — 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 pin at
/cli/zeq.py.sha256.
Get it curl -fsSO https://zeqapi.com/cli/zeq.py Runtime Python 3.8+ Source served per-node at /cli/zeq.py (canonical copy in apps/zeq-dev/public/cli/zeq.py) Precision ≤0.1%
Every node serves the terminal CLI with a sha256-pinned installer — the fastest way onto the framework:
curl -fsSL https://zeqstate.com/install.sh | sh # any node works as the origin
zeq tutorial # guided: account → machine → first compute → verify
Full install notes + the complete command reference: /cli/. The deep-dive on zeq.py itself lives at /cli/python/.
Install
There is nothing to install — download the file and import it:
curl -fsSO https://zeqapi.com/cli/zeq.py
curl -fsS https://zeqapi.com/cli/zeq.py.sha256 # verify the pin before first use
(pip install zeq does not exist — the framework deliberately ships the Python client as a self-hosted single file, not a PyPI package.)
Quickstart
from zeq import Zeq
z = Zeq("https://zeqapi.com", key="zeq_ak_...") # or no key, then z.demo_key()
print(z.pulse()) # current Zeqond, phase, system-clock status
print(z.operators()[:5]) # browse the catalogue
env = z.compute("NM19", mass=5, acceleration=2)
print(env["result"]["value"], env["result"].get("units", ""))
print(z.verify(env)) # Ed25519 + independent recompute (verifier mesh)
The Zeq class methods:
| Method | What it does |
|---|---|
pulse() | The node's clock — Zeqond, phase. |
operators() | The operator catalogue from the live registry. |
demo_key() | Mint a demo key for keyless experimentation. |
compute(op, **inputs) | Run an operator, get the signed CKO envelope back. |
verify(env) | Verify an envelope — signature + independent recompute via the node's verify surface. |
Errors raise ZeqError with .status and .payload carrying the node's structured error body. The same file doubles as a CLI: python3 zeq.py compute NM19 mass=5 acceleration=2.
Verify a result
Every compute returns the full envelope — including the Ed25519-signed claim (signed), the HMAC zeqProof, and explorer_url:
env = z.compute("GR40", mass=1.98892e30)
print(env["result"]["value"])
print(env["signed"]["claim"]["registry_version"]) # registry the result pins
print(env["zeqProof"], env["explorer_url"])
att = z.verify(env) # no secrets required
z.verify() calls the node's public verify surface; for fully offline verification (no node in the loop) use the served verifier scripts — see Verify anything.
Master-equation solve + register dump — raw HTTP
zeq.py covers the operator-compute surface. The master-equation runtime (full trajectory + register dump + functional energy E = P_φ · Z) is a plain POST — stdlib urllib is enough:
import json, os, urllib.request
def post(path, body):
req = urllib.request.Request(
"https://zeqapi.com" + path,
data=json.dumps(body).encode(),
headers={
"Authorization": "Bearer " + os.environ["ZEQ_KEY"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(req) as r:
return json.load(r)
# Single-body
r = post("/api/framework/solve", {
"prompt": "feather drop",
"mass": 1e-4,
"location": "earth",
"medium": "air",
"koSettings": {"KO42": 1.0},
})
rd = r["registerDump"]
print(r["errorPct"], r["functionalEnergy"])
print(rd["phi_range"], rd["frequency_Hz"], rd["momentum_final"])
# Multi-body — Sun-Earth-Moon
mb = post("/api/framework/multibody", {
"prompt": "sun-earth-moon",
"bodies": [
{"mass": 1.989e30, "location": "sun", "object": "sun"},
{"mass": 5.972e24, "location": "earth", "object": "earth"},
{"mass": 7.342e22, "location": "moon", "object": "moon"},
],
"koSettings": {"KO42": 1.0, "NM21": 0.5, "GR35": 0.3},
})
for body in mb["bodies"]:
print(body["object"], body["registerDump"])
See /api/framework/ for the full request schema and every optional flag (useOperatorModules, coreOnly, referenceMode, pairwiseCoupling, …). /api/framework/solve-strict runs the ≤0.1% autotune loop.
NumPy / Jupyter
The envelope is plain JSON — its numeric fields drop straight into NumPy, pandas, SciPy, and matplotlib with no adapter:
import numpy as np
sol = np.array(r["solution"]) # φ(t), downsampled
t = np.array(r["tEval"])
import matplotlib.pyplot as plt
plt.plot(t, sol)
There is no IPython magic and no package-level integration — by design, the client stays one auditable file.
See also
- /cli/python/ — the canonical
zeq.pypage (methods, CLI mode, honest limits) - API reference · HTTP / curl — the wire format
- TypeScript (planned native client) · MCP
- Operators · Protocols
- Papers: Zeq Paper · Zeq Framework
Middleware active. Kernel on the 1.287 Hz HulyaPulse. Awaiting next Zeqond.