Cloudflare X402
@sntxrr/cloudflare-x402v2026.07.18.2
01README
Pay for and inspect x402-protected HTTP resources and MCP tools — the Cloudflare agents payment standard — with a local EVM wallet, plus an x402 spend report
02Models
@sntxrr/cloudflare-x402v2026.07.18.2cloudflare_x402.ts
Global Arguments
| Argument | Type | Description |
|---|---|---|
| privateKey | string | EVM wallet private key (0x + 64 hex chars) used to sign x402 payments. Store in a vault, never inline. |
| maxAmountUsdc | number | Default ceiling, in whole USDC, this wallet will auto-pay for a single request. Per-call `maxAmountUsdc` overrides it. |
| tokenDecimals | number | Decimals of the settlement token, used to convert the USDC ceiling to base units (USDC = 6). |
fn probe(url: string, method: enum, headers?: record, requestId: string)
Inspect an x402 resource's price by reading its 402 challenge, without paying
| Argument | Type | Description |
|---|---|---|
| url | string | |
| method | enum | |
| headers? | record | |
| requestId | string | Instance name for the stored quote — use distinct values to keep separate quotes. Avoid the reserved name 'latest'. |
fn pay(url: string, method: enum, headers?: record, body?: string, maxAmountUsdc?: number, requestId: string)
Fetch an x402-protected resource, auto-paying the required USDC via the configured wallet
| Argument | Type | Description |
|---|---|---|
| url | string | |
| method | enum | |
| headers? | record | Extra request headers (e.g. Content-Type). The X-PAYMENT header is added automatically. |
| body? | string | Raw request body string sent on both the challenge and paid attempts. |
| maxAmountUsdc? | number | Override the model's default per-request ceiling for this call. |
| requestId | string | Instance name for the stored payment record — use distinct values to keep separate receipts. Avoid the reserved name 'latest'. |
Resources
payment(infinite)— Result of a paid x402 request, including the on-chain settlement receipt
quote(infinite)— Payment requirements advertised by an x402 resource, captured without paying
03Reports
@sntxrr/x402-spendmodel
x402_spend.ts
Summarize x402 spend for a wallet — total USDC, breakdown by network and resource, and settlement rate
paymentsfinopsx402
04Previous Versions
2026.07.18.1
2026.07.17.1
05Stats
A
100 / 100
Downloads
0
Archive size
57.4 KB
- Has README or module doc2/2earned
- README has a code example1/1earned
- README is substantive1/1earned
- Most symbols documented1/1earned
- No slow types (deprecated)1/1earned
- Dependencies pass trust audit2/2earned
- Has description1/1earned
- Platform support declared (or universal)2/2earned
- License declared1/1earned
- Verified public repository2/2earned
06Platforms
07Labels