Docs · Call a model
Call a model
Ask a model over HTTP or from a contract, replay the answer, log a decision.
Inputs and outputs
A model takes one int8 per value (-128 to 127), in the order its metadata describes, and returns one logit per class. classify also returns the index of the first highest logit. GET https://www.usewired.net/api/v1/models/{id} tells you the input length, the shape, the labels and the input scale.
Over HTTP
POST https://www.usewired.net/api/v1/models/{id}/infer with one of:
| Body | Meaning |
|---|---|
{"input": [0, 12, -3, …]} | int8 values, exactly as the contract takes them. |
{"input": "0x000cfd…"} | The same bytes in hex. |
{"values": [0.0, 1.5, …]} | Real values. The API quantizes them with the scale the model publishes onchain: round(x / scale), clamped to ±127. |
For a quick test in a browser, GET works too: …/infer?input=0,12,-3,… or …/infer?values=0,1.5,….
| Field | Meaning |
|---|---|
label, labelName | The winning class and its label, if the model publishes labels. |
logits | One integer per class. |
gasUsed | Gas of the registry call, measured onchain. |
block | The block the call ran at. |
input | The input as the contract received it, in hex. |
call | The exact call: to and data. |
decide | A transaction that logs this decision onchain (below). |
Replay an answer
Anyone can check an answer without trusting the API: run call at block on any Robinhood Chain node.
curl https://rpc.mainnet.chain.robinhood.com \
-H "content-type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"to":"<call.to>","data":"<call.data>"},"<block in hex>"]}'The result is the ABI-encoded (uint256 label, int256[] logits).
Log a decision onchain
decide in the answer is a ready transaction (chainId, to, data). Sign and send it from any wallet: the registry runs the model again inside the transaction, emits Decision and counts it on the model.
Solidity
| Function | Use |
|---|---|
infer(bytes32 id, bytes input) view returns (int256[]) | Logits. |
classify(bytes32 id, bytes input) view returns (uint256 label, int256[] logits) | Label and logits. |
decide(bytes32 id, bytes input) returns (uint256, int256[]) | Same, and emits Decision. |
model(bytes32 id) view returns (Model) | Owner, shape, name, metadata, blobs, decision count. |
event Decision(bytes32 indexed id, address indexed caller, bytes32 inputHash, uint256 label, bytes32 logitsHash, uint64 n);Gas
A call costs a fixed part (reading the blobs: about 2,600 gas per blob plus 3 gas per word) and about 8 gas per multiply-add. Plan for 170,000 gas for a 5,000-weight model and 10 million for 1.3 million weights.