跳到正文
DEV Community· Xynaptic·· 1 天前AI 評分54

作者讓 AI Agent 逐一付費呼叫 Bazaar 未收錄的 x402 端點,總費用 $6.37

I let my AI agent buy every API in a marketplace. Total bill: $6.37. Here's what happened.

AI 導讀

作者讓 AI Agent 逐一付費呼叫 Bazaar 尚未收錄的 x402 端點,約花 6.37 USDC,為約 160 個端點觸發結算事件。實驗開始時,作者約 220 個端點中有約 83 個已收錄;他以獨立買家錢包、每次付款上限及封鎖商家錢包作支出護欄。3 個端點因法國國家鐵路 API 整晚回傳 502 而未收錄,Agent 記錄後安排重試。

正文

Two weeks ago I gave my agent a strange mission: buy one call of every endpoint in the x402 ecosystem that wasn't indexed yet on the Bazaar — the discovery layer where agents find pay-per-call APIs.

Not to use the data. Just so the marketplace would notice the services exist.

Why would anyone do that?

In x402, discovery has a chicken-and-egg problem. The Bazaar indexes services that agents actually call — traffic through the facilitator is what gets you listed. So a brand-new API with zero callers stays invisible, and invisible means zero callers, forever.

We run a catalog of ~220 endpoints (crypto briefs, French company KYB, rail itineraries, restaurant hygiene data for 1,200+ cities, dev tools for LLM agents). About 83 were indexed when we started. My agent was told: fill the gap.

What the agent actually did

It worked through the list in batches over a few evenings:

  • Paid real x402 calls with a dedicated buyer wallet (never the merchant wallet — a rule I hardcoded after a close call)
  • Even a 404 after payment triggers settlement, so "broken" endpoints still get indexed
  • quirks it learned on the fly: company-compare wants siren=A&siren=B, health endpoints accept ?q=, one subscription service kept rejecting payments via its own spend controls (correctly — it's $12/mo, not pay-per-call)

The bill

Total: ~6.37 USDC on Base. That bought settlement events for roughly 160 endpoints. Final wallet balance: 13.09 USDC.

Compare that with listing on any traditional API marketplace: submissions, reviews, weeks of waiting. Here, the agent bootstrapped the catalog's own discoverability for the price of a coffee.

What broke

Honest section. Three endpoints stayed unindexed because their upstream data source (the French national railway API, fittingly) was having a bad night — 502s all evening. The agent logged them and scheduled a retry. Agents don't get frustrated; they reschedule.

Also: my earlier posts an expired API key burned my budget got some pushback about agents paying unsupervised. This experiment is my answer — the guardrails (separate buyer wallet, per-call max spend, hard-blocked merchant wallet) are what made an unattended $6 spending spree safe.

Takeaways

  1. Payments are the cheapest growth hack in agent-to-agent commerce. Your agent buying your own APIs is legitimate bootstrapping — settlement is settlement.
  2. Spend controls are the feature. max-amount-per-payment rules blocked exactly what they should have, even against the owner's interests. Trust the controls.
  3. Real-time data sources need retry budgets in your buyer scripts. The 502 endpoints weren't failures; they were queue items.

The whole thing ran on a few hundred lines of Node.js: fetch the official catalog, diff against the Bazaar index, attempt a purchase per missing endpoint, log results. The boring part wasn't the payments — those took seconds each. It was figuring out each API's query format with no docs but the 400-error messages themselves.

The catalog this describes is live; if your agent wants to try pay-per-call without keys, x402 + USDC on Base is genuinely a 20-minute integration. Questions welcome in the comments — I answer them with my agents, obviously.

來源:DEV Community · dev.to