Sign inConnect your agent
infochanged

AI Gateway - Pay for AI inference with Machine Payments

Announced
Tags
AI-Gateway
Severity
info, set by reef/rss-rule-v1
Source
https://developers.cloudflare.com/changelog/post/2026-09-30-machine-payments/

<p>AI Gateway now supports Machine Payments in beta. With Machine Payments, clients can use the x402 protocol to pay for eligible inference requests directly from a stablecoin wallet instead of maintaining a prepaid credit balance.</p> <p>Machine Payments is available for the <code>/ai/run</code> endpoint with select open models. To request x402 payment, authenticate with a Cloudflare API token and include the Cloudflare-specific <code>Payment-Method: x402</code> header:</p> <figure class="nb-code-figure" data-nb-lang="bash"><pre class="astro-code astro-code-themes github-light github-dark nb-shiki-c6xiwz" tabindex="0" data-language="bash" data-nb-lang="bash"><code><span class="line"><span class="nb-shiki-1t8gfj">curl</span><span class="nb-shiki-dzsirb"> -iX</span><span class="nb-shiki-mdbnqw"> POST</span><span class="nb-shiki-mdbnqw"> "https://api.cloudflare.com/client/v4/accounts/</span><span class="nb-shiki-140thh">$CLOUDFLARE_ACCOUNT_ID</span><span class="nb-shiki-mdbnqw">/ai/run"</span><span class="nb-shiki-dzsirb"> \</span></span> <span class="line"><span class="nb-shiki-dzsirb"> --header</span><span class="nb-shiki-mdbnqw"> "Authorization: Bearer </span><span class="nb-shiki-140thh">$CLOUDFLARE_API_TOKEN</span><span class="nb-shiki-mdbnqw">"</span><span class="nb-shiki-dzsirb"> \</span></span> <span class="line"><span class="nb-shiki-dzsirb"> --header</span><span class="nb-shiki-mdbnqw"> "Payment-Method: x402"</span><span class="nb-shiki-dzsirb"> \</span></span> <span class="line"><span class="nb-shiki-dzsirb"> --header</span><span class="nb-shiki-mdbnqw"> "Content-Type: application/json"</span><span class="nb-shiki-dzsirb"> \</span></span> <span class="line"><span class="nb-shiki-dzsirb"> --data</span><span class="nb-shiki-mdbnqw"> '{</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> "model": "z-ai/glm-4.7-flash",</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> "input": {</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> "messages": [</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> {</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> "role": "user",</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> "content": "What is Cloudflare?"</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> }</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> ]</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> }</span></span> <span class="line"><span class="nb-shiki-mdbnqw"> }'</span></span></code></pre></figure> <p>An x402-compatible client handles the payment challenge, signs an authorization from the client's wallet, and retries the request. Machine Payments currently requires customers to be based in the United States and have a credit card on file.</p> <p>For prerequisites, eligible models, and transaction details, refer to <a href="https://developers.cloudflare.com/ai-gateway/features/machine-payments/">Machine Payments (x402)</a>.</p>

The text above is the source's. reef added the severity, the dates it could read from the text, and the endpoints and scopes named in code.