nano-empire-tollbooth · live on PyPI

Get paid every time an AI agent calls your function

One Python decorator. Usage metering, signed receipts, reputation tracking. 100 calls free. No credit card.

$ pip install nano-empire-tollbooth Try the simulator
real run · paper mode · no real money moves
machine economy: connecting…watch live →

Three lines, then you are metering

# pip install nano-empire-tollbooth
from nano_empire_tollbooth import monetize

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

# Every call is metered, logged to a JSONL ledger, and settled.
# First 100 calls run free in paper mode. No card required.

New to the idea? Start with monetize a Python function in 10 lines or read why AI agents need payment rails.

Why teams use it

Per-call accounting

Attribute cost to a single function call instead of one flat infrastructure bill.

Escrow lifecycle

Lock on call, release on success, refund on failure. Failed work does not accrue cost.

Per-agent daily caps

A runaway agent hits its ceiling in hours, not at the end of the month.

Append-only ledger

Every charge is one JSON line with timestamps and status. Auditable by default.

Building agents or tools? See agent-to-agent payments, MCP server monetization, and the x402 protocol explained.

Copy a recipe for your stack

Same decorator everywhere. Pick your framework, copy, paste, charge.

FastAPI route

from nano_empire_tollbooth import monetize

@app.post("/summarize")
@monetize(price_usd=0.01)
async def summarize(req: Request):
    return run(await req.json())

MCP tool

from nano_empire_tollbooth import monetize

@mcp.tool()
@monetize(price_usd=0.05)
def search_docs(query: str) -> str:
    return index.search(query)

LangChain tool

from nano_empire_tollbooth import monetize

@tool
@monetize(price_usd=0.02)
def get_signal(ticker: str) -> str:
    """Market signal for a ticker."""
    return fetch_signal(ticker)

Plain function

from nano_empire_tollbooth import monetize, get_usage

@monetize(price_usd=0.01)
def translate(text: str, lang: str) -> str:
    return llm(text, lang)

print(get_usage())

Agents are first-class visitors here

Humans get the tour. Machines get a door. Every entrance below is live.

machine entrances

# experience a real x402 challenge
curl -X POST https://api.nanoempireai.com/x402/summarize

# one-fetch storefront + full API for your context window
https://neuralempireai.com/.well-known/agent.json
https://neuralempireai.com/llms-full.txt

# run the payment loop inside Claude / Cursor
{ "mcpServers": { "tollbooth": { "command": "tollbooth-mcp" } } }

Free and Pro

Free · paper mode
$0
  • 100 metered calls
  • Full local JSONL ledger
  • Escrow simulation
  • Per-agent caps
Start free

After purchase, set TOLLBOOTH_LICENSE_KEY to activate Pro (see your receipt email for the key). Payment content is informational and not financial advice.

Questions? Want a Pro key? roblambert9@gmail.com — I read every email.