<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: HSH Intelligence</title>
    <description>The latest articles on DEV Community by HSH Intelligence (@hshintelligence).</description>
    <link>https://dev.to/hshintelligence</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3949036%2F02449f3e-7179-4090-ae58-66a09198e395.png</url>
      <title>DEV Community: HSH Intelligence</title>
      <link>https://dev.to/hshintelligence</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hshintelligence"/>
    <language>en</language>
    <item>
      <title>Your AI Agent Can Now Pay $0.001 Per Scrape with x402 — No API Keys Needed</title>
      <dc:creator>HSH Intelligence</dc:creator>
      <pubDate>Sun, 24 May 2026 12:47:38 +0000</pubDate>
      <link>https://dev.to/hshintelligence/your-ai-agent-can-now-pay-0001-per-scrape-with-x402-no-api-keys-needed-2c65</link>
      <guid>https://dev.to/hshintelligence/your-ai-agent-can-now-pay-0001-per-scrape-with-x402-no-api-keys-needed-2c65</guid>
      <description>&lt;p&gt;When AI agents need to call an API today, they hit a wall. Sign up. Get a key. Manage rotation. Hit rate limits. Pay a subscription that doesn't match actual usage.&lt;/p&gt;

&lt;p&gt;That model was built for humans clicking through dashboards. It doesn't fit agents.&lt;/p&gt;

&lt;p&gt;We just shipped &lt;strong&gt;AgentScrape&lt;/strong&gt; — a pay-per-call web scraping API for AI agents that uses the x402 payment protocol. Each call costs $0.001 USDC on Base mainnet. There is no signup. There are no API keys. The agent pays per request and gets the data.&lt;/p&gt;

&lt;p&gt;This post is about how x402 works, what we built, and how to plug AgentScrape into your agent right now.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Problem with API Keys for AI Agents
&lt;/h2&gt;

&lt;p&gt;API keys were designed for a static world: one developer, one product, one bill. Agents break all three assumptions.&lt;/p&gt;

&lt;p&gt;A single LangChain agent might call thirty different APIs across one task. Each API wants its own key, its own auth flow, its own subscription tier. The developer has to predict which APIs the agent will need, sign up for each one, and configure rotation logic.&lt;/p&gt;

&lt;p&gt;The result is a mountain of glue code that doesn't help the agent do useful work. Worse, the agent can never call an API the developer didn't pre-arrange.&lt;/p&gt;

&lt;p&gt;What agents actually want is a protocol where they can discover a service, see its price, pay for the exact call they need, and move on. No accounts. No keys. No commitments.&lt;/p&gt;

&lt;p&gt;That protocol exists. It's called &lt;strong&gt;x402&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  How x402 Works in 60 Seconds
&lt;/h2&gt;

