The idea
Other approaches stream every pixel of the UI live from a video-generating model. That's beautiful but needs server GPUs and real bandwidth. Paperback does the same thing a different way , the model emits a tiny description of what to show, and your device renders it.
Two representations are demonstrated side-by-side:
#1 · Components
A constrained JSON DSL. The model is only allowed to emit these node types, so output is always renderable, accessible, and crisp. The left pane is a real DOM tree.
#2 · SVG
A sanitized SVG document. Infinite resolution, no GPU, typically under a few KB per scene. Great for bespoke layouts, charts, and diagrams.
What the model sees
When the live model is invoked, it's given a strict system prompt listing the allowed node types and their props, then asked to produce exactly one JSON object (for Components) or one SVG document (for SVG). Output is sanitized before it hits the DOM , no scripts, no event handlers, no external references.
{
"type":"card",
"children":[
{"type":"heading","level":2,"text":"Welcome"},
{"type":"text","text":"Sign in to continue.","muted":true},
{"type":"input","placeholder":"[email protected]"},
{"type":"button","label":"Continue","variant":"primary"}
]
}
Primitives available (45)
Presets vs. live model
Paperback ships with a library of hand-crafted presets. If your prompt matches one (e.g. “weather card for Tokyo”), it's streamed in token-by-token to mimic real inference , instant, free, unlimited. If no preset matches (e.g. “weather card for Florence”), the request is forwarded through a tiny PHP proxy on this host to Claude. The proxy uses a shared demo key rate-limited to 3 custom renders per hour per visitor. Paste your own sk-ant-… key in the footer to bypass the limit and bill your own account instead.
Why it works
Structure is enormously more compact than pixels. A moderately complex screen is a few KB of JSON vs. many megabytes of video per second. A layout engine and an SVG renderer already live on every device , we just let the model drive them.