Repository navigation
Feat:usage display currency - #51429
Meinianda-L wants to merge 3 commits into
Conversation
…ding USD The usage_update ACP event hardcodes currency: "USD" regardless of the provider's actual currency configuration. This causes non-USD providers (e.g. EUR-priced custom providers) to report incorrect currency labels. Add an optional `currency` field to the ProviderCost schema (defaults to "USD" when omitted for backward compatibility). Thread the configured currency through to both usage_update call sites (usage.ts layer and service.ts ACP client) using a cached lookup pattern matching the existing contextLimit implementation. Fixes anomalyco#38667 Signed-off-by: kagura-agent <[email protected]>
Add a display.currency config option that converts usage costs to the user's preferred currency at presentation boundaries (ACP usage_update, TUI, and app). The provider/model currency remains the source currency: when no display currency is configured, costs are shown unchanged in the source currency, and amounts are never relabeled when conversion is impossible (unknown rate). - Add Currency core module: approximate USD-based display rate table, convert() with user rate overrides, and locale-aware format() - Add display.currency and display.rates to the config schema - Convert in both ACP usage_update paths (Effect layer and ACP client) - Replace hardcoded USD formatters in TUI (sidebar, prompt, subagent footer) and app (context usage, context tab) with the shared utility - Regenerate SDK types and document the new options Relates to anomalyco#32485. Supersedes the approach explored in anomalyco#32487 and builds on provider-currency propagation from anomalyco#39425.
…encies Other currencies can be added via display.exchangeRates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
Issue for this PR
Closes #32485
Type of change
Bug fix
New feature
Refactor / code improvement
Documentation
What does this PR do?
Lets you choose the currency usage costs are shown in, instead of always USD. This continues feat: support configurable cost display currency #41208, which was closed
after I deleted my fork.
It adds
display.currencyanddisplay.exchangeRatesto the config:{ "display": { "currency": "CNY", "exchangeRates": { "HKD": 7.8 } } }subagent footer, the app's context views, and ACP usage_update.
for display only, not billing. Any other currency can be added, and any built-in rate overridden, with
display.exchangeRates (units per 1 USD).
converting it.
providers that bill in CNY don't get converted twice. It also fixes ACP
usage_updatemislabels non-USD costs as USD #38667.Not changed: CLI stats and the run footer, because they add up costs across models without knowing each one's
currency.
How did you verify your code works?
Screenshots / recordings
Checklist