Documentation

Ask an AI model a question from a contract on Robinhood Chain, and get a typed answer back on-chain.

Quick start

Inherit AIConsumer, open a request with _askAI and handle the answer in _onAIResult. The contract pays the fee in CREDIT it holds; _askAIWithUSDG pays in USDG instead, bought into CREDIT on Orbio's order book in the same transaction.

import {AIConsumer} from "orbacle/AIConsumer.sol";
import {IAIOracle, TOOL_WEB_SEARCH} from "orbacle/interfaces/IAIOracle.sol";

contract Market is AIConsumer {
    constructor(IAIOracle oracle) AIConsumer(oracle) {}

    function resolve() external returns (uint256 id) {
        id = _askAI(IAIOracle.RequestParams({
            model: "anthropic/claude-sonnet-4.5",
            prompt: "Did NVDA close above $200 on 2026-09-30 (US market close)?",
            kind: IAIOracle.AnswerKind.Bool,
            choices: new string[](0),
            tools: TOOL_WEB_SEARCH,
            fee: 1_000_000,          // 1 CREDIT (6 decimals), held by this contract
            timeout: 30 minutes,
            callbackGasLimit: 150_000
        }));
    }

    function _onAIResult(uint256 id, bool ok, uint256 answer) internal override {
        // ok: answer is 1 (yes) or 0 (no). !ok: it expired unanswered and the fee is back here.
    }
}

The oracle on this network: …

The request

fieldwhat it is
modelA chat model id from Orbio's catalogue (api/v1/models), e.g. anthropic/claude-sonnet-4.5. Up to 128 bytes.
promptThe question, with the context the model needs. Up to 8,192 bytes. State units, dates and time zones.
kindBool, Choice, Score or Uint: how the answer is read on-chain.
choicesFor Choice only: 2 to 16 options of up to 128 bytes. Empty otherwise.
toolsA bitmask of the tools nodes may call while answering (see tools).
feeCREDIT atoms offered to the nodes, at least the oracle's minimum. Ignored by requestWithUSDG.
timeoutSeconds the nodes have, from 1 minute to 7 days. After it, anyone can expire the request, which refunds the fee.
callbackGasLimit0 for no callback; otherwise the requester gets onAIResult with exactly this much gas, up to 2,000,000.

Answers

kindansweruse it for
Bool0 no, 1 yesDid it happen? Is the work done? Does the post exist?
Choiceindex into choicesWho won? Which category? Which option fits?
Score0 to 100How well does it match the spec? How confident?
Uintany uint256A count, a price in stated units, a block number.

Answers are discrete so that independent nodes running a non-deterministic model can agree on them. The oracle rejects any vote outside the kind's range.

Tools

constantOrbio toolwhat nodes can do with it
TOOL_WEB_SEARCHweb.searchSearch the web.
TOOL_WEB_SCRAPEweb.scrapeRead a page as markdown.
TOOL_X_POSTSsocial.x.postsSearch X or read a handle's posts.
TOOL_X_LOOKUPsocial.x.lookupRead specific posts by id or URL.
TOOL_X_PROFILEsocial.x.profileRead profiles.
TOOL_CHAIN_READchain.readRead chain state, Robinhood Chain by default.

Tools are billed by Orbio at provider cost plus 10%, out of the node's share of the fee: a request that allows more tools should pay more.

Fees

Fees are paid in CREDIT, Orbio's token for AI usage: one CREDIT is one dollar of inference through Orbio's gateway. The oracle holds the fee until the request settles; the nodes that voted the winning answer then split it, less the protocol's cut if one is set.

requestWithUSDG buys the fee on Orbio's CREDIT order book (the Exchange contract) in the same transaction, with a minimum CREDIT out you set, and returns the USDG the book did not take. CREDIT trades below its dollar of usage there, so a contract paying in USDG buys more inference than it spends.

Nodes activate the CREDIT they earn into their own Orbio balance, which is what pays for the inference they serve. A request that expires is refunded in CREDIT, including one paid in USDG.

Callbacks

The oracle calls back only the contract that opened the request, with onAIResult(id, ok, answer): ok is true once a quorum agreed and false when the request expired. AIConsumer checks the caller is the oracle.

A vote that would leave the callback less than its gas limit reverts, so no node can settle a request while starving the callback. A callback that reverts does not undo the settlement: the answer stands and the Notified event records the failure. A consumer may open its next request from inside the callback.

Verifying an answer

Every vote carries the keccak256 of the node's transcript: the prompt it sent, every tool call and result, and the model's reply. Each node serves the exact text at GET /transcripts/:id. Hash it and compare with the vote's transcriptHash; the request pages of this site do it in your browser.

Trust model

This is v1. The owner manages the node set and the quorum, and a majority of the nodes is the sensible quorum. Votes are plain and there is no stake to slash yet; commit-reveal votes and staked, permissionless nodes come next. Nodes trust Orbio's gateway to run the model they name, and quoted content (a web page, a delivery) can try to steer a model, which a quorum of independent nodes makes harder. The contracts are tested, on mocks and against Orbio's live contracts on a fork, and not audited.

Run a node

A node watches the oracle, answers through Orbio's gateway within a budget it derives from the fee, and votes. Its Orbio key can be its wallet's signature, so the CREDIT it earns and activates is the balance it spends.

# node/.env
ORACLE_ADDRESS=0x…
NODE_PRIVATE_KEY=0x…          # registered by the oracle's owner
RPC_URL=https://robinhood.drpc.org
MIN_REWARD=0.01               # CREDIT; cheaper requests are ignored
ACTIVATE_ABOVE=5              # activate earned CREDIT into the Orbio balance

pnpm --filter oracle-node start