Skip to main content

Monetize any Python function with one decorator. 100 free calls, then Pro for ledger analytics, CSV/JSON export, and higher limits.

Project description

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. The first 100 calls print an upgrade prompt once you cross the limit; the function keeps working.

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)

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

Activate Pro by setting the key you receive after purchase:

export TOLLBOOTH_LICENSE_KEY=your-key

Get a key: https://buy.stripe.com/14A9ATaI76K8gjo9JE1Nu0h

License validation is an offline check today (honor-system v1). Server-side validation is on the roadmap.

Live settlement (experimental)

The tollbooth includes an x402 hook so you can wire your own live settlem

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nano_empire_tollbooth-0.2.3.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nano_empire_tollbooth-0.2.3-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file nano_empire_tollbooth-0.2.3.tar.gz.

File metadata

  • Download URL: nano_empire_tollbooth-0.2.3.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for nano_empire_tollbooth-0.2.3.tar.gz
Algorithm Hash digest
SHA256 9638ad7a370bda8b52ed82d24e4e3c80d167fd090c2c9e129f442cbb60a7952e
MD5 c415984108680f8bdbc9f6e53e53a55f
BLAKE2b-256 3bd4df5464861df0b9701e856fd6c7d309da43be6f7ca51933284f5a368ffbae

See more details on using hashes here.

File details

Details for the file nano_empire_tollbooth-0.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for nano_empire_tollbooth-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a8b620544c243444b9d30d45df23f4be2253772a4adaae1801d7c02ac259b6d3
MD5 ce0da0bb34f86c30881adadeea9075a1
BLAKE2b-256 c3286a8311d6671b831bd4724220a99c4e86f49612acf65fa9b3ee460148a65c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page