The model and its budget

What the model does

It receives one user message, the snapshot, and one system prompt, which states the task and your mandate. It answers with a single JSON object:

{"target":{"NVDA":0.0,"AAPL":0.0,"MSFT":0.0,"TSLA":0.0},"confidence":0.0,"reasoning":"two or three sentences"}

Weights are shares of the whole book between 0 and 1. Whatever is not allocated stays in USDG. That is all the model can do.

What the model cannot do

The prompt, in short

The system prompt says: you manage a small book of tokenised US stocks against USDG; answer only with target weights; a risk engine will check you and you cannot change it; you know only the snapshot, so do not invent news or prices; tokenised stocks trade 24 hours while NYSE does not, so pools can drift outside NYSE hours; fees and impact cost money; your mandate is "...". The full text is SYSTEM in engine/model.mjs.

When the model fails

A network error, an error from the API or an answer that is not JSON is logged as a THINK line with the error, and the book holds its current weights. The model never causes a trade by failing.

A live agent with no model key configured does not fall back to a fixed rule either: it holds, and the journal says "no model key is configured". A mandate is never executed by something that is not the model it names.

The inference budget

Each claim sets aside inferenceSharePct (30%) of the fees for the model bill. The engine counts the cost of each call from the token usage the API reports, using modelPrice from the config (USD per million tokens in and out), and compares the total with the budget.

When the spend reaches the budget, the agent stops calling the model, the journal says so, and the book holds until the next claim adds budget. A flat weekend costs nothing because the model is not called.

The bill is paid on the model account, not on-chain. The 30% in ETH in the wallet is what pays it back: on the platform the operator may reimburse itself from that share (never more than the real cost, see custody and trust); when you run it yourself you refill your own account.

The platform also has a global daily cap (MAX_MODEL_USD_PER_DAY, 5 USD by default) across all agents. When it is reached, every agent holds until the next UTC day, whatever its own budget says.

Typical cost

With Claude Haiku 4.5, a cycle costs about a third of a cent (1,300 tokens in, 250 out). At 15 minute cycles while NYSE is open and hourly outside, that is a few dollars a month. The mandate builder computes an estimate for your settings. The journal records the real cost of every call.

Using another model

Set model to any Anthropic model id and set modelPrice so the budget accounting is right. The adapter uses the Messages API and nothing model-specific.

The baseline

If the config says "model": "baseline-rule", or no key is set, a fixed rule decides instead: hold, with at most 25% each, the stocks that are up on the day by more than 0.3% and not down more than 0.4% in the last hour; otherwise stay in cash. It costs nothing, it is published as its own agent, and it is the bar the model has to clear.