Skip to main content

nano-empire-tollbooth

Monetize and meter any Python function with one decorator.

from nano_empire_tollbooth import monetize

@monetize(price_usd=0.01)
def summarize(text: str) -> str:
    return my_llm(text)

Every call is metered and logged to a local JSONL ledger. Paper-mode metering is unlimited and free — a one-time upgrade prompt prints around call 100, and the function keeps working (it nags, it does not block).

Install

pip install nano-empire-tollbooth

Python 3.9+, one dependency (pydantic).

Command line

The package ships a tollbooth command that works over your local ledger:

tollbooth status                 # show tier (free/pro) and a ledger summary
tollbooth report                 # aggregate: calls, spend, by status
tollbooth report --json          # same, machine readable
tollbooth verify                 # integrity check of the ledger file
tollbooth export --format csv    # export the ledger (Pro)
tollbooth settle                 # batch-net released tolls into one charge-sized settlement (paper mode; --live fails closed until you wire your own rail)

Free vs Pro

What Pro actually unlocks today. No overstated claims.

Free Pro ($19/mo)
Metered calls Unlimited (paper mode) Unlimited (paper mode)
Local JSONL ledger Yes Yes
report and verify Yes Yes
Upgrade prompt Shown after 100 calls Suppressed
tollbooth export (CSV/JSON) No Yes
Default daily cap $10 / agent $1000 / agent

Pro is in private setup and not yet purchasable. The licensing pipeline (Ed25519-signed keys + checkout issuance) is built and tested but not wired live yet — so there's no buy link here on purpose. Watch the repo for availability.

When you have a key, activate it with:

export TOLLBOOTH_LICENSE_KEY=your-key

License validation is a real offline check: each key carries an Ed25519 signature from the issuer plus an expiry, verified locally with the published public key — no secret, no phone-home. A random, tampered, or expired key does not unlock Pro. Online revocation before expiry is on the roadmap.

Live settlement (experimental)

The tollbooth includes an x402 hook so you can wire your own live settlement verifier:

from nano_empire_tollbooth import Tollbooth, TollboothConfig

booth = Tollbooth(TollboothConfig(paper_mode=False))

async def my_verifier(wallet, tx_signature, amount_usd):
    # verify a real on-chain or off-chain payment, return True/False
    return await check_payment(wallet, tx_signature, amount_usd)

booth.set_x402_verifier(my_verifier)

This ships the escrow lifecycle (lock, release, refund) and the verifier hook. It does NOT include a hosted settlement backend. Connecting real funds is your responsibility and is on the project roadmap. This is informational and not financial advice.

How metering works

  1. Decorate any sync or async function with @monetize(price_usd=...).
  2. Each call writes a record to logs/toll_ledger.jsonl with a settlement hash.
  3. In paper mode (default) nothing is charged. Set paper_mode=False plus your own verifier to move real funds.

License

MIT

Metadata

Release files for nano-empire-tollbooth 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nano-empire-tollbooth 0.3.0
File Size Uploaded Provenance Actions
nano_empire_tollbooth-0.3.0.tar.gz 29.5 kB With provenance Details for nano_empire_tollbooth-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nano-empire-tollbooth 0.3.0
File Interpreter ABI Platform Actions
nano_empire_tollbooth-0.3.0-py3-none-any.whl Python 3 none any Details for nano_empire_tollbooth-0.3.0-py3-none-any.whl

Total release size: 53.3 kB

Release files / nano_empire_tollbooth-0.3.0.tar.gz

Download URL nano_empire_tollbooth-0.3.0.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7978542b76be90a23e3db783fd66cc9f4256de00d5efe9012debcabcb09e854a
BLAKE2b-256 checksum
How to use checksums
ff65be73ff11588f3dd102ec9d74f8dec3b24048058f9f5a6a52cec160ee9b5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.

Transparency log

Release files / nano_empire_tollbooth-0.3.0-py3-none-any.whl

Download URL nano_empire_tollbooth-0.3.0-py3-none-any.whl
Size 23.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4011185daacdafa4cee90509ada388df91fba43e6b088b5a4ca8e65d4e8e37c2
BLAKE2b-256 checksum
How to use checksums
f308e80fc65e2c215ce322518af9ae51021995bf0ac77dc05b1d65e0a1e85ec7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.

Transparency log

Security for nano-empire-tollbooth 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nano_empire_tollbooth-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page