Using Tollstile with coding agents
Give Claude Code, Codex, Cursor, and other coding agents what they need to add payments with Tollstile.
Tollstile is designed to be picked up by coding agents. Give yours one of these, then describe the outcome you want.
Machine-readable docs
| Resource | Use |
|---|---|
/llms.txt | Index of every page, grouped by task |
/llms-full.txt | All docs as one Markdown file |
/llms.mdx/docs/<page>/content.md | Any single page as Markdown (the Copy Markdown button) |
Agent skill
The repository ships a skill at skills/tollstile/SKILL.md with the rules an agent needs: which package to install, how to price a route, how to choose a flow, and what never to do (floats for money, catching provider errors, skipping reconciliation).
Add it to your agent's skills folder, or reference it from your project's AGENTS.md:
When adding payments, pay-per-call pricing, credits, or x402/MPP support, follow
https://github.com/tollstile/tollstile/blob/main/skills/tollstile/SKILL.mdPrompts that work
Add $0.05 pay-per-call pricing to GET /weather in this Hono app using Tollstile.
Use the test rail for local development.Let signed-in users with credits call POST /v1/generate for $0.02 per call using
Tollstile credits, and require payment from everyone else.Charge up to $0.50 per render with Tollstile and settle the actual cost after the
render finishes.Add a daily spend limit of $20 per payer to every paid route.What a correct change looks like
createTollstileis created once and reused.- Prices are strings like
"$0.05"orupTo("$0.50")— never numbers. - Routes are wrapped with the framework adapter, e.g.
tollstile(toll.price("$0.05"))for Hono. toll.reconcile()runs on a schedule in production.- Live rails come with a
secretfrom the environment, and the test rail is never deployed next to them.
Check the current contract
Use Core design, Errors, Idempotency, and the conformance kit. In the repository, compare SPEC.md with packages/tollstile/src/core/types.ts and the implementation before changing behavior. Inspect gate.plan when composing rails; incompatible rails are excluded per route. Include a retry key in paying clients and document how stored results are retrieved.