A shipment of 200 boxes needs 200 labels. It only needs one decision about where to put the box number. If your shipping app already has those numbers, sending them all to a model and asking it to copy them back spends tokens on a job the app can do exactly.
Give the model a field contract
Send a short brief such as “One A4 page per box, with its label in
14-point type.” Include the shape
{pages: [{label: string}]} and one synthetic record. A
version 1 Pressjet template can express the repeated page in a few
lines. The field name is stable even when tomorrow’s shipment
contains different boxes.
{
"v": 1,
"root": [
"document",
{ "title": "Dispatch slips" },
[
"each",
"pages",
[
"page",
{ "size": "A4", "style": { "padding": 32 } },
["text", { "style": { "fontSize": 14 } }, ["field", "label"]]
]
]
]
}
import { readFile, writeFile } from "node:fs/promises";
import { renderLocal } from "pressjet/local";
import { expandTemplate } from "pressjet/template";
const template = JSON.parse(await readFile("dispatch-slips.json", "utf8"));
const pages = Array.from({ length: 200 }, (_, i) => ({
label: String(i + 1).padStart(5, "0"),
}));
const pdf = await renderLocal(expandTemplate(template, { pages }));
await writeFile("boxes.pdf", pdf);
import { readFile, writeFile } from "node:fs/promises";
import { renderLocal } from "pressjet/local";
import { expandTemplate } from "pressjet/template";
const template: unknown = JSON.parse(await readFile("dispatch-slips.json", "utf8"));
const pages: { label: string }[] = Array.from({ length: 200 }, (_, i) => ({
label: String(i + 1).padStart(5, "0"),
}));
const pdf = await renderLocal(expandTemplate(template, { pages }));
await writeFile("boxes.pdf", pdf);
Save the JSON as dispatch-slips.json to run the SDK
examples. Test a long label and one containing a leading zero. Keep
the value as a string so “00041” survives intact. With the template
CLI from the beta SDK, the bundled
dispatch-slips layout accepts the same data. From a
project with that CLI installed locally:
printf '%s' '{"pages":[{"label":"00041"},{"label":"00042"}]}' > boxes.json
./node_modules/.bin/pressjet-template check dispatch-slips boxes.json
./node_modules/.bin/pressjet-template render dispatch-slips boxes.json boxes.pdf
Choose the denominator before quoting a saving
In the direct authoring trial, Claude used a median of 15,787 output tokens to emit the entire 200-page JSON tree and 83 to design a template. That is a 99.47% reduction for that particular choice of representation. A coding agent can also write a short loop, so its usual workflow sets a tougher baseline.
In the separate end-to-end trial, naming the installed layout for 200 pages reduced mean output by 32.3% for Claude Code and 28.9% for Codex against their default workflows. Those sessions included reading the brief, using tools and checking the result. Once the app has the reviewed layout, a repeat shipment can skip the model call entirely. Original paragraphs still cost tokens to write, so for a narrative report ask for the new prose section by section and keep the surrounding layout in the app.
Template format and SDK · Direct authoring trial · Full agent sessions