struct

Anthropic::BetaTokenTaskBudget

Inherits JSON::Serializable < Struct < Value < Object

User-configurable total token budget across contexts in a session.

Passed via output_config.task_budget on beta message create calls. The server enforces the total budget and returns updated usage; use remaining to initialize the counter client-side or to cap total spend.

budget = Anthropic::BetaTokenTaskBudget.new(total: 200_000)
output_config = Anthropic::OutputConfig.new(task_budget: budget)

Constructors

new(total : Int32, remaining : Int32 | Nil = nil, type : String = "tokens")
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

remaining

Remaining tokens in the budget. Defaults to total if not provided.

Source
total

Total token budget across all contexts in the session.

Source
type

The budget type. Currently only "tokens" is supported.

Source