Skip to content

Stop a run at a spending cap #14

Open

Description

@ttachon

Priority

extreme

Components

  • app/nullius (backend)
  • app/web (routes)
  • templates and static files
  • docs and the site
  • catalogue (benchmarks, agents, capabilities)
  • the standard (ports, kits, relay, runs)
  • CI, workflows and skills

Today

The relay records every call a run makes (app/nullius/standard/relay.py), but nothing stops a run at a budget: a run on a paid key spends until it ends. To run within a fixed budget I put a small proxy between the relay and the provider. Before each call it reserves an upper bound of its cost (prompt characters / 3 as input tokens, max_tokens as output, at list prices). It refuses the call with HTTP 402 when the run's spend plus the calls in flight would pass the cap, and it keeps a ledger of what was spent.

Wanted

A spending cap per run, for anyone running benchmarks on a prepaid or shared key, as an option such as --max-usd 5 or a setting. Once the run's spend, counting the calls in flight, would pass the cap, no further call goes out, and the job says so. A cap per task would be a useful addition, to stop one runaway unit.

Acceptance

  • A run can be given a spending cap, and no call goes out once the spend plus the calls in flight would pass it.
  • A capped run's result says the cap stopped it, what was spent, and which units did not run.

Dependencies and related

none

Activity

  1. aitianshi commented on Nov 10, 2026

    @aitianshi
    Collaborator

    Waits on #38 (pull request #39): a cap needs a price for every model a run calls, and prices move out of the code into the user's own list there. The cap itself is not started.

  2. aitianshi commented on Nov 10, 2026

    @aitianshi
    Collaborator

    Implemented in #46: nullius standard run --max-usd USD, with both acceptance criteria covered by tests and by hand runs (local and docker). It is stacked on #39, so this issue's Development panel will show it only once it targets main.

    Left out and recorded in #45: the cap in the builder and on a host, shards sharing one cap, a cap per unit, and the job page showing the budget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions