coding.sh budget
Spend budgets per day, week or month, for every session, one agent or repo, or the sessions a query matches.
coding.sh budget <action> Spend budgets per day, week or month, for every session, one agent or repo, or the sessions a query matches Commands set Add a budget, or change the limit of the one with the same period, agent, repo and --where list List the budgets rm Remove a budget status Spend against each budget: spend, limit, percent used, over or not, and when the period resets Examples coding.sh budget set day 20 coding.sh budget status coding.sh proxy --enforce-budget Notes Spend is estimated: the cost of the sessions that started in the current period (subagents too), the same total coding.sh usage gives for that window. A session with no reported cost is priced from its tokens. A budget is over once its spend reaches the limit. Budgets are kept in ~/.coding.sh/budgets.json. The status line shows the highest budget once it passes 80% (budget 82%). coding.sh proxy --enforce-budget answers 429 to calls a budget over its limit applies to. A --where budget counts the sessions its query matches and their subagents. The status line counts it only for a day budget whose query uses session keys (agent, model, repo, flag, cost, ...), matched on the day's sessions it already read; a week or month --where budget, or one with an event key such as user:, env: or release:, is left out of the line. coding.sh proxy --enforce-budget never applies a --where budget. With --json, status gives each budget's spendUsd, limitUsd, percent, over, since and resetsAt (ISO times), and where when the budget has one. A budget whose spend can't be read, such as one whose --where no longer parses, prints an error in place of its numbers: in --json, error replaces spendUsd, percent and over, and limitUsd, since and resetsAt stay. The other budgets still report, and status exits 1.
coding.sh budget set
Add a budget, or change the limit of the one with the same period, agent, repo and --where.
coding.sh budget set <PERIOD> <USD> [options]
Add a budget, or change the limit of the one with the same period, agent, repo and --where
Arguments
period day (local calendar day), week (ISO week, from Monday) or month (calendar month)
usd The limit in USD, e.g. 20 or 2.50
Options
-a, --agent <AGENT> Only this agent's sessions
--repo <PATH|NAME> Only sessions in this repo, as sessions --repo counts them: a path (stored absolute; matches at or under it; a checkout's root or a folder in a linked worktree takes in every worktree) or a repo name (its main checkout and every worktree)
--where <QUERY> Only the sessions this query matches, with their subagents, e.g. 'user:u1', 'model:claude-opus-*' or 'env:production' (keys: coding.sh sessions --help). The id ends in -w and 6 hex characters of the query's SHA-256
Examples
coding.sh budget set day 20
coding.sh budget set week 50 --agent codex
coding.sh budget set month 200 --repo . coding.sh budget list
List the budgets.
coding.sh budget list List the budgets Examples coding.sh budget list coding.sh budget list --json
coding.sh budget rm
Remove a budget.
coding.sh budget rm <ID> Remove a budget Arguments id The budget's id (budget list) Examples coding.sh budget rm week-codex
coding.sh budget status
Spend against each budget: spend, limit, percent used, over or not, and when the period resets.
coding.sh budget status [options] Spend against each budget: spend, limit, percent used, over or not, and when the period resets Options --fresh Wait for every pending capture to be ingested (default: answer after 1.5 s) Examples coding.sh budget status coding.sh budget status --json