Skip to main content

Monetize any Python function with one decorator. 100 free calls. $19/mo Pro tier. Agent payment SDK.

Project description

nano-empire-tollbooth

Monetize 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)

That's it. Every call to summarize() is metered, logged, and settled.

Install

pip install nano-empire-tollbooth

How it works

  1. Decorate any function (sync or async) with @monetize(price_usd=...)
  2. First 100 calls run free in paper mode — full functionality, no charge
  3. After 100 calls, you get a prompt to upgrade to Tollbooth Pro ($19/mo)
  4. Pro unlocks live payments via x402 — agents pay real USD per call
from nano_empire_tollbooth import monetize

# Async works too
@monetize(price_usd=0.05)
async def translate(text: str, lang: str) -> str:
    return await my_async_llm(text, lang)

# Check your usage
from nano_empire_tollbooth import get_usage
print(get_usage())  # {'__main__.summarize': 42, '__main__.translate': 7}

What you get

Free Pro ($19/mo)
Calls 100 paper-mode Unlimited
Payments Simulated Live USD via x402
Ledger Local JSONL Local JSONL + cloud sync
Escrow Paper receipts Real settlement
Daily limits Per-agent caps Per-agent caps

Configuration

from nano_empire_tollbooth import TollboothConfig, create_tollbooth

config = TollboothConfig(
    toll_per_message_usd=0.01,   # default rate
    paper_mode=True,              # False for live payments
    max_daily_toll_per_agent=10,  # daily cap per agent
)
booth = create_tollbooth(config)

Or set via environment:

TOLLBOOTH_PAPER_MODE=false  # enable live payments

License

MIT

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.2.tar.gz (11.8 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.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nano_empire_tollbooth-0.2.2.tar.gz
  • Upload date:
  • Size: 11.8 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.2.tar.gz
Algorithm Hash digest
SHA256 3e7e22da84ac78547f34cf0d28fe0859492294e9a4af206a4414a3b3d1ef2be0
MD5 a7edbe4a2456535eecefddbcc1b336e0
BLAKE2b-256 3a34c32030bdde99e7d4112590bfd2b0fa77d5b33f2b0b267f9597a325d0b4f4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for nano_empire_tollbooth-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a3b506dc44d2ded77276489c0431b1df574cad2a9c3ac394c27aefad9d30549b
MD5 c99e9eb174374dafbcf5053ea99613ca
BLAKE2b-256 1f27baf29e67c03c9a1c460f1c809726d6b659e43936389063ac285a8ec08dfe

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