x402 Payments
The standard protocol for machine-to-machine AI API payments.
What is x402?
x402 is a protocol extending the HTTP 402 Payment Required status code. It allows autonomous agents and decentralized systems to pay for their own API usage dynamically, without pre-funding centralized accounts with credit cards.
How it works
The x402 flow operates in four steps:
- Unauthenticated Request: The client makes an API request without an API key or auth token.
- 402 Payment Required: InferHood calculates the cost of the request (based on tokens, complexity, etc.) and returns a
402 Payment Requiredresponse containing a payment invoice/challenge. - Payment: The client fulfills the payment on the designated chain (e.g., Robinhood Chain).
- Fulfillment: The client retries the request, including the payment receipt/proof in the
Payment-Authorizationheader. InferHood verifies the payment and returns the result.
Payment Authorization Header
Once payment is complete, the client attaches the proof to the original request:
bash
curl https://api.inferhood.xyz/v1/chat/completions \
-H "Payment-Authorization: x402-proof payload=..."Robinhood Chain
Currently, InferHood supports settlement via the Robinhood Chain for minimal fees and sub-second finality. Ensure your agent wallet has sufficient R-USD balances.