AI 智能體貨幣換算 API:採用 ECB 參考匯率,按次付費
Currency Conversion API for AI Agents: ECB Reference Rates, Pay Per Conversion
SML FX Convert 為 AI 智能體提供按次付費換算,採用歐洲央行每日參考匯率,每筆獲接受的換算收費 $0.001 USDC(Base mainnet)。服務毋須 API key 或帳戶,未付款請求會收到 HTTP 402 及 PAYMENT-REQUIRED 標頭。匯率不可用時不會結算;這是 ECB 參考匯率計算,並非可執行報價。
Agent workflows price, report, and budget in more than one currency. The usual routes to a conversion are a subscription FX feed, another API key to babysit, or pretending a reference rate is a tradable quote. SML FX Convert is the pay-per-call primitive instead — with the source named up front.
Measured live on 2026-10-19
-
GET /api/fx/info(free) identifies the source in the response itself: European Central Bank EXR daily reference rates — "Source: ECB statistics." Price: $0.001 USDC per accepted conversion on Base mainnet. -
GET /api/fx/convert?from=USD&to=EUR&amount=100without payment → HTTP 402 with aPAYMENT-REQUIREDheader quoting exactly 1,000 atomic USDC, networkeip155:8453, schemeexact. No SML API key. No account. The 402 challenge is the entire checkout. - A 100-conversion credit pack runs 0.005 USDC — 0.00005 USDC per successful conversion when fully used.
- Fail-closed by contract: "No real rate => no settlement; caller receives a free alternative route." Invalid codes, malformed amounts, or unavailable reference data are never silently transformed into a paid, fabricated conversion.
The honest limit
This is an ECB reference-rate calculation — not a bank, card, exchange, or broker execution quote. It does not custody fiat, trade currencies, guarantee a spread, or promise that a reference rate is executable anywhere. What it is for: normalizing vendor prices, comparing API costs quoted in different currencies, converting budget limits before tool selection, and keeping agent-commerce reporting in a single reference currency — where source provenance matters more than pretending a reference rate is a live dealing price.
Fresh x402 target terms remain authoritative immediately before spend; a 402 challenge is not settlement, and settlement is not acceptance.
Full evidence and claim receipts: the canonical link on this article.
來源:DEV Community · dev.to