azeth_pay
Pay for HTTP services that use x402 payment protocol. Automatically handles 402 payment, checks for active agreements, and returns the response.
Instructions
Pay for an x402-gated HTTP service. Makes the request, handles 402 payment automatically, and returns the response.
Use this when: You need to access a paid API or service that uses the x402 payment protocol (HTTP 402). The tool automatically detects if you have an active payment agreement (subscription) with the service. If an agreement exists, access is granted without additional payment. Otherwise, a fresh USDC payment is signed.
Returns: Whether payment was made, the payment method used ("smart-account" for a fresh smart-account settlement, "session" for SIWx-granted access incl. an active agreement, "x402" for a direct EOA settlement, or "none"), the HTTP status, and the response body.
Note: Requires USDC balance to pay (unless an agreement grants access). Set maxAmount to cap spending. Only HTTPS URLs to public endpoints are accepted. The payer account is determined by the AZETH_PRIVATE_KEY environment variable.
Example: { "url": "https://api.example.com/data" } or { "url": "https://api.example.com/data", "maxAmount": "1.00" }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chain | No | Target chain. Defaults to AZETH_CHAIN env var or "baseSepolia". Accepts "base", "baseSepolia", "ethereumSepolia", "ethereum" (and aliases like "base-sepolia", "eth-sepolia", "sepolia", "eth", "mainnet"). | |
| url | Yes | The HTTPS URL of the x402-gated service to access. Must be a public endpoint. | |
| method | No | HTTP method. Defaults to "GET". | |
| body | No | Request body for POST/PUT/PATCH requests (JSON string, max 100KB). | |
| maxAmount | No | Maximum USDC amount willing to pay (e.g., "5.00"). Rejects if service costs more. | |
| smartAccount | No | Smart account to pay from. Use "#1", "#2", etc. (index from azeth_accounts) or a full address. Defaults to your first smart account. |