[KongchangAI]
· 2 min read· 1,075 words

Pay-Per-Use FX Rate API for AI Agents: Direct ECB Reference Rates

Pay-Per-Use FX Rate API for AI Agents: Direct ECB Reference Rates

SML FX Convert: pay-per-use, provenance-traceable FX API based on ECB reference rates for AI Agent accounting.

SML FX Convert is a currency conversion API for AI Agents using ECB daily reference rates and clearly labeling the source. It uses HTTP 402 and x402 for pay-per-use at 0.001 USDC per conversion (credit packs from 0.00005 USDC), with no API key or account needed. It follows fail-closed principles, never settling or fabricating rates when real data is unavailable. Best for accounting normalization, not real-time trading.

In AI Agent workflows, prices, budgets, and reports often span multiple currencies. Developers typically face three choices: subscribe to a forex data source and maintain an API key, or simply treat reference rates as executable quotes — the latter plants hidden risks in accounting and cost calculations. SML FX Convert attempts to solve this problem differently: pay-per-use, with the data source explicitly stated in the response.

rss source: Currency Conversion API for AI Agents: ECB Reference Rates, Pay Per Conversion

Data Source and Invocation: Transparency First

According to the project's testing records, GET /api/fx/info is a free endpoint whose response body itself states that the data source is the European Central Bank EXR daily reference rates, along with the text "Source: ECB statistics". This is crucial for Agent scenarios: when automated pipelines write exchange rates into quotations or cost reports, traceable provenance is harder to obtain than the numbers themselves.

Conversion calls go through GET /api/fx/convert?from=USD&to=EUR&amount=100. When unpaid, it returns HTTP 402 with a PAYMENT-REQUIRED response header quoting 1000 atomic units of USDC, on network eip155:8453 (Base mainnet), with scheme exact. The entire process requires no SML API key and no account registration — the 402 challenge itself is the complete settlement entry point.

On pricing, each successful conversion costs 0.001 USDC; a credit pack of 100 conversions costs 0.005 USDC, which works out to 0.00005 USDC per conversion once fully used. For low-frequency, bursty Agent FX needs, this pay-per-use model avoids the idle costs of subscriptions.

ECB EXR reference rates are reference mid-rates for the euro against a basket of major currencies, published by the ECB around 16:00 CET each working day and made public through the ECB statistical database. They are not real-time market execution prices but indicative rates aggregated from multiple quoting institutions, with a fixed publication time and once-daily update frequency. Because of this, they are well suited for accounting normalization and cost comparison, but not for trading scenarios requiring intraday movements. Developers should note that the ECB does not publish new data on holidays, and callers should handle possible "same-day carryover" or missing data cases.

The x402 protocol is a payment negotiation mechanism based on the HTTP 402 status code, designed to let API calls complete pay-per-use settlement without pre-registering an account or API key. Its basic flow is: the client receives a 402 response on the first request, with response headers (such as PAYMENT-REQUIRED) carrying the price, payment network, asset type, and payment scheme; the client constructs an on-chain payment based on this information and attaches proof of payment to the retry request; the server verifies and returns the result. The exact scheme mentioned means payment of the precise amount is required, while eip155:8453 is the CAIP-2 chain identifier for Base mainnet, and USDC is the dollar stablecoin on that chain. This model embeds payment logic within the HTTP interaction, lowering the barrier for Agents to access payments.

Fail-Closed: No Fabricated Rates

One design constraint the project emphasizes is "fail-closed": no real rate means no settlement, and the caller receives a free alternative path. For invalid currency codes, malformed amounts, or unavailable reference data, the system does not silently return a paid, fabricated conversion result.

This rule is especially important for autonomous Agent execution. Automated pipelines often lack a human review step, and a "seemingly successful" wrong rate can propagate all the way into budget decisions and supplier comparisons. Exposing failures explicitly is more in line with engineering intuition than returning a guessed value.

Fail-closed and fail-open are opposing strategies in system design: the former defaults to denying service or aborting the process when an anomaly is detected, while the latter defaults to allowing it through or returning a degraded result. In FX conversion scenarios, fail-closed means that when reference data is unavailable, the currency code is invalid, or the amount format is wrong, the API will not return a guessed value but will explicitly error and guide the caller to a free alternative path. This design sacrifices some availability but prevents erroneous data from contaminating downstream decisions. For automated Agents lacking human review, fail-closed effectively prevents "seemingly successful" wrong results from being silently propagated.

Scope Note: Reference Rates Are Not Execution Prices

The service clearly defines its scope: this is a calculation based on ECB reference rates, not an executable quote from a bank, card network, exchange, or broker. It does not custody fiat, does not conduct forex trading, does not guarantee spreads, and does not promise that reference rates are executable anywhere.

The scenarios it truly suits are: normalizing supplier quotes, comparing API costs denominated in different currencies, converting budget limits before tool selection, and unifying Agent business reports to a single reference currency. In these scenarios, traceable provenance is more valuable than "pretending reference rates are real-time execution prices". The project team also notes that the latest x402 terms remain in effect before spending; a 402 challenge does not equal settlement, and settlement does not equal acceptance.

Multi-Source Information and Judgment

Currently, information about this service comes mainly from the project team's own testing records and documentation — a single source lacking independent third-party verification. From an engineering perspective, the combination of an x402 payment channel plus ECB public reference data is a clear approach, and pay-per-use billing fits the occasional-call nature of Agents; however, the timeliness of reference rates is constrained by the ECB's daily publication schedule and is not suitable for financial scenarios requiring intraday real-time quotes. Whether to adopt it depends on whether your Agent is doing "accounting normalization" or "trading decisions" — the former fits, the latter does not.

One-line Summary

SML FX Convert provides a pay-per-use, provenance-traceable currency conversion API based on ECB reference rates, targeting AI Agent accounting normalization scenarios.

Paragraph Summary

SML FX Convert is a currency conversion API for AI Agents that uses ECB daily reference rates as its data source and explicitly labels the source in responses. It implements pay-per-use via HTTP 402 and the x402 protocol, charging 0.001 USDC per conversion, with credit packs as low as 0.00005 USDC per conversion, requiring no API key or account. The service follows a fail-closed principle: no real rate means no settlement and no fabricated results. Its positioning is reference-rate calculation, suitable for accounting scenarios like supplier quote normalization and API cost comparison, but not for trading decisions requiring real-time execution prices. Current information comes mainly from the project team, lacking third-party verification.

#AI Agent#FX conversion API#ECB reference rates#x402 protocol#pay-per-use#USDC#fail-closed
Share:

Related articles