&lt;p&gt;x402 is a payment protocol built on the HTTP 402 status code (the "Payment Required" code that's been reserved since 1997 and barely used).&lt;/p&gt;

&lt;p&gt;The flow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Agent calls the API.&lt;/strong&gt; No auth.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API responds with HTTP 402.&lt;/strong&gt; Body includes price ($0.001), network (Base mainnet), recipient wallet address, and asset (USDC).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent signs a USDC transfer authorization&lt;/strong&gt; using EIP-3009 (gasless, off-chain signature).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent retries the call&lt;/strong&gt; with the signed payment payload in the &lt;code&gt;X-PAYMENT&lt;/code&gt; header.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API verifies the payment via a facilitator service&lt;/strong&gt;, then settles it on-chain.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;API returns the data.&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The facilitator handles all blockchain interaction. The API server doesn't need RPC nodes, hot wallets, or transaction signing. The agent doesn't need an account anywhere except a self-custodied wallet.&lt;/p&gt;

&lt;p&gt;Coinbase operates the production x402 facilitator at &lt;code&gt;api.cdp.coinbase.com/platform/v2/x402&lt;/code&gt;. They charge zero facilitator fees on Base mainnet — only the network's nominal gas cost, which they sponsor for the buyer.&lt;/p&gt;




&lt;h2&gt;
  
  
  What We Built: AgentScrape v0.6.0
&lt;/h2&gt;

&lt;p&gt;AgentScrape exposes six paid tools through both an HTTP REST API and an MCP (Model Context Protocol) server:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;scrape_webpage&lt;/code&gt; — Clean HTML/Markdown/text/JSON extraction&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;extract_structured_data&lt;/code&gt; — Schema-defined JSON extraction via Groq + Llama&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;screenshot_webpage&lt;/code&gt; — Full-page PNG captures with viewport control&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;extract_metadata&lt;/code&gt; — Open Graph, Twitter cards, JSON-LD parsing&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;create_browser_session&lt;/code&gt; — Persistent browser contexts for multi-step flows&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;run_workflow&lt;/code&gt; — Composite multi-step operations in one call&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every tool costs $0.001 per call. The first 10 calls per wallet are free for evaluation.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Stack
&lt;/h3&gt;

&lt;p&gt;The whole thing runs on Cloudflare Workers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Runtime:&lt;/strong&gt; Cloudflare Workers (V8 isolate, global edge deployment)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser:&lt;/strong&gt; Cloudflare Browser Rendering (managed headless Chrome)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP framework:&lt;/strong&gt; Hono v4 with &lt;code&gt;@x402/hono&lt;/code&gt; v2 payment middleware&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP transport:&lt;/strong&gt; &lt;code&gt;agents/mcp&lt;/code&gt; + &lt;code&gt;agents/x402&lt;/code&gt; from the Cloudflare Agents SDK&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Facilitator:&lt;/strong&gt; Coinbase CDP at &lt;code&gt;api.cdp.coinbase.com/platform/v2/x402&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auth:&lt;/strong&gt; Ed25519 JWT signed with &lt;code&gt;jose&lt;/code&gt; (Workers-compatible via Web Crypto API)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI extraction:&lt;/strong&gt; Groq inference with Llama 4 Scout (17B)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Worker is ~1000 lines of TypeScript. Total deploy bundle: 548 KB gzipped. Cold start: 72ms.&lt;/p&gt;




&lt;h2&gt;
  
  
  Try It Now
&lt;/h2&gt;

&lt;h3&gt;
  
  
  As an MCP Server in Claude Desktop, Cursor, or any MCP client
&lt;/h3&gt;

&lt;p&gt;Install via Smithery in one command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx &lt;span class="nt"&gt;-y&lt;/span&gt; @smithery/cli &lt;span class="nb"&gt;install &lt;/span&gt;hshintelligence/agentscrape &lt;span class="nt"&gt;--client&lt;/span&gt; claude
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That registers six paid tools your agent can call directly. The agent handles payment automatically through Cloudflare's &lt;code&gt;agents/x402&lt;/code&gt; client wrapper — you never see a key prompt.&lt;/p&gt;

&lt;h3&gt;
  
  
  As a Direct HTTP API
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Request — get a 402 with payment requirements&lt;/span&gt;
curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://agent-scrape.healingsunhaven.workers.dev/scrape &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"url":"https://example.com","format":"markdown"}'&lt;/span&gt;

&lt;span class="c"&gt;# Response:&lt;/span&gt;
&lt;span class="c"&gt;# HTTP/2 402&lt;/span&gt;
&lt;span class="c"&gt;# payment-required: &amp;lt;base64-encoded x402 v2 PaymentRequired&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;payment-required&lt;/code&gt; header decodes to a complete x402 v2 payment requirements object: scheme, network, amount, USDC asset address, payTo wallet, and timeout.&lt;/p&gt;

&lt;p&gt;A client using &lt;code&gt;@x402/fetch&lt;/code&gt; or any x402-compliant wrapper signs the payment and retries automatically. The second call returns the scraped data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Free Tier
&lt;/h3&gt;

&lt;p&gt;If you just want to test scraping without any wallet setup, the HTTP API offers 10 free calls per wallet per 30 days. Set an &lt;code&gt;x402-payer&lt;/code&gt; header with any identifier:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://agent-scrape.healingsunhaven.workers.dev/scrape &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"x402-payer: my-test-id"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"url":"https://news.ycombinator.com"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What We Learned Shipping This
&lt;/h2&gt;

&lt;p&gt;A few notes from the build that may save other teams time:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The CDP facilitator URL is &lt;code&gt;api.cdp.coinbase.com/platform/v2/x402&lt;/code&gt;, not &lt;code&gt;x402.org/facilitator&lt;/code&gt;.&lt;/strong&gt; The x402.org facilitator is testnet-only (Base Sepolia, Solana Devnet). For real money on Base mainnet, you need the CDP endpoint with CDP API keys.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Authentication is Ed25519 JWT, not API key headers.&lt;/strong&gt; Each call to verify/settle requires a freshly signed JWT with claims &lt;code&gt;iss: "cdp"&lt;/code&gt;, &lt;code&gt;sub: &amp;lt;keyId&amp;gt;&lt;/code&gt;, &lt;code&gt;aud: ["cdp_service"]&lt;/code&gt;, &lt;code&gt;uri: "&amp;lt;METHOD&amp;gt; api.cdp.coinbase.com&amp;lt;path&amp;gt;"&lt;/code&gt;, and a 120-second expiry.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CDP gives you a raw 88-character base64 key, not PKCS#8 PEM.&lt;/strong&gt; The &lt;code&gt;jose&lt;/code&gt; library needs PKCS#8. Conversion is straightforward: take the first 32 bytes of the decoded key, prepend the Ed25519 PKCS#8 ASN.1 prefix (&lt;code&gt;302e020100300506032b657004220420&lt;/code&gt;), wrap in PEM headers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;agents/x402&lt;/code&gt; and &lt;code&gt;@x402/core&lt;/code&gt; packages share the same &lt;code&gt;FacilitatorConfig&lt;/code&gt; interface.&lt;/strong&gt; You write one &lt;code&gt;createAuthHeaders&lt;/code&gt; callback and pass it to both the HTTP middleware (&lt;code&gt;HTTPFacilitatorClient&lt;/code&gt;) and the MCP layer (&lt;code&gt;withX402&lt;/code&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Coinbase Bazaar (their official x402 discovery directory) indexes automatically.&lt;/strong&gt; No PR, no form, no manifest file. Add &lt;code&gt;bazaarResourceServerExtension&lt;/code&gt; and &lt;code&gt;declareDiscoveryExtension()&lt;/code&gt; per route, complete one successful settlement through CDP, and your service appears in &lt;code&gt;api.cdp.coinbase.com/platform/v2/x402/discovery/resources&lt;/code&gt; within 10 minutes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where AgentScrape Goes Next
&lt;/h2&gt;

&lt;p&gt;Today, every tool is flat-priced at $0.001 for 48-hour market validation. Once we have settlement data, pricing will move to a tiered structure that reflects actual compute cost per operation.&lt;/p&gt;

&lt;p&gt;We're also working on two adjacent products: AgentParse (PDF/OCR extraction) and AgentSearch (federated search across the web + arXiv + GitHub). All three will share the same x402 payment surface, so agents that adopt one get the others for free.&lt;/p&gt;

&lt;p&gt;If you're building agents and want to skip the API-key glue code, give AgentScrape a try. Star the repo, install via Smithery, or call the HTTP endpoint directly. Feedback and bug reports are welcome.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/hshintelligence/agent-scrape" rel="noopener noreferrer"&gt;https://github.com/hshintelligence/agent-scrape&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Smithery: &lt;a href="https://smithery.ai/servers/hshintelligence/agentscrape" rel="noopener noreferrer"&gt;https://smithery.ai/servers/hshintelligence/agentscrape&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Live API: &lt;a href="https://agent-scrape.healingsunhaven.workers.dev" rel="noopener noreferrer"&gt;https://agent-scrape.healingsunhaven.workers.dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;x402 protocol: &lt;a href="https://x402.gitbook.io/x402" rel="noopener noreferrer"&gt;https://x402.gitbook.io/x402&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
