Call a paid API
payCalls x402 API endpoints and automatically pays 402 Payment Required challenges by swapping the agent's token to USDG on Uniswap in one transaction, while enforcing per-call, fee, and daily limits.
Instructions
Calls an x402 API. If it answers 402 Payment Required with a Tender option, pays with the agent's token (swapped to USDG on Uniswap in the same transaction) and returns the API's response. Free endpoints are just fetched. Refuses anything above the configured per-call, fee or daily limits.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"url": "<url>"
},
"name": "pay"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | Full URL of the API endpoint | |
| body | No | Request body (sent as-is; set content-type in headers if needed) | |
| method | No | HTTP method, default GET | |
| headers | No | Extra request headers | |
| max_usd | No | Refuse if the API's price is above this many dollars (lower than the configured limit) | |
| pay_with | No | Token to pay with for this call (0x…). Omit for the default. |