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#
| Command | Description | Type |
|---|---|---|
| tdx budgets list | List budgets. | Read |
| tdx budgets view | Read a budget. | Read |
| tdx budgets create | Create a budget. | Write |
| tdx budgets edit | Update a budget's limit, policy or note. | Write |
| tdx budgets remove | Remove a budget. | Write |
| tdx budgets members | List the members of a per-key default budget. | Read |
| tdx budgets adjust | Correct 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.
# GET /control/v1/budgets
tdx budgets list [flags]Optional flags
| Flag | Type | Default | Description |
|---|---|---|---|
--target-kind | one of org, key, workspace, user, model, each | Only budgets with this target kind. | |
--target-id | string | Only budgets whose target names this id. | |
--window | one of day, week, month, total | Only budgets with this window. | |
--state | one of ok, warning, exceeded | Only budgets whose progress is in this state. | |
--workspace-id | string | Only budgets that bind requests made in this workspace; rows then say whether they are inherited. |
Output fields (inside data)
| Field | Type | Description |
|---|---|---|
budgets | public-budget[] | Gateway budget views, in gateway order. |
ledger | ledger-state | Spend 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.
# GET /control/v1/budgets/:budgetId
tdx budgets view --id <string> [flags]Required flags
| Flag | Type | Default | Description |
|---|---|---|---|
--id | string | Budget id: bud_ followed by a 26-character Crockford ULID. |
Output fields (inside data)
| Field | Type | Description |
|---|---|---|
budget | public-budget|null | Gateway 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.
# 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
| Flag | Type | Default | Description |
|---|---|---|---|
--target-kind | one of key, user, model | What the budget binds: one key, person or model. | |
--target-id | string | Target id: the key id, user id or public model id (passed through). | |
--window | one of day, week, month, total | Calendar window (UTC) or total. | |
--limit | usd | USD 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
| Flag | Type | Default | Description |
|---|---|---|---|
--within-workspace | string | Confine a user or model budget to one workspace id. | |
--unknown-price | one of block, allow | Calls without a known price: block (gateway default) or allow. | |
--on-limit | one of refuse, alert | At the limit: refuse requests (gateway default) or alert only. | |
--alert-threshold | integer | Alert threshold percentage; repeat in ascending order (the gateway accepts whole percentages 1-100, at most eight, distinct). Repeatable. | |
--note | string | Operator 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)
| Field | Type | Description |
|---|---|---|
budget | public-budget|null | Gateway 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. |
preview | write-preview|null | Requested 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.
# PATCH /control/v1/budgets/:budgetId
tdx budgets edit --id <string> [flags]Required flags
| Flag | Type | Default | Description |
|---|---|---|---|
--id | string | Budget id: bud_ followed by a 26-character Crockford ULID. |
Optional flags
| Flag | Type | Default | Description |
|---|---|---|---|
--limit | usd | USD 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-price | one of block, allow | Calls without a known price: block (gateway default) or allow. | |
--on-limit | one of refuse, alert | At the limit: refuse requests (gateway default) or alert only. | |
--alert-threshold | integer | Alert threshold percentage; repeat in ascending order (the gateway accepts whole percentages 1-100, at most eight, distinct). Repeatable. | |
--note | string | Operator 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-note | boolean | false | Clear the note (sends note: null). |
Constraints
- At most one of
--note,--clear-note
Output fields (inside data)
| Field | Type | Description |
|---|---|---|
budget | public-budget|null | Gateway 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. |
preview | write-preview|null | Requested 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.
# DELETE /control/v1/budgets/:budgetId
tdx budgets remove --id <string> [flags]Required flags
| Flag | Type | Default | Description |
|---|---|---|---|
--id | string | Budget id: bud_ followed by a 26-character Crockford ULID. |
Output fields (inside data)
| Field | Type | Description |
|---|---|---|
removed | budget-removal|null | Removed budget id and deleted: true; null during dry-run. |
preview | write-preview|null | Requested 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.
# GET /control/v1/budgets/:budgetId/members
tdx budgets members --id <string> [flags]Required flags
| Flag | Type | Default | Description |
|---|---|---|---|
--id | string | Budget id: bud_ followed by a 26-character Crockford ULID. |
Output fields (inside data)
| Field | Type | Description |
|---|---|---|
budgetId | string | Budget id. |
window | string | Budget window. |
windowStart | string|null | Current window start. |
resetsAt | string|null | Current window end. |
members | budget-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.
# POST /control/v1/budgets/:budgetId/adjustments
tdx budgets adjust --id <string> --amount <signed-usd> --reason-code <correction|grant|refund> [flags]Required flags
| Flag | Type | Default | Description |
|---|---|---|---|
--id | string | Budget id: bud_ followed by a 26-character Crockford ULID. | |
--amount | signed-usd | Signed 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-code | one of correction, grant, refund | Why the counter is corrected. |
Optional flags
| Flag | Type | Default | Description |
|---|---|---|---|
--window-start | datetime | Window the adjustment is for, as progress.windowStart shows it; refused once that window has ended. | |
--idempotency-key | string | Idempotency-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)
| Field | Type | Description |
|---|---|---|
adjustment | budget-adjustment|null | Settlement id, budget id, scope, window, signed Money amount (null when hidden) and reason; null during dry-run. |
preview | write-preview|null | Requested change, unchecked by the gateway; null after execution. |