CLI Reference

    Run certified renders and verify snapshots from the command line.

    Install

    No installation required. Run directly via npx:

    npx --yes @nexart/cli@1.2.0 --help

    The CLI is published as @nexart/cli on npm. It exposes two surfaces: the AI Execution commands (nexart ai …) for sealing and verifying Certified Execution Records, and the Canonical Renderer commands (run, verify, replay) for deterministic Code Mode sketches.

    AI Execution commands

    Seal, certify and verify Certified Execution Records (CERs) for any AI or LLM call. Sealing is fully local and requires no account. Certification by the NexArt node and public verification are optional follow-on steps.

    Create a CER

    Capture an AI execution and emit a local CER bundle file:

    npx --yes @nexart/cli@1.2.0 ai create \ --model gpt-4o \ --input ./prompt.txt \ --output ./response.txt \ --out cer.json

    Seal locally (offline)

    Compute the deterministic certificateHash and produce a cer.ai.execution.v1 bundle. No network call, no API key.

    npx --yes @nexart/cli@1.2.0 ai seal ./cer.json --out cer.sealed.json

    Certify with the NexArt node

    Submit a sealed CER to the canonical node for an Ed25519 attestation and timestamp. Requires NEXART_API_KEY.

    npx --yes @nexart/cli@1.2.0 ai certify ./cer.sealed.json --out cer.certified.json

    Verify a CER

    Independently re-derive the certificate hash and check bundle integrity. Works fully offline.

    npx --yes @nexart/cli@1.2.0 ai verify ./cer.certified.json

    Verify a Project Bundle

    Verify a multi-CER Project Bundle (cer.project.bundle.v1) end-to-end: bundle integrity, node attestation, and each member CER's verification envelope.

    npx --yes @nexart/cli@1.2.0 ai project-verify ./project-bundle.json

    Three-layer verification

    AI-execution CERs verify through Bundle Integrity, Node Attestation and the Verification Envelope, not by re-execution. See AI Execution Integrity for the full model.

    Canonical Renderer commands

    The renderer surface produces deterministic PNGs from Code Mode sketches and the matching verifiable snapshot.

    Authentication

    The canonical renderer requires an API key. Set these environment variables:

    export NEXART_RENDERER_ENDPOINT="https://node.nexart.io" export NEXART_API_KEY="nx_live_..."

    Key format

    • Use the raw key starting with nx_live_...
    • The hashed version (sha256) is stored server-side only

    Certified run

    Execute a sketch and receive a canonical PNG plus verifiable snapshot:

    npx --yes @nexart/cli@1.2.0 run ./examples/sketch.js \ --seed 12345 \ --vars "50,50,50,0,0,0,0,0,0,0" \ --include-code \ --out out.png

    Important

    • The canonical renderer returns a PNG (image/png), not JSON.
    • Canonical size is enforced at 1950×2400. Do not pass width/height and do not call createCanvas().
    • If protocolVersion is omitted, the renderer defaults to 1.2.0 and returns X-Protocol-Defaulted: true.

    Outputs:

    • out.png, rendered image at canonical resolution (1950×2400)
    • out.snapshot.json, deterministic snapshot with hashes

    Options

    FlagDescription
    --seedSeed value for deterministic randomness
    --varsComma-separated VAR array (10 values)
    --include-codeEmbed source code in snapshot
    --outOutput file path
    --api-keyAPI key (alternative to env var)

    Verification

    Verify that a snapshot matches its output:

    npx --yes @nexart/cli@1.2.0 verify out.snapshot.json

    Verification re-renders with the same parameters and confirms the outputHash matches.

    Replay

    Reproduce an image from a snapshot without re-verification:

    npx --yes @nexart/cli@1.2.0 replay out.snapshot.json --out replay.png

    Common errors

    401 UNAUTHORIZED

    Cause: Missing or invalid API key

    Fix: Set NEXART_API_KEY environment variable or pass --api-key

    400 PROTOCOL_VIOLATION

    Cause: Sketch calls createCanvas() or passes custom width/height

    Fix: Remove canvas creation. The canonical renderer provides a 1950×2400 canvas.

    Canvas size

    The canonical renderer enforces 1950×2400. Do not call createCanvas().

    429 TOO MANY REQUESTS

    Cause: Plan limit reached (monthly quota or burst limit)

    Fix: Wait for quota reset or upgrade your plan. See pricing.

    410 GONE

    Cause: Calling deprecated /render endpoint

    Fix: Use /api/render with API key authentication.

    "PNG is not valid JSON"

    Cause: Parsing PNG bytes as JSON

    Fix: Use arrayBuffer()/blob() in fetch, or set Accept: application/json header

    API reference

    For full HTTP API integration, see the NexArt documentation.