Skip to content

fix(server): price Daybreak models under their LiteLLM alias - #7802

Open
Exotic209093 wants to merge 1 commit into
pingdotgg:mainfrom
Exotic209093:fix/daybreak-model-pricing-alias
Open

fix(server): price Daybreak models under their LiteLLM alias#7802
Exotic209093 wants to merge 1 commit into
pingdotgg:mainfrom
Exotic209093:fix/daybreak-model-pricing-alias

Conversation

@Exotic209093

@Exotic209093 Exotic209093 commented Aug 21, 2026

Copy link
Copy Markdown

Summary

Fixes #7752. Codex records Daybreak model usage as gpt-daybreak-blue-latest and gpt-daybreak-red-latest. LiteLLM's model_prices_and_context_window.json publishes rates for these same models under different keys, without the gpt- prefix: daybreak-blue-latest and daybreak-red-latest. Because lookupRate in apps/server/src/usage/usagePricing.ts looks the model up by its exact normalized name, the mismatch means both models miss the rate table entirely and get reported as unpriced ($0.00), even though token counts are recorded correctly.

Fix

Added a narrow, explicit two-entry alias map (MODEL_NAME_ALIASES) consulted in lookupRate after normalization and before the table lookup. This is deliberately not a generic "strip a leading gpt-" transform: LiteLLM prices real GPT models (gpt-5, gpt-4, ...) with the gpt- prefix intact, so a generic strip would send those lookups at the wrong (and likely nonexistent) key. normalizeModelName and parseRateTable are unchanged — the alias only applies at lookup time, not when building the table from LiteLLM's document.

Test plan

  • Added apps/server/src/usage/usagePricing.test.ts covering: daybreak-blue-latest/daybreak-red-latest priced correctly via their Codex gpt- prefixed names; the alias is case-insensitive; a real gpt- model (gpt-5) still resolves under its own key and is unaffected by the alias; a real gpt- model absent from the table (gpt-4) stays unpriced rather than matching a stripped-prefix key. Confirmed the tests fail before the fix and pass after.
  • vp test run apps/server/src/usage/usagePricing.test.ts — 5 passed.
  • vp lint on both changed files — clean.
  • vp run --filter t3 typecheck — clean (only pre-existing, unrelated suggestions in other files).

Note

Low Risk
Narrow lookup-only alias for two model names; no billing write path, auth, or table-parse changes.

Overview
Fixes Daybreak usage showing as $0.00 because Codex records gpt-daybreak-blue-latest / gpt-daybreak-red-latest while LiteLLM prices those models without the gpt- prefix.

lookupRate now remaps those two names via an explicit MODEL_NAME_ALIASES map after normalization. Real GPT models keep their prefixed keys; there is no generic prefix strip. Tests cover both aliases, case-insensitivity, and that gpt-5 / missing gpt-4 are unchanged.

Reviewed by Cursor Bugbot for commit 1223d7f. Configure here.

Note

Fix pricing for Daybreak models by aliasing gpt-daybreak-* to unprefixed rate keys

Adds a MODEL_NAME_ALIASES map in usagePricing.ts that maps gpt-daybreak-blue-latest and gpt-daybreak-red-latest to their unprefixed rate-table keys. lookupRate now checks this map after normalization and unpriceable checks, using the aliased key when present and falling back to the normalized name otherwise.

  • Adds vitest coverage for aliasing, case-insensitivity, genuine gpt--prefixed models, and non-stripping of absent entries like gpt-4.
  • Risk: only the two explicit gpt-daybreak-* names are remapped; other gpt--prefixed model lookups are unchanged.

Macroscope summarized 1223d7f.

Codex records Daybreak usage as gpt-daybreak-blue-latest and
gpt-daybreak-red-latest, but LiteLLM's price table keys those same models
without the gpt- prefix. The mismatch made lookupRate miss the table and
report both models as unpriced ($0.00) even though tokens were counted
correctly.

Add a narrow, explicit two-entry alias map consulted after normalization
and before the table lookup. This is intentionally not a generic
gpt- prefix strip, since LiteLLM prices real GPT models (gpt-5, gpt-4, ...)
with that prefix intact, and stripping it generically would send those
lookups at the wrong key.

Fixes pingdotgg#7752
@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 26cb89b2-d19a-4b00-b681-1a0b1ba23b10

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 21, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1223d7f070

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +120 to +121
const aliased = MODEL_NAME_ALIASES.get(normalized) ?? normalized;
return table.get(aliased) ?? null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Prefer the exact rate before applying the alias

If LiteLLM starts publishing either Daybreak model under its provider-recorded gpt-daybreak-… key—especially if it removes the current unprefixed key—this unconditional rewrite ignores the exact entry and returns null, making the model unpriced again. Since the rate document is fetched dynamically, look up normalized first and use the alias only as a fallback.

Useful? React with 👍 / 👎.

@macroscopeapp

macroscopeapp Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at 1223d7f

Macroscope's review found this PR approvable — Small, targeted fix adding two explicit model name aliases for pricing lookups, with comprehensive test coverage. The unresolved review comment suggests defensive future-proofing but does not identify a bug in the current implementation.

You can add or adjust custom eligibility rules. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Usage leaves Daybreak models unpriced because Codex and LiteLLM use different aliases

1 participant