How to Make Your API Agent-Discoverable with llms.txt
AI agents don't browse Google. They crawl llms.txt at your domain root. Here's how to make your API findable.
The Discovery Problem
Autonomous agents are crawling the web right now looking for APIs to pay for. They don't read landing pages. They read machine-readable manifests:
-
/llms.txt— Your API's resume for agents -
/agents.json— Schema.org structured data -
/openapi.json— With x-402-pricing extensions
Without these files, agents skip you entirely.
What Goes in llms.txt
# Your API Name
## Services
- Service Name: Description
Price: $X.XX/call
Endpoint: POST /api/endpoint
Format: JSON in/out
## Authentication
- Protocol: x402 (HTTP 402)
- Currency: USDC on Base
- Gasless: true
## Payment
- Free tier: 5 calls/day per IP
- Paid: $0.05/call
What Goes in agents.json
{
"@context": "https://schema.org",
"@type": "ItemList",
"itemListElement": [{
"@type": "Service",
"name": "Your Service",
"description": "What it does",
"offers": {
"@type": "Offer",
"price": "0.05",
"priceCurrency": "USD"
},
"availableChannel": {
"@type": "ServiceChannel",
"serviceUrl": "https://api.yoursite.com/endpoint"
}
}]
}
The 3-Pillar Stack
| File | Purpose | Required |
|---|---|---|
llms.txt |
Human + machine readable manifest | YES |
agents.json |
Schema.org structured data | YES |
openapi.json |
With x-402-pricing extensions | YES |
The Payment Protocol
Agents pay via x402 (HTTP 402):
- Agent calls your endpoint
- Your API returns HTTP 402 with price + wallet
- Agent pays USDC on Base (gasless, EIP-3009)
- Agent retries with signed receipt
- You return 200 OK
Live Example
Our parser API generates these files automatically:
Result: 2 agents found us organically, paid $0.125 total.
One-Line Integration
pip install nano-empire-tollbooth
from nano_empire_tollbooth import monetize
@monetize(price_usd=0.05)
@app.post("/api/your-endpoint")
async def your_endpoint(data: dict):
return {"result": your_logic(data)}
The SDK generates all three discovery files automatically.
Proof It Works
Our proof chain: $0.125 from 2 agents, 5 calls
View Live Proof Chain \u2192
Get Started
pip install nano-empire-tollbooth
The SDK generates all three discovery files + x402 middleware + proof chain.
Live proof: https://api.nanoempireai.com/proof/summary
SDK: pip install nano-empire-tollbooth
Top comments (0)