tdx budgets#

Manage spend budgets.

List, read, create, edit and remove budgets, list per-key default members and adjust counted spend. USD amounts are decimal strings in the gateway grammar and are never converted to numbers. Writes support --dry-run with no request, profile or credential read. Reads remain read-only with --dry-run.

Every command also takes the global flags and reads the environment variables that the command reference lists once.

Commands#

CommandDescriptionType
tdx budgets listList budgets.Read
tdx budgets viewRead a budget.Read
tdx budgets createCreate a budget.Write
tdx budgets editUpdate a budget's limit, policy or note.Write
tdx budgets removeRemove a budget.Write
tdx budgets membersList the members of a per-key default budget.Read
tdx budgets adjustCorrect a budget's counted spend.Write

tdx budgets list#

List budgets.

Reads

Read every budget the gateway lets this bearer read (budgets.read); the gateway filters rows by scope and has no pagination, so the list is complete for this reader. Filters are sent as query parameters. Ledger metadata (mode, state, pending, lastSyncAt, rate-limit scope) is reported as the gateway gives it. Uses auth status host-bound bearer rules; --dry-run still reads.

Shell
# GET /control/v1/budgets
tdx budgets list [flags]

Optional flags

FlagTypeDefaultDescription
--target-kindone of org, key, workspace, user, model, eachOnly budgets with this target kind.
--target-idstringOnly budgets whose target names this id.
--windowone of day, week, month, totalOnly budgets with this window.
--stateone of ok, warning, exceededOnly budgets whose progress is in this state.
--workspace-idstringOnly budgets that bind requests made in this workspace; rows then say whether they are inherited.

Output fields (inside data)

FieldTypeDescription
budgetspublic-budget[]Gateway budget views, in gateway order.
ledgerledger-stateSpend ledger mode, state, pending count, lastSyncAt and rate-limit scope.

tdx budgets view#

Read a budget.

Reads

Read one budget and its progress in the current window. Money is {amount, currency: USD} as a decimal string, or null when this reader is not shown amounts. Uses auth status host-bound bearer rules; --dry-run still reads.

Shell
# GET /control/v1/budgets/:budgetId
tdx budgets view --id <string> [flags]

Required flags

FlagTypeDefaultDescription
--idstringBudget id: bud_ followed by a 26-character Crockford ULID.

Output fields (inside data)

FieldTypeDescription
budgetpublic-budget|nullGateway budget view: id, target, window, limit Money, policy, note, counting, timestamps and progress; Money is {amount, currency: USD} or null when hidden; null during dry-run.

tdx budgets create#

Create a budget.

Writes

Create a key, person or model budget with budgets.manage over its target. Org, workspace and per-key default (each) budgets are policy, set by policy rather than here; the gateway refuses to write them through this command with a conflict (exit 6). The gateway decides scope and may refuse (403) or report a duplicate target and window (409). Target and window cannot change later. --limit is a USD decimal string sent exactly as written. Omitted policy fields take gateway defaults. Dry-run reads no profile or credential, sends no request and creates nothing; it reports requested values only. See Checked request values.

Shell
# POST /control/v1/budgets
tdx budgets create --target-kind <key|user|model> --target-id <string> --window <day|week|month|total> --limit <usd> [flags]

Required flags

FlagTypeDefaultDescription
--target-kindone of key, user, modelWhat the budget binds: one key, person or model.
--target-idstringTarget id: the key id, user id or public model id (passed through).
--windowone of day, week, month, totalCalendar window (UTC) or total.
--limitusdUSD decimal string in the gateway grammar: 0 or 1-9 integer digits without a leading zero, then optionally . and 1-9 digits; no sign, exponent or grouping; zero refused; sent exactly as written, never as a number.

Optional flags

FlagTypeDefaultDescription
--within-workspacestringConfine a user or model budget to one workspace id.
--unknown-priceone of block, allowCalls without a known price: block (gateway default) or allow.
--on-limitone of refuse, alertAt the limit: refuse requests (gateway default) or alert only.
--alert-thresholdintegerAlert threshold percentage; repeat in ascending order (the gateway accepts whole percentages 1-100, at most eight, distinct). Repeatable.
--notestringOperator note; amounts readers cannot see hide it too; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token.

Output fields (inside data)

FieldTypeDescription
budgetpublic-budget|nullGateway budget view: id, target, window, limit Money, policy, note, counting, timestamps and progress; Money is {amount, currency: USD} or null when hidden; null during dry-run.
previewwrite-preview|nullRequested change, unchecked by the gateway; null after execution.

tdx budgets edit#

Update a budget's limit, policy or note.

Writes

PATCH only the named fields. Org, workspace and per-key default (each) budgets are policy, set by policy rather than here; the gateway refuses to write them through this command with a conflict (exit 6). Target and window cannot change (create a new budget instead). --alert-threshold replaces the whole list. An edit naming no field is refused locally as a usage error, before any request or dry-run preview; a change equal to current state is a gateway no-op. Dry-run reads no profile or credential and sends no request. See Checked request values.

Shell
# PATCH /control/v1/budgets/:budgetId
tdx budgets edit --id <string> [flags]

Required flags

