Agents and payments

Pay per call (x402)

No key, no account. The request itself carries the payment.

1. Ask

Send a normal request with no Authorization header. Set max_tokens: it bounds the amount you will be asked to sign.

curl
curl -i https://arcrouter.co/v1/chat/completions \
  -H "content-type: application/json" \
  -d '{"model":"gpt-oss-20b","max_tokens":600,"messages":[{"role":"user","content":"hi"}]}' 

2. Get the price

The answer is 402 Payment Required. The challenge is in the body and, base64-encoded, in the PAYMENT-REQUIRED header.

402 body
{
  "x402Version": 2,
  "resource": { "url": "https://arcrouter.co/v1/chat/completions", "mimeType": "application/json" },
  "accepts": [{
    "scheme": "exact",
    "network": "eip155:5042",
    "asset": "0x3600000000000000000000000000000000000000",
    "amount": "1310",
    "payTo": "0x...treasury",
    "maxTimeoutSeconds": 60,
    "extra": { "name": "USDC", "version": "2" }
  }]
}

amount is atomic USDC (6 decimals). It is a ceiling: your full input plus max_tokens of output at the posted rate.

3. Sign and resend

Sign an EIP-3009 transferWithAuthorization for exactly that amount to payTo, wrap it in an x402 payment payload, base64 it, and resend the same request with a PAYMENT-SIGNATURE header. The Arcus facilitator verifies it, broadcasts it and pays the gas. You never send a transaction yourself.

Any x402 v2 client does all of this for you; see the snippet in Prepaid keys and point it at /v1/chat/completions.

4. Get the answer, and the change

The response carries PAYMENT-RESPONSE (the settlement transaction) and X-ArcRouter-Charge-USDC (what the call really cost). The difference between the ceiling you paid and the real charge is refunded to your wallet in batches.

Keep max_tokens close to what you expect. A tight ceiling means less USDC in flight per call. If you make many calls, a prepaid key is charged exact cost with nothing to refund.

Discovery

Agent directories can read /.well-known/x402: endpoints, models, prices, the settlement asset and the facilitator.