Agents and payments

Pay per call (x402)

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

Preview specification. The API opens at launch; this page describes the interface it will serve.

1. Ask

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

curl
curl -i https://inferlane.xyz/v1/chat/completions \
  -H "content-type: application/json" \
  -d '{"model":"meta-llama/llama-3.3-70b-instruct","max_tokens":500,"messages":[{"role":"user","content":"ping"}]}'

2. Read the quote

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

402 body
{
  "x402Version": 2,
  "resource": { "url": "https://inferlane.xyz/v1/chat/completions", "mimeType": "application/json" },
  "accepts": [{
    "scheme": "exact",
    "network": "eip155:4663",
    "asset": "native",
    "amount": "61200000000",
    "payTo": "0x...lane-treasury",
    "maxTimeoutSeconds": 60
  }]
}

amount is in the asset's smallest unit. It is a ceiling: your full input plus max_tokens of output at the posted rate.

3. Sign and resend

Sign an authorization for exactly that amount to payTo, wrap it in an x402 payment payload, base64 it and resend the identical request with a PAYMENT-SIGNATURE header. The lane verifies it, settles on Robinhood Chain and runs the call.

Any x402 v2 client does all of this for you; reuse the snippet from prepaid keys and point it at /v1/chat/completions.

4. Settle the difference

The response includes a PAYMENT-RESPONSE header with the settlement transaction and the real charge. Whatever the ceiling did not use is refunded; see caching and refunds.

Descriptor

Agents can read the lane's payment terms before making a call at /.well-known/x402.