Run price

A finished agent run's page, and its log screen in the terminal, show the arithmetic behind its cost beside the ledger's figure (#13968):

200,000 in × $3/M + 10,000 out × $15/M = $0.7500

Tokens in and out come from the usage ledger (core/usage.ts), counted by the provider. The prices are dollars per 1,000,000 tokens. The product is computed in whole micro-dollars (tokens × $/M is already µ$), so no float drift enters. When the product and the ledger's costUsd differ at the cent, the line ends · ledger $0.4000: the ledger is the provider's own total and counts cache reads and writes at one rate, so the two can honestly differ.

A model with no declared price reads price per million unknown. It is never guessed. A run that spent no tokens shows no line. The line is shown to the people who may read the run's log (writers on the page, the same readers in the terminal).

Declaring prices: FORGE_MODEL_PRICES

model=in/out, comma separated, dollars per million tokens, e.g. claude-opus-5-5=15/75,claude-sonnet-5-5=3/15. The model name is the one the run recorded (run.model). An entry that is not exactly that shape (a model of letters, digits and ._:-, two numbers of up to six digits and six decimals) is dropped; the rest still apply. The variable is parsed once and again only if its text changes.

It is a variable of the forge process itself, set by whoever runs it, like the other FORGE_* variables. forge.json cannot carry it: env there names secrets the app reads and refuses any name starting FORGE_, and holds no values. Until it is set every run says unknown.

Where it is

src/core/run_price.ts (parsePrices, runPrice, priceWords), the page in runPriceLine (src/web/pages/runs.ts), the terminal in src/tui/screens/runlog.ts. The crew-activity row on the issue and pull pages still shows the cost alone: the line is one run's, and a row has no room for it. Tests: test/cost-tokens.test.ts, test/tui-runlog.test.ts.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs