Skip to content

feat: add context_budget_cap to provider defaults for cost-optimal budgeting - #27

Open
Salil Das (sadlilas) wants to merge 1 commit into
microsoft:mainfrom
sadlilas:feat/context-budget-cap
Open

feat: add context_budget_cap to provider defaults for cost-optimal budgeting#27
Salil Das (sadlilas) wants to merge 1 commit into
microsoft:mainfrom
sadlilas:feat/context-budget-cap

Conversation

@sadlilas

Copy link
Copy Markdown
Collaborator

Summary

Adds context_budget_cap: 200_000 to Anthropic's ProviderInfo.defaults when enable_1m_context is active and the model supports 1M context.

Why

Anthropic charges 2x input / 1.5x output above 200k tokens. The context module (context-simple) needs a signal from the provider to cap its working budget at the cost-optimal threshold, rather than using the full 1M context window.

What changes

  • When enable_1m_context is active and the model supports 1M: defaults["context_budget_cap"] = 200_000
  • When 1M is not active (standard 200k window): context_budget_cap is None (no cap needed -- the window itself is 200k)

Design

This is part of a provider-driven budget cap approach that replaces the fraction-based approach in context-simple PR #5. See amplifier-support#57 analysis for the full rationale.

The key insight: pricing knowledge belongs in the provider, not the context module. Providers with tiered pricing emit a cap; providers with flat pricing (OpenAI) emit nothing.

Related PRs

  • provider-gemini: Same context_budget_cap: 200_000 (Gemini has the same pricing cliff)
  • context-simple: Reads context_budget_cap from provider defaults and applies budget = min(raw_budget, cap - safety_margin)

Related issues

  • microsoft-amplifier/amplifier-support#57

🤖 Generated with Amplifier

…dgeting

Anthropic charges 2x input / 1.5x output above 200k tokens. Set
context_budget_cap in ProviderInfo.defaults when enable_1m_context is
active so context modules can cap their working budget at the pricing
threshold. The full 1M context_window remains as safety net for overflow.

Related: microsoft-amplifier/amplifier-support#57

🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier)

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant