Skip to main content

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://zeqsdk.com/cli/zeq.py Runtime Python 3.8+ Source served per-node at /cli/zeq.py Precision ≤0.1%

Install

There is nothing to install — download the file and import it:

curl -fsSO https://zeqsdk.com/cli/zeq.py # the client
curl -fsS https://zeqsdk.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. Any node serves it (zeqond.com, zeqstate.com, zeqapi.com, zeq.dev); the bytes are identical across nodes, which is what the sha256 pin proves.

Quickstart

from zeq import Zeq

z = Zeq("https://zeqsdk.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

The Zeq class:

MethodWhat 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 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("GR37", mass=1.98892e30)
print(env["result"]["value"])
print(env["signed"]["claim"]["registry_version"]) # the 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://zeqsdk.com" + path,
data=json.dumps(body).encode(),
headers={
"Authorization": "Bearer " + os.environ["ZEQ_API_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)

No IPython magic, no package-level integration — by design, the client stays one auditable file.

Economy — send a ZEQ coin (and across domains)

Every compute mints a ZEQ envelope coin (the transferable asset). Transfers are private by default; pass visibility="public" to publish to the observer.

import requests
r = requests.post("https://zeq.dev/api/tally/envelopes/transfer",
headers={"Authorization": f"Bearer {ZSM_KEY}"},
json={"token_id": "ZT-…", "to": "ZEQ07…", "to_origin": "https://zeqond.com"})
d = r.json() # → { receipt, claim_ticket, spend_seq, … }
# The recipient's domain verifies `receipt` against the home chain (one home per
# coin, no consensus), imports a claim, and moves it onward with `claim_ticket`.

Full model + verify/claim/publish endpoints: cross-domain economy.

See also


Middleware active. Kernel on the 1.287 Hz HulyaPulse. Awaiting next Zeqond.