AI Gateway - Pay for AI inference with Machine Payments
Cloudflare AI Gateway launched a beta feature called Machine Payments, enabling users to pay for eligible model inference via stablecoin wallets using the x402 protocol.
Why this signal matters
Cloudflare has introduced Machine Payments in beta for AI Gateway, allowing inference requests to be paid directly from a stablecoin wallet using the x402 protocol instead of drawing from prepaid credit balances. This feature is currently limited to the '/ai/run' endpoint across select open models (such as z-ai/glm-4.7-flash). To utilize x402, clients send requests with a Cloudflare API token and a 'Payment-Method: x402' header. An x402-compatible client then handles the resulting payment challenge by signing an authorization from the wallet and retrying the request. Access is currently restricted to US-based customers who also have a credit card on file.
Actionable summary
AI Gateway beta supports the x402 protocol for machine-to-machine payments via stablecoin wallets on the /ai/run endpoint. Requests require an x402-compatible client, a Cloudflare API token, the 'Payment-Method: x402' header, a credit card on file, and US residency.
- Agent usefulness
- 80/100
- Confidence
- 90%
- Canonical data
- JSON + Markdown
What builders should check
- Verify US residency eligibility and ensure a credit card is on file with Cloudflare.
- Implement or configure an x402-compatible client capable of signing wallet authorizations in response to payment challenges.
- Include the 'Payment-Method: x402' header and a valid Bearer token when making calls to the '/ai/run' endpoint.
- Review Cloudflare documentation to confirm the list of eligible open models supported by Machine Payments.