A forecast API that AI agents pay per call: $0.001 USDC over x402 via Circle Gateway on Arc, returning Gemini prediction-market odds. A policy engine and a dashboard keep spending inside budget caps, human approval and a kill switch.

What did you build?

Oracle402 is a pay-per-query forecast oracle for AI agents. A seller API wraps Gemini's public Prediction Markets data. Market search is free; a forecast for one event (the market-implied probability of each contract) costs $0.001 USDC, paid over x402 with Circle Gateway nanopayments on Arc testnet. A buyer agent decides when a forecast is worth paying for, and every payment passes a policy engine: hard budget cap, per-call cap, host allowlist, human approval after half the budget is spent, and a kill switch. A dashboard shows the budget, the payment ledger, the agent's decision trace, approval prompts and the kill switch. We tested it with real testnet USDC: 14 paid calls, and the payments appear in an onchain Gateway batch settlement on Arc.

What problem does it solve?

AI agents are frozen at their training cutoff, so they cannot know what is likely to happen next. Prediction markets price the future continuously, but agents can't easily pay for that data: API keys, subscriptions and accounts are built for humans, and card payments are too expensive for sub-cent requests. Giving an agent a wallet creates a second problem: nothing stops it from overspending. Oracle402 addresses both. The seller charges a tenth of a cent per forecast over HTTP 402, so an agent pays only for the data it uses, with no account. The buyer side wraps every payment in explicit, auditable limits that a human controls in real time: caps, an approval gate and a kill switch.

How does it work?

  1. The agent calls GET /markets?q= (free) on the seller, which searches Gemini's active prediction-market events and returns tickers and titles without prices.
  2. It picks one event and reads the advertised price from GET /pricing (free) before spending anything.
  3. Policy.check() allows the call, denies it, or asks a human on the dashboard to approve it.
  4. If allowed, the agent requests GET /forecast/:ticker. The seller checks that the ticker exists (unknown tickers get a 404 before the paywall, so no charge) and returns HTTP 402 with payment requirements for Arc testnet.
  5. Circle's GatewayClient signs a gasless USDC authorization, retries, and the seller returns Gemini's live bid, ask and last trade converted to probabilities.
  6. The payment is logged to the ledger and decision trace on the dashboard. Gateway later settles the payments onchain in a batch.

What makes it unique?

Most agent-payment demos show that an agent can pay. Oracle402 also shows what happens when it should not. Every guardrail fires against real payments, not mocks. In our test run, the first five purchases went through automatically. From the sixth, a human had to approve each one, and a denied request made no payment. The eleventh was refused at the hard budget cap, and the kill switch blocked further spending. The seller is agent-friendly too: discovery and pricing are free, and it checks the ticker exists before taking payment, so an agent is never charged for a 404. The data itself is a good fit for per-call pricing: prediction-market odds go stale within minutes, and an agent usually needs only one market's odds, once. Settlement uses Circle Gateway batching on Arc, so each sub-cent payment costs the buyer no gas.

What would you build next?

  • Prices that vary with market liquidity and how fresh the quote is, advertised through the free /pricing endpoint so agents still see the cost before paying.
  • Forecasts that combine several related markets into one answer, such as a probability distribution across BTC price strikes.
  • Separate budgets and policies per agent and per task, stored persistently. Today the ledger and spend counter live in memory and reset on restart.
  • Listing the seller in an agent service directory so agents can discover it without a hard-coded URL.
  • A move from Arc testnet to mainnet, with spending reports a human can reconcile against the onchain settlement batches.

Built With

Share this project:

Updates

Submission history