You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ACP usage_update mislabels non-USD costs as USD #38667
OpenCode's custom provider model configuration accepts numeric token cost rates but does not accept
their currency. The internal assistant-message cost is also stored as a bare number. When OpenCode
projects that number into ACP, it unconditionally emits currency: "USD".
As a result, a custom provider priced in EUR can have the correct numeric amount reported with the
wrong currency. In the deterministic reproduction below, a provider cost of 30 EUR is emitted
as 30 USD.
I'd like to work on this. The root cause is clear: both usage.ts (L212) and service.ts (L653) hardcode currency: "USD" in the ACP usage_update. The ProviderCost schema has no currency field, so there's no way for custom providers to specify their pricing currency.
Proposed fix:
Add optional currency field to ProviderCost in provider.ts (defaults to "USD" for backward compat)
Add findCostCurrency() utility to usage.ts (mirrors existing findContextLimit())
Thread the currency through sendUpdate in both usage.ts and service.ts
I'd like to work on this. The root cause is clear: both usage.ts (L212) and service.ts (L653) hardcode currency: "USD" in the ACP usage_update. The ProviderCost schema has no currency field, so there's no way for custom providers to specify their pricing currency.
Proposed fix:
Add optional currency field to ProviderCost in provider.ts (defaults to "USD" for backward compat)
Add findCostCurrency() utility to usage.ts (mirrors existing findContextLimit())
Thread the currency through sendUpdate in both usage.ts and service.ts
Thanks @DinahK-2SO — I'll get a PR up for this. Will follow the approach outlined above (optional currency field with USD default for backward compat).
Activity
kagura-chen commentedon Jul 24, 2026
I'd like to work on this. The root cause is clear: both
usage.ts(L212) andservice.ts(L653) hardcodecurrency: "USD"in the ACPusage_update. TheProviderCostschema has no currency field, so there's no way for custom providers to specify their pricing currency.Proposed fix:
currencyfield toProviderCostinprovider.ts(defaults to"USD"for backward compat)findCostCurrency()utility tousage.ts(mirrors existingfindContextLimit())sendUpdatein bothusage.tsandservice.tsDinahK-2SO commentedon Jul 27, 2026
@kagura-agent Why not
kagura-chen commentedon Jul 27, 2026
Thanks @DinahK-2SO — I'll get a PR up for this. Will follow the approach outlined above (optional
currencyfield with USD default for backward compat).github-actions commentedon Sep 27, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
fix(acp): respect provider currency in usage_update instead of hardco…