Start

Quickstart: ask a model

From nothing to a receipt, in the app, with the SDK and with the CLI.

This page takes you from nothing to a first receipt: a claim put to the judge model, answered by an operator with a bond, and final once its window has closed. Each step is shown three ways: in the app, with the SDK and with the CLI.

Get the SDK or the CLI

Nothing to install. Open Ask.

A wallet with the fee mint and SOL

A request is paid from the wallet that signs it. The wallet needs two things:

  • the offer's price, in the offer's mint, in the wallet's associated token account for that mint,
  • SOL for the transaction fee, its priority fee, and the rent of the receipt account, which the requester pays. The first request in a mint also pays the rent of the escrow's token account for it.

The price and the mint are the operator's. Read them before funding the wallet:

The model's page, /models/judge, lists its offers with price and mint. Ask shows the same list under Offer and the total under You pay.

Ask the judge

The judge reads a claim and a passage of evidence and answers yes, unclear or no from that passage alone.

On Ask:

  1. Under Model, pick Judge.
  2. Under Input, write the Claim and the Evidence.
  3. Under Offer, the cheapest live offer is selected. Pick another to name a different operator.
  4. Press Connect wallet if no wallet is connected, then Ask, and sign the one transaction in the wallet.

The panel shows the transaction through Building, Signing, Sent and Confirmed.

The market model is asked the same way, with one text in place of the claim and the evidence. It reads a market headline or statement and answers negative, neutral or positive. The text is cut to the model's 32 tokens, so a long one is read from its start.

On Ask, pick Market under Model and write the Headline or statement under Input. The rest is the same.

What is signed and what it costs

All three ways sign the same thing: one transaction with one request instruction. It names the model and the operator, carries the input as token ids, a seed and max_fee, the most the requester pays, and moves the offer's price from the wallet into the fee escrow. The app sends the price it showed as max_fee; the SDK and the CLI send the price they read just before sending. An operator that raises its price in between gets nothing: the program refuses the request with FeeAboveMax and no fee moves. On Ask the panel then reads "The operator’s price went up after this page read it. Nothing was charged. Read the new price and ask again." The receipt account is created in the same transaction, in state requested, and its address is known from that moment.

The cost is the offer's price in the offer's mint, plus the SOL named above. The fee waits in escrow: it is paid to the answerer when the receipt is final, and it returns in full if the receipt goes void. Fees and offers follows the fee through each case.

On Ask, the What you send panel shows all of it before the signature: the model, the operator, the bond behind the answer, the window, and the amount under You pay.

The receipt reaches answered

The operator named by the offer has until the receipt's answer deadline to answer. Its answer puts the output and the trace root on the receipt, locks the model's bond behind them and opens the window. The state is answered.

The panel reads Waiting for the answer with the time the operator has left. When the answer lands it shows the Answer, the SOL bonded behind it, and Open the receipt, which leads to the receipt at /receipts/<address>.

Wait for final

An answered receipt can be challenged until its window closes. After that, with no dispute open, anyone can send finalize, and the network itself sends it. The state is then final, and that is the state other programs act on.

The window's length is the model's. It is on the model's page, in windowSeconds from GET /v1/models/judge, and on the receipt as the time it closes.

The receipt's page counts the window down under Window, with the time it closes in UTC. When the window has closed and the receipt is not final yet, a connected wallet sees Finalize. Once final, the page reads Final since with the time.

Read the output

The output is on the receipt as token ids. Each model answers one token, the index of its label:

output[0]judgemarket
0yesnegative
1unclearneutral
2nopositive

The receipt's page shows the Answer beside the input, the Claim and the Evidence or the Headline or statement, with the operator, the bond locked, the fee, the input hash and the trace root.

Void, and Cancel and refund

A request that the operator does not answer before the answer deadline can be cancelled by its requester. cancel_request returns the whole fee to the requester's token account and sets the receipt to void, which is terminal: a void receipt has no output and is never final.

The answer deadline is on the receipt: answerDeadline in GET /v1/receipts/:address and in laplace.receipt(address). Cancelling before it fails with AnswerDeadlineOpen, and only the requester's wallet can cancel.

Once the deadline has passed, Ask and the receipt's page show Cancel and refund to the requester's wallet. After the signature the receipt reads void and the fee is back in the wallet.

Run it again

The receipt you now hold can be checked by anyone, you included: run the model on the same input and compare the bits with the operator's.