Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: never claim an exact rate for an open-weights gpt-oss id (#2701)

[._.]/ Adam Eivy6ed00c7d9ec2
diff --git a/server/lib/modelPricing.js b/server/lib/modelPricing.js
index f529766ad1..f93f7a2198 100644
--- a/server/lib/modelPricing.js
+++ b/server/lib/modelPricing.js
@@ -57,10 +57,16 @@ const EXACT_RATES = {
'gemini-2.5-pro': [1.25, 10.0],
'gemini-2.5-flash': [0.3, 2.5],
'gemini-2.5-flash-lite': [0.1, 0.4],
- // Cerebras — open-weights models on an OpenAI-compatible host. Listed exactly
- // (not via the `/gpt/i` family rule) because that rule would otherwise bill
- // `gpt-oss-120b` at OpenAI GPT-5.4's $2.50/$15.00 — off by ~10-20x.
- 'gpt-oss-120b': [0.35, 0.75],
+ // Open-weights rate anchor, not a matchable id — reached only via the
+ // `/gpt-oss/i` family rule and the `cerebras` provider default below, so it
+ // always reports as approximate. `gpt-oss-*` is open-weights: unlike the
+ // vendor-locked ids above, the model id does NOT identify the host, and rates
+ // differ per host — so no bare `gpt-oss` id may claim `matched: 'exact'` (that
+ // suppresses the UI's `~` marker). Cerebras's published rate is the anchor
+ // because Cerebras is the only gpt-oss host PortOS ships; it is a far better
+ // estimate for any host than the `/gpt/i` rule's $2.50/$15.00 GPT-5.4 rates,
+ // which is where these ids landed before (~10-20x too high).
+ 'gpt-oss-120b (cerebras)': [0.35, 0.75],
};
// Exact keys sorted longest-first for the substring pass in
@@ -85,9 +91,9 @@ const FAMILY_RULES = [
{ test: /haiku/i, rateModel: 'claude-haiku-4-5' },
{ test: /codex/i, rateModel: 'gpt-5.3-codex' },
// `gpt-oss-*` is open-weights and hosted cheaply everywhere — it must win over
- // the proprietary `/gpt/i` rule below, which would bill it at ~10-20x. Sizes
- // other than the exact-listed 120b land here.
- { test: /gpt-oss/i, rateModel: 'gpt-oss-120b' },
+ // the proprietary `/gpt/i` rule below, which would bill it at ~10-20x. Every
+ // size/host lands here (never `exact`) since the id alone can't price it.
+ { test: /gpt-oss/i, rateModel: 'gpt-oss-120b (cerebras)' },
{ test: /gpt/i, rateModel: 'gpt-5.4' },
{ test: /grok-build/i, rateModel: 'grok-build-0.1' },
{ test: /grok-4\.20/i, rateModel: 'grok-4.3' },
@@ -104,7 +110,7 @@ const PROVIDER_DEFAULT_RULES = [
// Cerebras hosts a small, uniformly cheap catalog; its flagship's rates are a
// far better estimate for an unrecognized id (e.g. a preview model picked up
// by "Refresh models") than the generic $3/$15 fallback.
- { test: /cerebras/i, rateModel: 'gpt-oss-120b' },
+ { test: /cerebras/i, rateModel: 'gpt-oss-120b (cerebras)' },
];
// Legacy blended estimate (the old flat usage.js rate) — the last resort for a
diff --git a/server/lib/modelPricing.test.js b/server/lib/modelPricing.test.js
index 5ce9f3c331..096c4b312c 100644
--- a/server/lib/modelPricing.test.js
+++ b/server/lib/modelPricing.test.js
@@ -33,14 +33,23 @@ describe('resolveModelRates', () => {
expect(resolveModelRates('codex', 'gpt-5.6-terra-2026-06-01')).toMatchObject({ rateModel: 'gpt-5.6-terra', matched: 'family' });
});
- it('prices Cerebras gpt-oss-120b at its own rates, not OpenAI GPT rates', () => {
+ it('prices Cerebras gpt-oss-120b at open-weights rates, not OpenAI GPT rates', () => {
expect(resolveModelRates('cerebras', 'gpt-oss-120b')).toMatchObject({
- rateModel: 'gpt-oss-120b', inputPer1M: 0.35, outputPer1M: 0.75, matched: 'exact',
+ rateModel: 'gpt-oss-120b (cerebras)', inputPer1M: 0.35, outputPer1M: 0.75,
});
});
it('keeps other gpt-oss sizes on open-weights rates rather than the proprietary /gpt/ rule', () => {
- expect(resolveModelRates('cerebras', 'gpt-oss-20b')).toMatchObject({ rateModel: 'gpt-oss-120b', matched: 'family' });
+ expect(resolveModelRates('cerebras', 'gpt-oss-20b')).toMatchObject({ rateModel: 'gpt-oss-120b (cerebras)', matched: 'family' });
+ });
+
+ // gpt-oss is open-weights: the id does not identify the host, and rates differ
+ // per host — so no bare gpt-oss id may report `exact` (that would strip the
+ // UI's `~` approximate marker and claim a published rate we don't have).
+ it('never reports an exact match for an open-weights gpt-oss id on any host', () => {
+ for (const providerId of ['cerebras', 'groq', 'openrouter', 'some-custom-host']) {
+ expect(resolveModelRates(providerId, 'gpt-oss-120b').matched).not.toBe('exact');
+ }
});
it('still resolves proprietary OpenAI ids through the gpt family rule', () => {
@@ -48,7 +57,7 @@ describe('resolveModelRates', () => {
});
it('estimates an unrecognized Cerebras model at the Cerebras flagship rate', () => {
- expect(resolveModelRates('cerebras', 'zai-glm-4.7')).toMatchObject({ rateModel: 'gpt-oss-120b', matched: 'providerDefault' });
+ expect(resolveModelRates('cerebras', 'zai-glm-4.7')).toMatchObject({ rateModel: 'gpt-oss-120b (cerebras)', matched: 'providerDefault' });
});
it('falls back to a provider default when the model is unknown', () => {