Nika's spending cap works on prices. In the README's words, "nika check prices a workflow from its model's catalog price and the output limit each step declares. Set a budget below that ceiling and the run refuses to start: no model is called and nothing is spent."
That design has a hard case: a model the catalog does not price. The operations guide states it in one line: "A workflow whose model the engine's catalog does not price (an API route with no tariff row) cannot run under a USD ceiling: no amount can bound a price nobody knows."
Nika has refused to pretend otherwise for several releases. The 0.117.0 changelog section, a tag whose work first shipped publicly in v0.118.6, says that "An uncataloged model id no longer meters $0 past an armed budget." v0.122.0 gave nika serve, Nika's HTTP server, a cost-review door (--cost-review): a job on a route with an unknown cost could run after one explicit human decision, approve_once or decline, for that one run. That door landed on main in a large commit of 29 September that carried many other changes; the 0.122.0 changelog section states its behaviour. v0.124.0 then billed paid images and speech under a cap and refused what the catalog cannot price, as told in A contact sheet without a shell.
The review door is honest, but it asks a person for every single run. The 0.124.4 notes describe where things stood: such a workflow "was refused under any USD ceiling, and with the ceiling disarmed every job still needed POST /v2/cost-reviews, a human approve_once and one job carrying that review, a review living five minutes." Every run needed its own decision.
One decision, made once #
v0.124.4 adds nika serve --cost-policy. The server's operator states, at startup, what may run on one route the catalog does not price. The operations guide's example:
nika serve --bind 127.0.0.1:8787 --workflows ./workflows --token-file .nika/serve.token \
--run-cost-ceiling none \
--cost-policy 'scaleway/deepseek-v4-flash-0731:requests=4,output-tokens=4096,timeout=120,runs=200/day'A rule names one model and four bounds the engine can enforce without knowing a price:
requests=N: the requests one run may send, schema re-asks and authored retries included, from 1 to 256;output-tokens=N: the output tokens one request may ask, from 1 to 8192;timeout=SECONDS: how long one request may wait, from 1 to 120 seconds;runs=N/PERIOD: runs perminute,hour,day,weekor<seconds>s, counted in.nika/standing-cost-runs.jsonand kept across restarts.
All four are required. The flag repeats, one rule per model, and it requires --bind. Two optional settings exist: request-bytes=N, the largest request body (default and maximum 1 MiB), and input-usd= with output-usd= together, the operator's own price per million tokens.
A job on a named route whose run fits its rule now runs with no review. A run that may send more requests or ask for more output than the rule admits is refused before anything is sent, and so are a route no rule names and the run past a full window.
A rule does not lift a ceiling #
The notes are short on this point: "A rule overrides no ceiling." Without a declared price, every ceiling the job is under must be absent: the server's (--run-cost-ceiling none, never implied), the job's own and the project's ceiling:. Scheduled runs always carry a cost cap, so without a declared price they stay refused.
With input-usd and output-usd, the engine computes the run's declared worst case, every request at its size and output bounds and at the operator's rates, and admits the run only when that figure fits under each ceiling. The default ceiling can then stay armed, and a schedule can run on the route. The guide is clear about what that figure is: "A declared price is your estimate, never the provider's invoice".
The authority sits in one place. "The authority is the server's startup composition only: no request field, job body or workflow key grants or widens it, and the language is unchanged." A client cannot send a looser rule with its job, and a workflow file cannot carry one.
The record names the rule #
A job a rule admitted says so. Its settlement, the run's final account, carries cost_admission (nika/cost-admission@1) with the rule's identity, the bounds, the price state (unknown or host_declared) and the ceiling evidence. The cost journal and the trace record the same choice. One sentence of the notes sums up the whole cost thread: "a call whose cost is unknown is never recorded as zero".
Clients need no change. /health lists costStandingPolicyV1 on a server that holds a policy. Beside --cost-review, a review request for a run the policy admits answers review_required: false with the rule, so a client that asks for a review before every job keeps working. The admission rides inside the settlement, which the published SDK reads open, so it reads these jobs as it reads any other. And a server started without the flag, the notes say, "behaves and serves its contract exactly as before".
Why it matters #
When the price is unknown, the engine can still count. It can count requests, output tokens asked, seconds waited and runs per window. The policy turns a click repeated for every run into one written decision with a scope, made by the person who starts the server. Every run it admits carries that decision in its record, and nothing is recorded as free that was not.
What it does not do #
- The release did not exercise the rule against a real provider. The 0.124.4 notes say it: "The tests of this release gate the model call off or inject the access plan: no provider was called under a rule before the tag."
- The bounds cap volume, not money. With no declared price, the cost of an admitted run stays unknown, and is recorded as unknown.
- A declared price is the operator's estimate. The job records it as
host_declared, and a call whose usage the engine cannot qualify is still recorded with an unknown cost. - The guide lists what stays as it was: the workflow shape these runs accept (direct
infer:steps with a literal model andmax_tokens, localnika:read,nika:write,nika:jqandnika:assert, no agent, exec or nested workflow), one such run at a time per project, and the rule that a request which left without a usable answer blocks every later run on an unpriced route until you reconcile it withnika trace cost. - Runs are counted per route in the project, not per rule. An admission under a shorter window, from a second server on the same project or after a restart with an edited rule, forgets the runs a longer window still counted. The guide's advice: serve a project from one server and keep a route's window when you edit its rule.
- A journal row written under a rule carries keys an older engine does not read. After a downgrade, the notes say, "that engine refuses unknown-cost runs in the project until the journal is moved aside."
- It is a flag of
nika servewith--bind. Nothing in the workflow language changed.
Read the v0.124.4 release, or go back to The cost line and Clean is not ready to spend.