Autonomous Agent Payments
AI agents need to call APIs autonomously — without human-managed API keys, billing accounts, or pre-authorized subscriptions. Two open standards, x402 and MPP (Machine Payments Protocol), solve this by embedding micropayments directly into HTTP requests.
0x swap endpoints are available through both protocols via the Alchemy AgentPay proxy. Agents pay $0.01 per request in USDC. No 0x API key required — payment is the authentication.
Pay per request using USDC on Base or Solana. Built on the HTTP 402 status code — agents sign a payment, retry, and get a response.
Machine Payments Protocol. Pay via Tempo Mainnet (USDC.e). Uses a challenge–credential–receipt pattern over HTTP 402.
Using an AI coding agent?
Install the 0x-agentic-gateway skill. Your agent will handle protocol selection, package installation, wallet setup, and code generation automatically.
Then activate it in your agent session:
Manual integration
The sections below cover endpoints, wallet requirements, and working code examples for both protocols.
How it works
Both protocols follow the same HTTP-native pattern:
Server returns 402
The proxy responds with 402 Payment Required and machine-readable payment
requirements (amount, network, recipient).
Every payment includes the agent’s wallet address and an on-chain transaction hash in the PAYMENT-RESPONSE header — giving cryptographically verifiable per-caller attribution without API key management.
x402
x402 is an open standard that repurposes the HTTP 402 Payment Required status code for real-time stablecoin payments. Agents sign a USDC EIP-3009 transferWithAuthorization payload (EVM) or a Solana USDC transfer transaction (SVM), then retry the request with the encoded signature.
Endpoints
Both networks share the same URLs. The payment scheme your client registers determines which chain the payment runs on.
Cost
Wallet requirement: EVM wallet funded with USDC on Base (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913), or a Solana wallet funded with USDC on Solana mainnet (EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v). When paying via Solana, an EVM wallet is also required — swap execution runs on EVM, so the taker in the quote must be an EVM address.
Get a swap price and quote
Base (EVM)
Solana (SVM)
Reading the payment response
After a successful request, the PAYMENT-RESPONSE header contains base64-encoded settlement data:
The 0x API key is managed server-side — do not pass it from the client.
MPP
MPP (Machine Payments Protocol) is an open standard for machine-to-machine HTTP payments. It uses an extensible challenge–credential–receipt pattern: the server issues a WWW-Authenticate challenge, the client returns a credential (payment proof), and the server confirms with a receipt.
0x MPP endpoints use Tempo Mainnet (chainId 4217) as the payment rail, settled in USDC.e.
Endpoints
Both endpoints proxy the 0x Swap API v2 (AllowanceHolder flow) on Base.
Cost
Wallet requirement: EVM wallet funded with USDC.e on Tempo Mainnet (0x20C000000000000000000000b9537d11c60E8b50).
Get a swap price and quote
Tempo Mainnet (chainId 4217) is the payment network. Swap execution always runs on Base (chainId 8453) — USDC.e on Tempo pays for API access; the swap itself settles on Base.
Next steps
- 0x Agentic Gateway skill — install with
npx skills add 0xProject/0x-ai - x402 documentation — full protocol spec
- MPP documentation — full protocol spec and SDK reference
- 0x Swap API reference — query parameters, response fields, and error codes
- Supported Chains — chains available for swap execution