Your agent can do all of this without you.
Sign up, top up, make a key, find an API, pay it. Every step is one HTTP request. Every page on this site has a Markdown twin. You keep the master key and set the limits.
Read https://anyfare.agents.bakingbad.dev/llms.txt and follow it. Ask me before you sign up, top up, or make a key. Pay with a payment key, never the master key. Keep spend under $5 a day and $0.05 a call.
Or, if your agent has its own wallet: it needs nothing from us. It pays our 402 in USDC on NEAR, Base or Solana, or over MPP on Tempo.
Start in four requests
Each request runs as written. Keys and ids in the answers are placeholders: yours come from the answers.
curl -X POST https://api.anyfare.agents.bakingbad.dev/v1/accounts
→ { "id": "<account id>", "masterKey": "afm_live_…", "freeCredits": "0.1", … }Save the master key where only your user can read it. A new account may get free Credits to try: "freeCredits" says how much.
curl -X POST https://api.anyfare.agents.bakingbad.dev/v1/keys \
-H "Authorization: Bearer $ANYFARE_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{"label":"research","dailyBudget":"5","maxPrice":"0.05"}'
→ { "id": "<key id>", "dailyBudget": "5", "maxPrice": "0.05", …, "key": "af_live_…" } shown onceThe agent calls with this key, never with the master key.
curl -X POST https://api.anyfare.agents.bakingbad.dev/v1/topups \
-H "Authorization: Bearer $ANYFARE_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{"network":"base","token":"USDC","amount":"20"}'
→ { "id": "<top-up id>", "status": "waiting", "depositAddress": "<deposit address>", "sendAtLeast": "19.9", "payBy": "…", … }Send at least "sendAtLeast" to "depositAddress" before "payBy", then read GET https://api.anyfare.agents.bakingbad.dev/v1/topups/<id> until "status" is "credited". The networks and tokens: GET https://api.anyfare.agents.bakingbad.dev/v1/topups/options.
curl -i "https://pay.anyfare.agents.bakingbad.dev/pro-api.coinmarketcap.com/x402/v3/cryptocurrency/quotes/latest?symbol=BTC&convert=USD" \
-H "Authorization: Bearer $ANYFARE_PAYMENT_KEY"
200 OK Anyfare-Receipt: id="pay_…", amount="0.01", currency="USD"Check first, free: GET https://pay.anyfare.agents.bakingbad.dev/_/check?url=<link>. Left on the key: GET https://pay.anyfare.agents.bakingbad.dev/_/key.
The API
Two hosts. The pay host takes payment keys, or an x402 or MPP payment. The API host takes the master key. Public reads need no key.
pay.anyfare.agents.bakingbad.dev/_/check?url=<link>Is a link payable, at what price, and what we quote. Free, and pays nothingNo keyBuiltpay.anyfare.agents.bakingbad.dev/<host>/<path>Pay any x402 or MPP API: put the pay host in front of its link, without `https://`Payment key, x402 or MPPBuiltpay.anyfare.agents.bakingbad.dev/_/keyThe limits of a payment key and what is left of them, and the balancePayment keyBuiltapi.anyfare.agents.bakingbad.dev/v1/accountsSign up. Returns the master key, onceNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/accountThe account the master key belongs toMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/account/master-key/rotateA new master key. The old one stops working at onceMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/keysMake a payment key with limits. The key is shown onceMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/keysEvery payment key of the account, with what each spentMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/keys/:idChange the limits of a payment keyMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/keys/:idRevoke a payment key. It stops working at onceMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/balanceThe Credits balance: available, and held for calls in flightMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/paymentsEvery call the account paid, newest first, in pagesMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/topups/optionsThe networks and tokens a top-up takes, and the least to send on eachNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/topupsAsk for a deposit address: send a token there and the balance growsMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/topups/:idWhere a top-up isMaster keyBuiltapi.anyfare.agents.bakingbad.dev/v1/catalogThe endpoints Anyfare has routed, with prices and the ways to payNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/callsFinished calls through Anyfare, newest first, in pagesNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/calls/streamCalls as they finish, as server-sent events. The same filters as the listNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/calls/:idThe public receipt of one callNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/statsPlatform numbers: calls, volume, buyers, services, how buyers paid, top-upsNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/stats/liveFresh numbers for today and the last 24 hours, and calls per minuteNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/stats/topThe top services, endpoints, ways to pay and top-up tokens of a periodNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/servicesServices with at least one paid call: price, calls, buyers, volumeNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/services/:hostOne service: its numbers, endpoints, days, ways to pay and top buyersNo keyBuiltapi.anyfare.agents.bakingbad.dev/v1/endpoints/statsThe numbers of one endpoint: calls, buyers, volume, days, ways to payNo keyBuiltllms.txt
The guide an agent reads first. Plain text, with absolute links.
# Anyfare
> Anyfare is a payment router for AI agents. Put the pay host in front of the link of any x402 or MPP API and pay it from the chain you are on, or with a payment key against a balance of Credits. You pay only for calls the API answered with 2xx.
## Hosts
- Pay: https://pay.anyfare.agents.bakingbad.dev. A routed call is https://pay.anyfare.agents.bakingbad.dev/<host>/<path>: the API's link without https://.
- API: https://api.anyfare.agents.bakingbad.dev. Sign up, payment keys, top-ups, and public reads of calls and numbers.
- Website: https://anyfare.agents.bakingbad.dev. Every page has a Markdown twin: add .md to its URL.
- Console: https://console.anyfare.agents.bakingbad.dev. For people.
## Rules
- Ask your user before you sign up, make a key, or top up.
- Keep the master key in a file only the user can read. Never print it, paste it into a chat, or put it in a URL.
- Pay with a payment key, never the master key. The master key works on the API host only.
## Steps
1. Check a link. Free, no key. "payable": true comes with the price and our quote.
```sh
curl "https://pay.anyfare.agents.bakingbad.dev/_/check?url=pro-api.coinmarketcap.com/x402/v3/cryptocurrency/quotes/latest"
```
2. Sign up. A new account may get free Credits: the answer says how much. "masterKey" is shown once: the command saves the answer to anyfare-account.json, which only the user can read.
```sh
umask 077
curl -s -X POST https://api.anyfare.agents.bakingbad.dev/v1/accounts > anyfare-account.json
```
3. Make a payment key with the limits your user sets. "key" is shown once: save it as ANYFARE_PAYMENT_KEY.
```sh
ANYFARE_MASTER_KEY=$(jq -r .masterKey anyfare-account.json)
curl -X POST https://api.anyfare.agents.bakingbad.dev/v1/keys \
-H "Authorization: Bearer $ANYFARE_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{"label":"research","dailyBudget":"5","maxPrice":"0.05"}'
```
4. Call. Only a 2xx answer is charged, and it carries Anyfare-Receipt: id="pay_...". Read the receipt at https://api.anyfare.agents.bakingbad.dev/v1/calls/<id>.
```sh
curl -i "https://pay.anyfare.agents.bakingbad.dev/pro-api.coinmarketcap.com/x402/v3/cryptocurrency/quotes/latest?symbol=BTC&convert=USD" \
-H "Authorization: Bearer $ANYFARE_PAYMENT_KEY"
```
5. No account, a wallet instead. A call with no payment answers 402 with every way to pay: the JSON body and the PAYMENT-REQUIRED header list x402 options (USDC on NEAR, Base or Solana), the WWW-Authenticate: Payment header holds the MPP charge (USDC.e on Tempo), and "credits" says how to use a key. Pay one option and send the same call again with PAYMENT-SIGNATURE (x402) or Authorization: Payment (MPP). Your payment settles only after a 2xx answer. Each option, step by step: https://anyfare.agents.bakingbad.dev/llms-full.txt, section "The 402".
6. Top up with any token NEAR Intents takes. GET https://api.anyfare.agents.bakingbad.dev/v1/topups/options lists networks, tokens and minimums. POST https://api.anyfare.agents.bakingbad.dev/v1/topups with network, token and amount (master key) answers a deposit address. Send there, then read GET https://api.anyfare.agents.bakingbad.dev/v1/topups/<id> until status is credited.
7. Before you spend: GET https://pay.anyfare.agents.bakingbad.dev/_/key with the payment key shows its limits and what is left. On 402 insufficient_balance ask your user to top up. On 402 key_budget_exceeded or key_price_limit ask before you raise a limit. On 429 wait Retry-After seconds. On 503 nothing was charged.
## Read more
- [Every endpoint, request and answer](https://anyfare.agents.bakingbad.dev/llms-full.txt): llms-full.txt, with the 402, the errors and the limits
- [Agent skill](https://anyfare.agents.bakingbad.dev/skills/anyfare-buyer/SKILL.md): the steps above as a skill to install
- [OpenAPI, API host](https://api.anyfare.agents.bakingbad.dev/openapi.json)
- [OpenAPI, pay host](https://pay.anyfare.agents.bakingbad.dev/openapi.json)
- [For agents](https://anyfare.agents.bakingbad.dev/agents): the same, with the API as a table. Twin: https://anyfare.agents.bakingbad.dev/agents.md
- [Services](https://anyfare.agents.bakingbad.dev/services.md): the services agents paid, and [calls](https://anyfare.agents.bakingbad.dev/calls.md), newest first
- [Check a link](https://anyfare.agents.bakingbad.dev/check.md?url=<link>): the check, with the numbers of the API behind it
- A call's receipt: https://anyfare.agents.bakingbad.dev/calls/<id>.md or https://api.anyfare.agents.bakingbad.dev/v1/calls/<id>