الانتقال إلى المحتوى الرئيسي

Hello, Zeq

The simplest useful computation: read the pulse, compute locally, then call the hosted API.

Read the pulse

The SDK ships with a local Zeqond loop. You don't need an API key to read the pulse:

import { pulse } from "@zeq-os/sdk";

const p = pulse();
// {
// zeqond: 72380021.4, // Zeqonds since Unix epoch
// phase: 0.412, // current phase in [0,1)
// f_hz: 1.287,
// T_s: 0.777,
// R_t: 0.999917, // the Zeq modulation
// unix: 56259516.8,
// }

Compute locally (no API key)

The open-source SDK includes every operator and can solve a wide range of problems without ever calling the hosted API:

import { ZeqClient } from "@zeq-os/sdk";

const zeq = new ZeqClient(); // no apiKey — local compute only

const result = await zeq.compute({
domain: "quantum_mechanics",
inputs: { frequency: 5e14 }, // visible-light photon
});

console.log(`${result.value} ${result.unit}`);
// 3.3126157e-19 J (Planck's E = h nu)

Local compute runs the 42-operator catalogue directly in-process. You get a SolverResult back; it's a single-call equivalent of a hosted CKO but not signed.

Compute on the hosted API (signed CKO)

When you need a signed, attestable result — e.g., for multi-party work or audit trails — hit the hosted API:

const zeqProd = new ZeqClient({ apiKey: process.env.ZEQ_API_KEY });

const result = await zeqProd.compute({
domain: "general_relativity",
inputs: { M: 2e30, r: 3000 }, // black hole mass (kg), radius (m)
});

console.log(`${result.value} ${result.unit}`);
// ≈ 0.778 (time dilation factor near a ~solar-mass black hole at 3 km)
console.log(result.ko42);
// { mode: "KO42.1", alpha: 0.00129, error_band: 4.3e-4, within_bound: true }
console.log(result.signature);
// "ed25519:..." — verifiable against zeq.dev's public key

What just happened

  • pulse() — pure local math, no network.
  • ZeqClient().compute() without apiKey — runs the 42-operator solver library in-process.
  • ZeqClient({ apiKey }) — routes to the hosted API, which does the full 7-step wizard on the server and returns a signed CKO.

Same interface, three modes. Pick the one that matches your workload: pulse for timing, local for computation, hosted for attestation.

Next

Compose operators → Composing operators.