POST /api/zeq/agent/page-chat
LLM page-chat bound to a state machine. Replies stream back with the kernel's actual computed values (operators, R(t), phase, proof_digest) and write a ZeqProof envelope to your audit entangled state. This is what the Pulse calls in slug-bound mode.
Auth
Authorization: Bearer zeq_ak_… OR cookie session OR (for visitor-
on-hosted-page) CORS-open with the entangled state's Site SDK key attached
server-side. The Pulse on /s/<slug>/ and on third-party embeds works
without explicit auth — the framework attaches the key at proxy time.
Cost
25 ZEQ per turn atomic. 80% burns, 20% to foundation. If the
slug-bound chain's wallet is short, returns
HTTP 402 INSUFFICIENT_BALANCE and falls back to a self-heal message
in the Pulse (no LLM call upstream).
Request
curl -X POST https://YOUR-FRAMEWORK/api/zeq/agent/page-chat \
-H "Authorization: Bearer zeq_ak_..." \
-H "Content-Type: application/json" \
-d '{
"slug": "zeq07090490306",
"agent_id": null,
"messages": [
{ "role": "user", "content": "What's the precision of operator KO42?" }
],
"credential_id": null
}'
Body
| Field | Type | Required | Notes |
|---|---|---|---|
slug | string | yes | Chain to bind the chat to. |
agent_id | uuid | no | Bind to a specific spawned agent (uses its ZID + memory). Null → chain-default thread. |
messages | OpenAI-shape array | yes | Last 20 are kept; older history is summarised server-side. |
credential_id | uuid | no | BYOK credential to use; omit → uses chain's default LLM (Fireworks free or owner's BYOK). |
tools_enabled | bool | no | Default true. When false, the LLM cannot call framework tools (compute, contracts, transparency). |
Response · 200 OK (non-streaming)
{
"ok": true,
"agent_id": "5b7a9c12-...",
"reply": "KO42 enforces ≤0.1% precision against the Zeq metric tensor...",
"operators_invoked": ["KO42"],
"compute_results": [ { "result": {...}, "proof_digest": "abc123..." } ],
"tally_charge": {
"charged": 25,
"burned": 20,
"toFoundation": 5,
"remainingAfter": 118
},
"x_zeq_compliance_envelope": "env_2026-05-10T13:08:32Z_..."
}
The operators_invoked and compute_results arrays surface what the
LLM actually called via tools — the Pulse renders these inline as proof
cards under each reply.
Streaming response
Set Accept: text/event-stream to receive SSE chunks
(data: {delta: "..."} lines). Useful for long replies; the Pulse
streams by default.
Errors
| Status | Code | Cause |
|---|---|---|
400 | slug_required | Missing slug. |
400 | messages_required | Empty messages array. |
402 | INSUFFICIENT_BALANCE | Wallet < 25 ZEQ. Falls back to a self-heal message rendered by the Pulse. |
404 | slug_not_found | Slug doesn't resolve. |
429 | RATE_LIMITED | Per-slug quota. |
CORS
This endpoint allows wildcard CORS (Access-Control-Allow-Origin: *)
because it's the surface the Pulse uses cross-domain. Auth happens via
the entangled state's site SDK key, attached server-side at proxy time, so the
public origin never sees the key.
Related
- Pulse — what calls this
- Embed the Pulse — how third-party sites get an Pulse
- BYOK — pass
credential_idto use your own model - Agent runtime — sibling endpoints