Skip to content

Pay per call with x402

An agent without a Muro account can still paint room photos. visualize_room and relight_room accept payment per call in USDC on Base mainnet through x402, an open protocol for paying for API calls with a signed stablecoin transfer. You need no sign-up, API key or subscription. Your agent only needs a wallet holding USDC on Base and an x402-capable client.

If the call carries a Muro API key or an OAuth session, x402 is not used: the call is paid from that account’s credits.

Tool Price
visualize_room, Standard (≈1K) 0.25 USDC per colour
visualize_room, HD (≈2K) 0.50 USDC per colour
visualize_room, Ultra (≈4K) 0.75 USDC per colour
relight_room 0.25 USDC
get_visualization Free (the job_id is the proof of purchase)
search_paint_colors, get_paint_color, find_equivalents, list_brands Free, no payment at all
get_credits Not available over x402; needs a Muro API key

The price of a visualize_room call depends on its arguments: 3 colours in HD cost 1.50 USDC. It is computed for each call and returned in the payment requirements, so the client always sees the exact amount before signing anything.

The flow follows the MCP x402 convention also used by Cloudflare’s agents/x402: payment data travels in the tool call’s _meta.

  1. Call the tool without payment. Here: visualize_room with 2 colours in HD. The result has isError: true, a human-readable line such as This call costs 1.00 USDC on Base, paid with x402., and the machine-readable requirements in _meta["x402/error"]:

    {
    "x402Version": 2,
    "error": "PAYMENT_REQUIRED",
    "resource": { "url": "x402://visualize_room", "description": "Paint a room photo", "mimeType": "application/json" },
    "accepts": [
    {
    "scheme": "exact",
    "network": "eip155:8453",
    "amount": "1000000",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "payTo": "0x681F7E6B36a7E12d728d2bF2db3aD55FF250F564",
    "maxTimeoutSeconds": 300,
    "extra": { "name": "USD Coin", "version": "2" }
    }
    ]
    }

    amount is in USDC base units (6 decimals): 1000000 is 1.00 USDC. asset is native USDC on Base, and payTo is Muro’s receiving wallet.

  2. Sign and retry. The client signs an EIP-3009 transferWithAuthorization for that amount (the exact EVM scheme), base64-encodes the x402 payment payload, and repeats the same call with it in _meta["x402/payment"].

  3. Muro verifies, paints, then settles. The payment is verified first. Muro then does the work. The transfer is settled on-chain only after the images were delivered. The result carries _meta["x402/payment-response"]:

    { "success": true, "transaction": "0x…", "network": "eip155:8453", "payer": "0x…" }

Payments are verified and settled by the PayAI facilitator.

  • A failed painting costs nothing. If the work fails, or any colour fails, the payment is not settled and the result ends with You were not charged: the x402 payment was not settled.
  • Colours still rendering count as delivered. A long job can return before every image is ready; the payment settles and you fetch the rest with get_visualization for free.
  • Pending settlement. If the on-chain transfer has not confirmed in time, you still get the images, with "x402/payment-response": { "success": false, "errorReason": "settlement_pending" }. The transfer will most likely land shortly after.
  • Settlement refused. If the facilitator rejects the settlement after the work was done, the result is withheld and you get a fresh payment requirement instead.
  • A payment that fails verification returns the requirements again, with the reason in error (and payer, when known), for example INVALID_PAYMENT for a token that is not valid base64 JSON.

Any MCP client that implements the _meta["x402/payment"] convention can pay. For example, Cloudflare’s agents package has withX402Client, which wraps an MCP client, reads x402/error, asks for confirmation and retries with the payment. Clients that do not support x402 see the payment-required message and can fall back to a Muro API key.

x402 calls share the limits of keyed calls: 1 to 12 colours per call, photos up to 12 MB (JPEG, PNG or WebP) and the rate limits in Pricing and limits.