AI 에이전트가 데이터를 자율적으로 구매하도록 허용 — x402 + 가스 없는 선불 + MCP on Base

작성자

카테고리:

← 피드로
DEV Community · Hiroshi Ichiyanagi · 2026-07-19 개발(SW)

Hiroshi Ichiyanagi

AI agents can now pay for APIs by themselves. Here’s a live endpoint that does it end-to-end on Base (USDC), and how to plug it into your agent in minutes.
The problem
HTTP 402 (“Payment Required”) lets an API charge per call in crypto. But most x402 endpoints make the agent send an on-chain transaction every single call — gas + latency + a signature each time. That’s fine for a one-off, terrible for an agent making hundreds of calls.
The fix: deposit once, then gasless
https://x402.obolpay.xyz adds a prepaid balance: the agent deposits USDC once, then pays per call with an off-chain signed voucher — no on-chain tx, no gas, instant.

1) discover + free preview (no spend)

import requests
BASE = “https://x402.obolpay.xyz
print(requests.get(f”{BASE}/.well-known/x402″).json()) # price, token, network, capabilities
print(requests.get(f”{BASE}/api/v1/protected-data”).json()) # HTTP 402 with a FREE preview

2) what’s in demand right now?

print(requests.get(f”{BASE}/stats”).json()[“selected_product”]) # market-selected best category

3) gasless pay-per-call after one topup (see /account/{address} for the voucher_message to sign)

header X-Account-Address / X-Account-Nonce / X-Account-Voucher -> instant, gasless, metered

Why agents keep coming back
• Free preview → evaluate before paying (no blind spend).
• Gasless prepaid → one deposit, then unlimited cheap calls.
• Delta delivery (X-Since-Seq) → only new data, saves your context tokens.
• Signed receipts → verifiable proof-of-purchase (/verify-receipt).
• Freshness SLA → stale data is auto-refunded to your balance.
Plug into Claude / any MCP agent
Add the MCP server (/mcp-server.py) — tools: discover / preview / purchase / balance / topup / spend_gasless / verify_receipt. Your agent can now discover, evaluate, pay, and fetch on its own.
Try it
Endpoint: https://x402.obolpay.xyz · Client: curl https://x402.obolpay.xyz/client.py · Manifest: /.well-known/x402.
Built on x402 + Base. Feedback welcome.

원문에서 계속 ↗

코멘트

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다