<?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: XiaoKe APIy9695430-lang</title>
    <description>The latest articles on DEV Community by XiaoKe APIy9695430-lang (@y9695430lang).</description>
    <link>https://dev.to/y9695430lang</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4005301%2F2d8025d4-4473-44f3-ac8e-1890dc2c7d39.png</url>
      <title>DEV Community: XiaoKe APIy9695430-lang</title>
      <link>https://dev.to/y9695430lang</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/y9695430lang"/>
    <language>en</language>
    <item>
      <title>I Built an API Gateway That AI Agents Pay For Automatically</title>
      <dc:creator>XiaoKe APIy9695430-lang</dc:creator>
      <pubDate>Sat, 27 Jun 2026 11:49:53 +0000</pubDate>
      <link>https://dev.to/y9695430lang/i-built-an-api-gateway-that-ai-agents-pay-for-automatically-9k2</link>
      <guid>https://dev.to/y9695430lang/i-built-an-api-gateway-that-ai-agents-pay-for-automatically-9k2</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Every developer building AI agents faces the same issue: &lt;strong&gt;AI agents cannot pay for APIs.&lt;/strong&gt; They have no credit cards, no Stripe accounts, no API keys.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: x402 Protocol
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://x402.org" rel="noopener noreferrer"&gt;x402&lt;/a&gt; uses HTTP 402 (Payment Required) to let AI agents pay for API calls automatically in USDC. No accounts, no KYC.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;XiaoKe API Gateway&lt;/strong&gt; — 7 micro-services for AI agents:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Price&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST /pdf&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST /scrape&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.02&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST /ocr&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.015&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST /review&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.03&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST /translate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST /summarize&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.01&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;POST /md2html&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;$0.005&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  How It Works
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# First call — no payment&lt;/span&gt;
curl &lt;span class="nt"&gt;-X&lt;/span&gt; POST https://xiaoke-pdf-api.loca.lt/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="s2"&gt;"{&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;url&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;https://example.com&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;}"&lt;/span&gt;
&lt;span class="c"&gt;# Response: HTTP 402 with payment details&lt;/span&gt;
&lt;span class="c"&gt;# X-x402-Price: 0.02&lt;/span&gt;
&lt;span class="c"&gt;# X-x402-Address: 0x039ec...&lt;/span&gt;

&lt;span class="c"&gt;# AI agent pays 0.02 USDC on Base → retries&lt;/span&gt;
&lt;span class="c"&gt;# Response: 200 OK with clean Markdown&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;p&gt;FastAPI + pdfplumber + BeautifulSoup4 + Apple Vision OCR + x402 protocol&lt;/p&gt;

&lt;h2&gt;
  
  
  Open Source
&lt;/h2&gt;

&lt;p&gt;🔗 &lt;a href="https://github.com/y9695430-lang/xiaoke-api-gateway" rel="noopener noreferrer"&gt;github.com/y9695430-lang/xiaoke-api-gateway&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🌐 &lt;a href="https://y9695430-lang.github.io/xiaoke-api-gateway" rel="noopener noreferrer"&gt;Live Demo&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why This Matters
&lt;/h2&gt;

&lt;p&gt;Gartner predicts &lt;strong&gt;75% of apps will shift to API consumption pricing by 2027.&lt;/strong&gt; The x402 protocol has processed &lt;strong&gt;119M+ transactions.&lt;/strong&gt; AI agents are becoming the primary consumers of APIs.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Built in a day with Claude Code. AMA in the comments!&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>api</category>
      <category>webdev</category>
      <category>python</category>
    </item>
  </channel>
</rss>
