fix(analytics): classify opencode-go as a flat-rate subscription - #11199
Merged
diegosouzapw merged 1 commit intoAug 23, 2026
Merged
diegosouzapw merged 1 commit into
diegosouzapw merged 1 commit into
Conversation
pacocartones
force-pushed
the
fix/11149-opencode-go-flat-rate
branch
from
August 23, 2026 02:56
656a2d5 to
dd9f62b
Compare
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
force-pushed
the
fix/11149-opencode-go-flat-rate
branch
from
August 23, 2026 03:59
dd9f62b to
dca7ed2
Compare
diegosouzapw
merged commit Aug 23, 2026
8d6870f
into
diegosouzapw:release/v3.8.50
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!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
opencode-gois a flat monthly subscription (https://opencode.ai/go) but is missing fromFLAT_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.tskeeps an explicit set of subscription/coding-plan ids.opencode-gois absent from it, and it is api-key auth (registered inshared/constants/providers/apikey/gateways.ts:613), so it is not covered by the dynamicWEB_COOKIE_PROVIDERSbranch either.isFlatRateProvider("opencode-go")therefore returnsfalse.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 theclaude/ccaddition in #10774.Why the overstatement is large
opencode-gois 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:After:
The new cases extend the existing
flat-rate-cost-5552suite rather than adding a file. They assert the zeroing is still opt-in (withoutflatRateAsZerothe estimate is unchanged, so budget/quota/routing paths are untouched) and that the keylessopencodeid 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.50is 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