lorem-ipsum-api
March 29, 2026 ยท View on GitHub
Hono API running on Cloudflare Workers (Wrangler) that serves generated lorem ipsum text.
Install dependencies
bun install
Run locally (Wrangler)
bun run dev
Visit http://127.0.0.1:8787.
API
GET /GET /llms.txtGET /generate?count=2&units=paragraphs&format=plainGET /openapi.json
/generate supports both MPP and x402 paywalls. Unpaid requests return 402 Payment Required with both protocol challenges.
/openapi.json is generated from the route Zod schemas via @hono/zod-openapi, then enriched with MPP discovery metadata (x-service-info and x-payment-info).
You can optionally set DISCOVERY_OWNERSHIP_PROOF to include x-discovery.ownershipProofs in the OpenAPI output.
/ serves the HTML landing page with favicon, Open Graph, and Twitter card metadata.
Static files
Files in static/ are served directly by the Worker via the Cloudflare assets binding.
GET /andGET /llms.txtboth returnstatic/llms.txt- You can add arbitrary files under
static/and request them by path
Query params:
count: integer from1to50(default1)units:words,sentences,paragraphs(singular forms also accepted)format:plainorhtml
You can also pass the same fields as an optional JSON body on GET /generate for agent/discovery compatibility.
MPP paywall config
Configure these variables in .dev.vars for local development and as Worker vars/secrets in Cloudflare:
MPP_SECRET_KEY(required, no default)MPP_AMOUNT(required, decimal string)MPP_DECIMALS(required, non-negative integer)MPP_CURRENCY(required)MPP_RECIPIENT(required, no default)
All MPP variables are required and validated with Zod. Invalid or missing values return 500 for /generate and /openapi.json.
x402 config
X402_FACILITATOR_URL(defaulthttps://facilitator.payai.network)X402_NETWORK(defaulteip155:8453)X402_PAY_TO(optional; defaults toMPP_RECIPIENT)
x402 USD price is derived from MPP_AMOUNT (for example MPP_AMOUNT=0.001 becomes x402 price="\$0.001").
On unpaid /generate requests, the API returns both WWW-Authenticate (MPP) and PAYMENT-REQUIRED (x402) headers. Use either protocol and retry the same request with Payment-Receipt (MPP) or PAYMENT-SIGNATURE (x402).
Test payment flow with mppx CLI:
bunx mppx --inspect "http://127.0.0.1:8787/generate"
bunx mppx "http://127.0.0.1:8787/generate?count=2&units=paragraphs&format=plain"
If no MPP wallet is configured yet, use Tempo skill setup: https://tempo.xyz/SKILL.
Test x402 flow with the helper script:
bun --env-file=.env.local run x402:request -- "http://127.0.0.1:8787/generate?count=2&units=paragraphs&format=plain"
Deploy
bun run deploy