Skip to main content

diagrid tokenbudget create

Create a token budget

Description

Create a new token budget in a project.

A TokenBudget caps token consumption for conversation requests within a project. Use --scope-id, --scope-component, and --scope-model to narrow which requests the budget applies to; empty selectors match anything.

To replace an existing budget in place, use 'diagrid apply -f' — the canonical upsert path that works for every resource kind.

diagrid tokenbudget create <name> [flags]

Examples


# Create a project-wide budget of 1,000,000 tokens per day (alert only)
diagrid tokenbudget create my-budget --limit 1000000 --window day --mode alert

# Create a budget scoped to a single id that enforces the limit hourly
diagrid tokenbudget create id-budget --limit 50000 --window hour --mode enforce --scope-id my-id

# Create from a YAML manifest (name is taken from metadata.name)
diagrid tokenbudget create -f my-budget.yaml

Options

-p, --project string Name of existing project
--limit int Token allowance per window (total prompt + completion tokens)
--window string Reset window: day, hour, or month
--mode string Enforcement mode: alert (count only) or enforce (reject over-budget requests)
--scope-id string Limit the budget to a single id
--scope-component string Limit the budget to a single conversation component
--scope-model string Limit the budget to a single model
-f, --file string Path to a YAML manifest describing the TokenBudget. Mutually exclusive with the inline spec flags.
-w, --wait Wait for long-running resource creation to finish
-h, --help help for create

Options inherited from parent commands

--api-key string Diagrid Cloud API key

SEE ALSO