POST /api/zeq/agent/generate-html
LLM-driven page generator. Your model writes the HTML; the framework
hashes + commits it to your entangled state via the same pipeline as a manual
upload (HOST1 operator), and serves it from /s/<slug>/<path>.
Auth
Authorization: Bearer zeq_ak_…. Owner of the target slug only.
Cost
100 ZEQ atomic. The most expensive single action in the framework because it can burn 5–20K LLM tokens (input + output). At list price that's $1.00 covering ~$0.03–$0.15 of upstream cost — the markup funds the entangled state write + rest of the platform.
Request
curl -X POST https://YOUR-FRAMEWORK/api/zeq/agent/generate-html \
-H "Authorization: Bearer zeq_ak_..." \
-H "Content-Type: application/json" \
-d '{
"slug": "zeq07090490306",
"path": "/",
"title": "My state-machine page",
"prompt": "A landing page with three feature cards: real-time compute, ZeqProof verified, ≤0.1% precision",
"style": "chat",
"credential_id": "5b7a9c12-...",
"include_chat": true,
"publish": true
}'
Body
| Field | Type | Required | Notes |
|---|---|---|---|
slug | string | yes | Target chain. Must be admin+ on it. |
path | string | no | Default /. Where the page lands under /s/<slug>/. |
title | string | yes | Page <title>. |
prompt | string | yes | Plain-language description of what to build (≤4000 chars). |
style | enum | no | "chat" (default — full-page chatbot), "qore", "minimal", "documentation", "landing". |
credential_id | uuid | yes | BYOK credential to use. Required — there's no free-tier path for this endpoint. |
include_chat | bool | no | Default true. Embeds the agent rail / Pulse when style ≠ chat. |
publish | bool | no | Default false. When true, commits to chain + serves immediately. When false, returns the generated HTML for review. |
Response · 200 OK (publish=true)
{
"ok": true,
"slug": "zeq07090490306",
"path": "/",
"url": "https://YOUR-FRAMEWORK/s/zeq07090490306/",
"sha256": "f3a1...",
"bytes": 14220,
"transition_id": "tx_2026-05-10T13:08:32Z_...",
"tally_charge": {
"charged": 100,
"burned": 80,
"toFoundation": 20,
"remainingAfter": 43
}
}
Response · 200 OK (publish=false)
{
"ok": true,
"html": "<!doctype html><html>...",
"review_url": null,
"tally_charge": { /* same shape as above */ }
}
Errors
| Status | Code | Cause |
|---|---|---|
400 | style_invalid | Not in the enum list. |
400 | prompt_required | Missing or > 4000 chars. |
402 | INSUFFICIENT_BALANCE | Wallet < 100 ZEQ. Top up at /tally/ or upgrade tier. |
403 | not_owner | Caller isn't admin+ on target machine. |
409 | path_conflict | path already exists and publish=true without overwrite=true. |
How the page lands
When publish=true:
- Atomic 100 ZEQ charge.
- LLM call (BYOK).
- SHA-256 of the generated bytes.
- New
state_machine_sitesrow with the bytes + hash. - Chain transition writes operator
HOST1with the hash payload. siteHost.tsserves it next request to/s/<slug>/<path>.
The Pulse / agent rail injection on the new page is governed by the
chain's inject_pulse_orb / inject_agent_rail toggles (per Phase L3).
Related
- Agents concept
- Page hosting (Phase V)
- BYOK — required for this endpoint
/state/admin/ai/— UI for this endpoint