FlagTypeDefaultDescription
--idstringBudget id: bud_ followed by a 26-character Crockford ULID.

Optional flags

FlagTypeDefaultDescription
--limitusdUSD decimal string in the gateway grammar: 0 or 1-9 integer digits without a leading zero, then optionally . and 1-9 digits; no sign, exponent or grouping; zero refused; sent exactly as written, never as a number.
--unknown-priceone of block, allowCalls without a known price: block (gateway default) or allow.
--on-limitone of refuse, alertAt the limit: refuse requests (gateway default) or alert only.
--alert-thresholdintegerAlert threshold percentage; repeat in ascending order (the gateway accepts whole percentages 1-100, at most eight, distinct). Repeatable.
--notestringOperator note; amounts readers cannot see hide it too; refused locally if it could hide a credential: a percent sign, bare or written %25 (which decodes to %), or an escape that is not valid UTF-8; name: value or name=value where the name contains token, secret, password, key, credential, authorization or cookie; a #, ? or & directly before such a name, or before reset or invite, with or without =; #reset or #invite; Bearer text or a tokedex_ token.
--clear-notebooleanfalseClear the note (sends note: null).

Constraints

  • At most one of --note, --clear-note

Output fields (inside data)

FieldTypeDescription
budgetpublic-budget|nullGateway budget view: id, target, window, limit Money, policy, note, counting, timestamps and progress; Money is {amount, currency: USD} or null when hidden; null during dry-run.
previewwrite-preview|nullRequested change, unchecked by the gateway; null after execution.

tdx budgets remove#

Remove a budget.

Writes

Delete a budget with budgets.manage. Org, workspace and per-key default (each) budgets are policy, set by policy rather than here; the gateway refuses to write them through this command with a conflict (exit 6). Spend counters are facts and remain; a new budget on the scope sees them. Dry-run reads no profile or credential and sends no request. See Checked request values.

Shell
# DELETE /control/v1/budgets/:budgetId
tdx budgets remove --id <string> [flags]

Required flags

FlagTypeDefaultDescription
--idstringBudget id: bud_ followed by a 26-character Crockford ULID.

Output fields (inside data)

FieldTypeDescription
removedbudget-removal|nullRemoved budget id and deleted: true; null during dry-run.
previewwrite-preview|nullRequested change, unchecked by the gateway; null after execution.

tdx budgets members#

List the members of a per-key default budget.

Reads

Members exist for only each (per-key default) budgets; the gateway refuses any other budget. It returns at most 200 members, biggest spenders in the current window first, with no cursor, so a longer membership is truncated at the gateway cap and the reply does not say so. Members outside the reader's spend.read are left out. Uses auth status host-bound bearer rules; --dry-run still reads.

Shell
# GET /control/v1/budgets/:budgetId/members
tdx budgets members --id <string> [flags]

Required flags

FlagTypeDefaultDescription
--idstringBudget id: bud_ followed by a 26-character Crockford ULID.

Output fields (inside data)

FieldTypeDescription
budgetIdstringBudget id.
windowstringBudget window.
windowStartstring|nullCurrent window start.
resetsAtstring|nullCurrent window end.
membersbudget-member[]Scope, spent and remaining Money (null when hidden), state and call count.

tdx budgets adjust#

Correct a budget's counted spend.

Writes

Org, workspace and per-key default (each) budgets are policy, set by policy rather than here; the gateway refuses to write them through this command with a conflict (exit 6). Adjustments are install-wide only: the gateway requires budgets.manage on the install, so a workspace-scoped budget manager is refused (403). A positive amount adds counted spend; a negative amount credits spend back, lifting every budget on that scope, and can give back no more than the budget has counted (409). The reply's amount is signed. With --idempotency-key the gateway keys the settlement by it with the caller, budget and scope: repeating the same adjustment returns the original and applies nothing, and reusing the key for a different amount or reason is a 409 conflict. The CLI never generates a key and never retries; without one, a repeat after an unknown outcome may apply twice. Dry-run reads no profile or credential and sends no request. See Checked request values.

Shell
# POST /control/v1/budgets/:budgetId/adjustments
tdx budgets adjust --id <string> --amount <signed-usd> --reason-code <correction|grant|refund> [flags]

Required flags

FlagTypeDefaultDescription
--idstringBudget id: bud_ followed by a 26-character Crockford ULID.
--amountsigned-usdSigned USD decimal string: the --limit grammar with an optional leading -; zero refused; sent exactly as written. Write --amount -2.5 or --amount=-2.5.
--reason-codeone of correction, grant, refundWhy the counter is corrected.

Optional flags

FlagTypeDefaultDescription
--window-startdatetimeWindow the adjustment is for, as progress.windowStart shows it; refused once that window has ended.
--idempotency-keystringIdempotency-Key header: 1-255 printable ASCII characters without spaces; public de-duplication data, shown as given and never treated as a credential.

Output fields (inside data)

FieldTypeDescription
adjustmentbudget-adjustment|nullSettlement id, budget id, scope, window, signed Money amount (null when hidden) and reason; null during dry-run.
previewwrite-preview|nullRequested change, unchecked by the gateway; null after execution.