{"success":true,"data":{"format":"html","source":"https://agentsvc.io/docs","title":"Docs: how agents pay per call with x402 · agentsvc.io","author":null,"date":null,"language":"en","word_count":12186,"characters":5000,"heading_count":8,"table_count":0,"image_count":0,"outline":[{"level":1,"text":"Pay per call. Nothing else to set up."},{"level":2,"text":"Free trial, no wallet"},{"level":1,"text":"GET works too and uses the example input:"},{"level":2,"text":"Quickstart with a wallet"},{"level":2,"text":"Payment protocol (x402 v1 and v2)"},{"level":2,"text":"Responses and errors"},{"level":2,"text":"Discovery for agents"},{"level":2,"text":"Service reference (68)"}],"markdown":"<div hidden=\"\">\n\n</div>\n\n<div style=\"border-bottom:1px solid var(--border);background-color:rgba(10, 14, 26, 0.92);backdrop-filter:blur(12px);position:sticky;top:0;z-index:50\">\n\n<div class=\"container\" style=\"display:flex;align-items:center;justify-content:space-between;min-height:60px;gap:1rem\">\n\n<a href=\"/\" class=\"font-mono\" style=\"color:var(--accent);font-weight:600;text-decoration:none;letter-spacing:-0.02em;font-size:1rem\">agentsvc.io</a>\n\n<a href=\"/services\" class=\"nav-link\">Services</a><a href=\"/docs\" class=\"nav-link\">Docs</a><a href=\"/llms.txt\" class=\"nav-link hide-mobile\">llms.txt</a><span class=\"hide-mobile\"><a href=\"/api/v1/status\" class=\"font-mono\" style=\"display:inline-flex;align-items:center;gap:8px;font-size:0.75rem;color:var(--text-muted-2);text-decoration:none;white-space:nowrap;flex-wrap:wrap\" title=\"Live self-test of every service, JSON\"><span class=\"status-dot pending\" aria-hidden=\"true\"></span><span>checking services</span></a></span><a href=\"/docs#try\" class=\"btn btn-primary\" style=\"min-height:40px;padding:0 1rem;font-size:0.875rem\">Try free</a>\n\n</div>\n\n</div>\n\n<div class=\"flex-1\" role=\"main\">\n\n<div class=\"container\" style=\"padding:clamp(40px, 6vw, 72px) var(--gutter) 0\">\n\n<div class=\"docs-grid\">\n\n<div style=\"position:sticky;top:76px\">\n\nDocs\n\n<a href=\"#try\" class=\"docs-nav-link\">Free trial</a><a href=\"#quickstart\" class=\"docs-nav-link\">Quickstart</a><a href=\"#payment\" class=\"docs-nav-link\">Payment protocol</a><a href=\"#responses\" class=\"docs-nav-link\">Responses and errors</a><a href=\"#discovery\" class=\"docs-nav-link\">Discovery for agents</a><a href=\"#reference\" class=\"docs-nav-link\">Service reference</a>\n\n<div style=\"margin-top:20px;padding-left:12px;display:grid;gap:6px;font-size:0.8125rem\">\n\n<a href=\"/llms-full.txt\" class=\"link font-mono\">llms-full.txt</a><a href=\"/openapi.json\" class=\"link font-mono\">openapi.json</a>\n\n</div>\n\n</div>\n\n<div class=\"prose\" style=\"min-width:0\">\n\nDocumentation\n\n# Pay per call. Nothing else to set up.\n\nEvery service is a JSON endpoint behind HTTP 402. If you already use an x402 client, you are done: point it at any endpoint below. Agents can read this whole page as Markdown at <a href=\"/llms-full.txt\" class=\"link font-mono\">/llms-full.txt</a>.\n\n<div class=\"section\" style=\"margin-bottom:56px\">\n\n## Free trial, no wallet\n\nEvery service has a free sample endpoint that runs its example input and returns the real output, so your agent can check format and quality. Your own input goes through the paid endpoint. Limits: 3 calls per service per day, heavy services (screenshot, PDF, OCR, scrape, resize) 1, 20 per IP in total. Send an empty body or the example input.\n\n``` code-block\ncurl -X POST https://agentsvc.io/api/v1/try/web-scrape \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"url\":\"https://example.com\"}'\n\n# GET works too and uses the example input:\ncurl https://agentsvc.io/api/v1/try/weather\n```\n\nThe response carries `trial.remaining_today` and `paid_endpoint`. Hitting the limit returns 429 with `resets_at`.\n\n</div>\n\n<div class=\"section\" style=\"margin-bottom:56px\">\n\n## Quickstart with a wallet\n\nYou need an EVM private key whose address holds USDC on Base mainnet (chain 8453). No ETH is needed; the facilitator pays gas. Then:\n\n<div style=\"margin:16px 0\">\n\n<div class=\"card\" style=\"overflow:hidden\">\n\n<div style=\"display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--border);padding:0 8px;gap:8px;overflow-x:auto\">\n\n<div style=\"display:flex\" role=\"tablist\">\n\nJavaScript\n\nPython\n\nMCP\n\n</div>\n\ncopy\n\n</div>\n\n``` code-block\nnpm i @x402/fetch @x402/evm viem\nimport { wrapFetchWithPayment, x402Client } from \"@x402/fetch\";\nimport { registerExactEvmScheme } from \"@x402/evm/exact/client\";\nimport { privateKeyToAccount } from \"viem/accounts\";\nconst client = new x402Client();\nregisterExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });\nconst payFetch = wrapFetchWithPayment(fetch, client);\nconst res = await payFetch(\"https://agentsvc.io/api/v1/proxy/web-scrape\", { method: \"POST\", headers: { \"Content-Type\": \"application/json\" }, body: JSON.stringify({ url: \"https://example.com\" }) });\nconsole.log(await res.json());\n```\n\n</div>\n\n</div>\n\nSwap the URL for any endpoint from the <a href=\"#reference\" class=\"link\">reference</a>. The client handles 402, signing and retry. The 200 response contains `data` and `payment.transaction`.\n\n</div>\n\n<div class=\"section\" style=\"margin-bottom:56px\">\n\n## Payment protocol (x402 v1 and v2)\n\nOne request without payment returns 402. We answer both protocol versions at once, so any x402 client works:\n\n- **x402 v2**: header `PAYMENT-REQUIRED` = base64 JSON with `accepts[0]` = {scheme: exact, network: eip155:8453, amount, asset, payTo, maxTimeoutSeconds, extra}. Pay by sending `PAYMENT-SIGNATURE`.\n- **x402 v1**: JSON body with `accepts[0]` = {scheme: exact, network: base, maxAmountRequired, resource, asset, payTo, extra}. Pay by sending `X-PAYMENT`.\n\n``` code-block\nPOST https://agentsvc","truncated":true},"trial":{"free":true,"used_example_input":true,"input_used":{"url":"https://agentsvc.io/docs","max_chars":5000},"remaining_today":0,"resets_at":"2026-10-07T00:00:00.000Z","note":"Real output for the example input. The paid endpoint returns the same format for your own input."},"paid_endpoint":"https://agentsvc.io/api/v1/proxy/doc-parse","price_usdc":0.006,"payment":"x402, USDC on Base mainnet, no account needed","docs":"https://agentsvc.io/docs"}