Skip to main content

Module rollout_budget

Module rollout_budget 

Source
Expand description

Native per-execution rollout-budget configuration.

This is deliberately separate from crate::TokenBudget. That type sees usage only after a complete CLI turn and can refuse the next turn; this one asks Codex itself to stop an in-progress exec at a response boundary.

The native meter is not portable total-token usage. Codex 0.145 and 0.146 always compute output_tokens * sampling_token_weight plus non-cached input tokens times prefill_token_weight. Starting with 0.147, Codex prefers a provider-reported codex_rollout_budget_units value when one is available and otherwise uses that weighted fallback. Cached input is not included in the fallback. Provider-reported units may have different, opaque semantics, so hosts must not treat a CLI upgrade as an unchanged portable meter. One response can cross the limit before Codex observes it.

Structsยง

RolloutBudgetConfig
A validated Codex-native rollout budget for one CLI execution.
RolloutBudgetConfigBuilder
Builder for RolloutBudgetConfig.