Skip to content

fix(analytics): classify opencode-go as a flat-rate subscription - #11199

Merged
diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.50from
pacocartones:fix/11149-opencode-go-flat-rate
Aug 23, 2026
Merged

diegosouzapw merged 1 commit into
diegosouzapw:release/v3.8.50from
pacocartones:fix/11149-opencode-go-flat-rate

Conversation

@pacocartones

Copy link
Copy Markdown
Contributor

opencode-go is a flat monthly subscription (https://opencode.ai/go) but is missing from FLAT_RATE_SUBSCRIPTION_PROVIDER_IDS, so cost analytics prices it per token against the underlying models' metered rates. The dollar figure shown does not correspond to anything the user is billed.

Root cause

src/lib/usage/flatRateProviders.ts keeps an explicit set of subscription/coding-plan ids. opencode-go is absent from it, and it is api-key auth (registered in shared/constants/providers/apikey/gateways.ts:613), so it is not covered by the dynamic WEB_COOKIE_PROVIDERS branch either. isFlatRateProvider("opencode-go") therefore returns false.

Everything else in the path already works: every analytics surface passes flatRateAsZero, so the single missing id is the whole fault. This follows the exact pattern of the claude/cc addition in #10774.

Why the overstatement is large

opencode-go is an aggregator, so one flat subscription resells GLM, Kimi, Grok, DeepSeek, MiniMax, Qwen and GPT-5.x, and each call is priced at the underlying model's rate rather than a single cheap rate. The reporter measured $13.35 reported over 30 days against a $10 flat actual bill.

Red / green

Before, on a clean checkout at 62ab93d78:

✖ isFlatRateProvider: dedicated subscription / coding-plan providers are flat-rate
  AssertionError: opencode-go should be flat-rate
  false !== true
✖ #11149: opencode-go is a flat-rate subscription, not metered
  false !== true
ℹ pass 8  ℹ fail 2

After:

✔ #11149: opencode-go is a flat-rate subscription, not metered
✔ #11149: sibling opencode ids keep their own billing semantics
ℹ tests 10  ℹ pass 10  ℹ fail 0

The new cases extend the existing flat-rate-cost-5552 suite rather than adding a file. They assert the zeroing is still opt-in (without flatRateAsZero the estimate is unchanged, so budget/quota/routing paths are untouched) and that the keyless opencode id is not swept in by a prefix-style match.

Per the note in the issue, this reads as an oversight rather than a deliberate exclusion, so the id is added to the set with a comment explaining the aggregator reasoning, keeping the documented "deliberately excluded" list accurate.

@diegosouzapw one CI note: release/v3.8.50 is red at the base right now (stale ESLint suppressions, unit shards, Fast Quality Gates), so those reds should show on other PRs too and are not from this change.

Closes #11149

@pacocartones
pacocartones force-pushed the fix/11149-opencode-go-flat-rate branch from 656a2d5 to dd9f62b Compare August 23, 2026 02:56
opencode-go is a flat monthly subscription (https://opencode.ai/go) but was missing from FLAT_RATE_SUBSCRIPTION_PROVIDER_IDS, so cost analytics billed it per token against the underlying models' metered rates.

Because it is an aggregator reselling GLM, Kimi, Grok, DeepSeek, MiniMax, Qwen and GPT-5.x, every call was priced at the underlying model's rate, which makes the overstatement large rather than marginal. It is api-key auth, so the dynamic WEB_COOKIE_PROVIDERS branch does not cover it and the explicit id is required.

Closes diegosouzapw#11149
@pacocartones
pacocartones force-pushed the fix/11149-opencode-go-flat-rate branch from dd9f62b to dca7ed2 Compare August 23, 2026 03:59
@diegosouzapw
diegosouzapw merged commit 8d6870f into diegosouzapw:release/v3.8.50 Aug 23, 2026
10 of 16 checks passed
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…gosouzapw#11199)

Validated on the combined batch board over tip 429b730: static gates clean (changelog, file-size 158 frozen, complexity 2626<=2774, cognitive 1183<=1223, dead-code 409<=416), typecheck:core clean, 70 focused tests green (PR suites 49/49 + auth/combo neighbors 21/21).

opencode-go joins FLAT_RATE_SUBSCRIPTION_PROVIDER_IDS — cost analytics stop pricing a flat 0 subscription at metered aggregator rates (3.35 reported vs 0 actual). Same pattern as diegosouzapw#10774. Fixes diegosouzapw#11149. Thank you @pacocartones!
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.

[BUG] opencode-go is a flat-rate subscription but missing from FLAT_RATE_SUBSCRIPTION_PROVIDER_IDS — analytics bills it per token

2 participants