feat(models): add opt-in low-noise /v1/models catalog mode#4427
Merged
diegosouzapw merged 3 commits intoJun 21, 2026
Merged
Conversation
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
3af48f2 to
1c23c3f
Compare
…override Implements the low-noise catalog design from issue diegosouzapw#4424, aligned with @diegosouzapw's proposed shape. ## Problem GET /v1/models returns duplicate-looking model entries when a provider's alias differs from its canonical ID (e.g. ds-web vs deepseek-web). On a real instance: 868 total entries, 84 cross-prefix duplicate suffix groups, 3 exact duplicate IDs. DeepSeek Web alone contributes 14 pairs. ## Solution Add a 3-value enum setting MODELS_CATALOG_PREFIX_MODE: dual (default) — backward-compatible, emits alias + canonical IDs alias — alias-prefix only (e.g. ds-web/model) canonical — canonical provider-id only (e.g. deepseek-web/model) Also adds a per-request ?prefix=<mode> query-param override so clients can select their prefix style per-call without changing the global setting. Request-time alias resolution is unchanged — all forms stay routable. ## Files changed - src/shared/constants/featureFlagDefinitions.ts: new enum flag - src/shared/utils/featureFlags.ts: getModelsCatalogPrefixMode() helper - src/app/api/v1/models/catalog.ts: wire prefixMode at 3 emission sites - tests/unit/models-catalog-low-noise-flag.test.ts: 4 tests (alias mode, dual mode, ?prefix=alias override, ?prefix=canonical override) - tests/unit/feature-flags-settings.test.ts: update flag assertion Relates to: diegosouzapw#4424
In canonical prefix mode, synced and custom model sections were pushing aliasId unconditionally before the includeCanonical guard, so canonical mode still emitted both ds-web/* and deepseek-web/* entries. Gate the alias-prefixed push with includeAlias=true and fix the parent reference in the canonical entry to null when includeAlias is false. Before: canonical mode returned 656 models (both prefixes present) After: canonical mode returns 124 models (only canonical prefix)
…ize baseline (review) Co-authored-by: diegosouzapw <diego.souza@cdwasolutions.com.br>
d27dd35 to
84fe309
Compare
620da16
into
diegosouzapw:release/v3.8.32
10 of 14 checks passed
This was referenced Jun 21, 2026
This was referenced Jun 21, 2026
diegosouzapw
pushed a commit
to Rahulsharma0810/OmniRoute
that referenced
this pull request
Jun 21, 2026
…iants When the catalog emits canonical-prefixed model ids (MODELS_CATALOG_PREFIX_MODE=canonical), no-thinking variants built by appendNoThinkingVariants were using the raw alias prefix (e.g. cc/...) instead of the canonical provider name (e.g. claude/...), making the variant ids inconsistent with the rest of the catalog. Changes: - open-sse/utils/noThinkingAlias.ts: add normalizeProviderPrefix() helper and optional aliasToCanonical param to appendNoThinkingVariants(). When the map is provided, the inner provider prefix of each generated no-think id is normalized to its canonical form. - src/app/api/v1/models/catalog.ts: pass aliasToProviderId when prefixMode === 'canonical' so variant ids are canonical-prefix-consistent. - tests/unit/no-thinking-alias.test.ts: 2 new tests covering alias normalization and no-map passthrough. Refs: diegosouzapw#4427
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.
What this PR does
Implements the
MODELS_CATALOG_PREFIX_MODEsetting proposed by @diegosouzapw in #4424.The
/v1/modelsendpoint currently emits two catalog entries per model whenever a provider's short alias differs from its canonical ID (e.g.ds-web/modelanddeepseek-web/model). This PR adds an opt-in way to suppress the duplicate while keeping full backward compatibility.New setting
/v1/modelsoutputdual(default)aliasds-web/model)canonicaldeepseek-web/model)A per-request
?prefix=<mode>query-param override is also supported, so individual clients can choose their preferred form without changing the global setting.Measured impact on a real instance
Switching to
aliasmode eliminates all 84 cross-prefix duplicate suffix groups.Files changed
src/shared/constants/featureFlagDefinitions.tsMODELS_CATALOG_PREFIX_MODEenum flag (dual/alias/canonical, default dual)src/shared/utils/featureFlags.tsgetModelsCatalogPrefixMode()helpersrc/app/api/v1/models/catalog.tsprefixMode+?prefix=param at all 3 provider-ID emission sitestests/unit/models-catalog-low-noise-flag.test.ts?prefix=alias,?prefix=canonicaltests/unit/feature-flags-settings.test.tsTests
What's not in this PR (can be follow-ups)
codex/gpt-5.5×2 etc.)X-Prefix-Modeheader alternativeRelates to #4424