briefcase.cost
pip install briefcase-aiCost types ship in the base package under briefcase.cost — there is no cost
extra.
Platform-qualified Bedrock IDs normalize automatically when no exact table key
exists. briefcase._native.normalize_model_id(model_id) exposes the same
normalizer used by the Node binding.
CostCalculator
from briefcase.cost import CostCalculator
calculator = CostCalculator()
estimate = calculator.estimate_cost("claude-haiku-4-5", 1000, 500)print(estimate.total_cost, estimate.input_cost, estimate.output_cost)
# rate_card (platform × tier) and cache tokens are keyword-only (3.2.1)batch = calculator.estimate_cost("claude-opus-4-8", 500_000, 50_000, rate_card="bedrock:batch")cached = calculator.estimate_cost("claude-opus-4-8", 0, 1000, cache_read_tokens=100_000)print(batch.total_cost, cached.cache_cost)print(calculator.get_available_rate_cards())
budget = calculator.check_budget(85.0, 100.0)print(budget.status, budget.percent_used, budget.remaining_budget, budget.alert_message)
print(calculator.compare_models("claude-haiku-4-5", "gpt-5.4-mini", 1000, 500))print(calculator.project_monthly_cost("claude-haiku-4-5", 5000, 2000, 30))CostCalculator() .estimate_cost(model_name, input_tokens, output_tokens, *, rate_card=None, cache_read_tokens=None, cache_write_5m_tokens=None, cache_write_1h_tokens=None) -> CostEstimate .estimate_cost_from_text(model_name, input_text, estimated_output_tokens, *, rate_card=None) .estimate_tokens(text) .check_budget(current_spend, budget_limit) -> BudgetStatus .compare_models(model_a, model_b, input_tokens, output_tokens, *, rate_card=None) .project_monthly_cost(model_name, daily_input_tokens, daily_output_tokens, days_per_month, *, rate_card=None) .get_available_rate_cards() -> list[str] .get_available_models() .get_cheapest_model(min_context_window) .get_models_by_provider(provider) .get_models_under_cost(max_cost_per_1k)A rate_card is a forgiving platform × tier × modifiers string (platforms
first_party / bedrock / vertex / azure; tiers standard / batch /
cached / priority / flex). Omit it for first-party standard pricing.
CostEstimate
Attributes: model_name, input_tokens, output_tokens, input_cost,
output_cost, cache_cost, total_cost, cost_per_token, currency, plus
to_dict().
BudgetStatus
Attributes: status, percent_used, remaining_budget, current_spend,
budget_limit, alert_message, plus to_dict().