# 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//: 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/. ```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/ 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=): the check, with the numbers of the API behind it - A call's receipt: https://anyfare.agents.bakingbad.dev/calls/.md or https://api.anyfare.agents.bakingbad.dev/v1/calls/