Skip to content

fix: hide compact models from public listings - #1

Merged
znhisme merged 1 commit into
mainfrom
fix/hide-compact-models-billing
May 10, 2026
Merged

fix: hide compact models from public listings#1
znhisme merged 1 commit into
mainfrom
fix/hide-compact-models-billing

Conversation

@znhisme

@znhisme znhisme commented May 10, 2026

Copy link
Copy Markdown
Owner

Fix report: hide -openai-compact internal variants and inherit base billing

Summary

This patch keeps *-openai-compact available for internal Codex /v1/responses/compact routing, but prevents those internal variants from being exposed as user-selectable/public pricing models.

It also changes compact billing lookup so a compact variant inherits the base model's configured billing first. For example:

  • gpt-5.4-openai-compact now inherits configured billing from gpt-5.4.
  • If the base model has no configured billing, existing *-openai-compact wildcard/default fallback behavior remains available.

Why

In suffix-based compact routing builds, deleting compact models from channel abilities can break Codex compaction with errors such as No available channel for model ...-openai-compact.

However, exposing compact variants in public model/pricing endpoints is confusing and can show inaccurate prices. When ModelRatio has gpt-5.4 but does not have gpt-5.4-openai-compact, the compact variant can fall back to the built-in default ratio (37.5) instead of the base model's configured ratio.

Changes

  • Filter compact suffix models from public model list responses:
    • token-limited /v1/models path
    • group-enabled /v1/models path
    • channel model list response
    • dashboard model list response
    • enabled model list response
  • Filter compact suffix models from /api/pricing output.
  • Add CompactBaseModelName helper.
  • Update billing lookups so compact variants inherit base model values before wildcard/default fallback:
    • model price
    • model ratio
    • completion ratio / completion ratio info
    • cache ratio
    • create-cache ratio
  • Add regression tests for pricing filtering and compact billing inheritance.

Verification

Ran locally:

go test ./setting/ratio_setting ./controller -count=1

Result:

ok  	github.com/QuantumNous/new-api/setting/ratio_setting
ok  	github.com/QuantumNous/new-api/controller

Related upstream context

Keep -openai-compact variants available for internal Codex compact routing while filtering them from public model and pricing list responses. Compact billing now inherits the base model's configured price and ratios before falling back to the compact wildcard/default behavior.
@znhisme
znhisme merged commit 6579a1b into main May 10, 2026
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.

1 participant