Deterministic AI your contracts can settle on.
Somnia LLM Inference runs large language models inside Somnia. Every validator in a subcommittee runs the same pinned model on the same input and must return a byte-identical answer, so the contract gets an answer the validators agreed on.
Read the docsInput
- system
- You are a market moderator. Answer accept or reject.
- prompt
- Is this question clear and resolvable? "Will the venue publish its 2026 annual report by 31 March 2027?"
- allowedValues
- ["accept", "reject"]
- chainOfThought
- false
Pinned on every validator
- model
- open-weight
- seed
- fixed
- temperature
- 0
Same input, four validators
| Validator | Model | Seed | Temp | Output | Output hash | Match |
|---|---|---|---|---|---|---|
| 0x8f3a…21c4 | pinned | fixed | 0 | accept | 0x9c1e…44ab | Identical |
| 0x2b91…7e05 | pinned | fixed | 0 | accept | 0x9c1e…44ab | Identical |
| 0xc604…9a38 | pinned | fixed | 0 | accept | 0x9c1e…44ab | Identical |
| 0x47de…b610 | pinned | fixed | 0 | accept | 0x9c1e…44ab | Identical |
- Receipts
- 4 signed, one per validator, available for audit
- Deposit
- Unspent deposit refunded with the callback
- Output modes: text from a set list, bounded numbers, chat and tool calls
- 4
- Output modes: text from a set list, bounded numbers, chat and tool calls
- Somnia docs, LLM Inference
- Validators per request, set by the calling contract
- Up to 10
- Validators per request, set by the calling contract
- Somnia docs, Gas fees
- Temperature on every validator, with a fixed seed
- 0
- Temperature on every validator, with a fixed seed
- Somnia docs, LLM Inference
- Priced per request in SOMI; see the docs for current prices
- Priced per request in SOMI; see the docs for current prices
An answer every validator can repeat.
Every validator gets the same output from the same input. That is how a subcommittee agrees on one answer, and why a contract can act on it.
Get the same answer from every validator
Fixed seeds, zero temperature and a pinned open-weight model make inference deterministic, so independent validators reproduce the exact same output.
Get one answer agreed by validators
A single model endpoint can be manipulated or switched off. Answers on Somnia are agreed by a subcommittee of validators before a contract sees them.
Inspect the reasoning
Each validator signs a receipt of the steps it took, with optional chain-of-thought, so you can audit how an answer was reached.
Call the model like any other function
Contracts call the model and get the result in a callback, with no API keys and no offchain service to run.
| Question | Single endpoint | Somnia |
|---|---|---|
| Who runs it | One provider | A validator subcommittee |
| Same input | Output can vary | Byte-identical output |
| Switched off | By the provider | Not by any one party |
| Audit trail | Provider logs | Signed receipts |
| To call it | API key and a server | A function call |
| Reasoning | Up to the provider | Optional, in receipts |
| Answer goes to | Your server | The contract callback |
Choose the answer your logic needs.
Every method goes through the same agent, with the same pinned model and the same consensus.
inferString
Call inferString for single-turn text, optionally limited to a list of allowed values.
- IN · allowedValues
- ["safe", "unsafe"]
- OUT · response
- "safe"
inferNumber
Call inferNumber to get an integer answer clamped to the range you set.
- IN · minValue, maxValue
- 1 to 10
- OUT · response
- 7
inferChat
Call inferChat for multi-turn conversations with system, user and assistant roles.
- IN · messages
- system, user, assistant
- OUT · response
- response: string
inferToolsChat
Call inferToolsChat for tool use with MCP servers, or with onchain functions that come back to your contract as calldata.
- IN · tools
- mcpServerUrls, onchainTools
- OUT · finishReason
- "stop", "tool_calls" or "max_iterations"
Put judgement into contract logic.
Create, moderate and resolve markets
Prophecy uses Somnia LLM Inference to moderate and name every new market, and Somnia Oracle uses the same deterministic stack to weigh evidence into a verdict.
- Moderation limited to accept or reject
- Market naming at creation
- Evidence weighed into a single verdict
- Question
- "Will the venue publish its 2026 annual report by 31 March 2027?"
- Moderation
- inferString, allowedValues accept or reject
- Result
- accept, 4 of 4 identical
- Name
- Venue annual report, March 2027
- Resolution
- Somnia Oracle weighs the evidence
- Verdict
- One answer, with signed receipts
Send a prompt, get one agreed answer.
From the LLM Inference docs. The calldata is sent through the Somnia Agents platform like any agent request; the return is illustrative.
Give the model tools, run its onchain calls.
inferToolsChat lets the model use MCP tools and propose onchain calls, which your contract runs itself.
Run MCP tools automatically
Pass MCP server URLs. The agent discovers the tools, calls them, feeds each result back to the model and continues until it is done.
- Discover tools from each MCP server
- Model calls a tool, the agent runs it
- Result fed back to the model
- finishReason "stop", response returned
Run each onchain tool call from your own contract
Describe functions by Solidity signature. The model's calls come back to your contract as ABI-encoded calldata to execute before resuming.
- Tool defined by signature and description
- finishReason "tool_calls", calldata returned
- Your contract executes each call
- Resume with the results, up to maxIterations
Set the limits on every answer.
Limit answers to values you allow
inferString takes a list of allowed values, or none for free text.
Keep numbers inside your range
inferNumber clamps the answer to the minimum and maximum you set.
See how the model reasoned
Optional reasoning, recorded in the execution receipts.
Choose how answers are agreed
Accept identical answers, or receive every result and aggregate onchain.
Audit every validator's steps
Each validator signs a receipt for its run, so anyone can check it later.
Stop tool loops at a set limit
maxIterations caps model and tool round-trips for each tool-use call.
Give your contract a model to call.
Run an inference in the Agent Explorer, or talk to the team about the judgement your contract needs.
Talk to an expert