Change model display format from "model (provider)" to "model__provider"#27
Merged
Conversation
…ider" The previous display form contained a space and parens, which strict clients (e.g. Hermes) reject with "model names cannot contain spaces". Replace it with a double-underscore separator: no whitespace, no parens, and no "/" (which other clients truncate on). Any spaces inside the upstream model id or provider name are also replaced with "_" so the displayed id is always whitespace-free; the route cache preserves the original names for forwarding. The legacy "model (provider)" form is still accepted as input on proxied endpoints for backward compatibility.
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.
Summary
This PR changes the model ID display format returned by
GET /v1/modelsfrom"model (provider)"to"model__provider"to improve compatibility with strict client validators and prevent silent truncation in client menus.Key Changes
New display format: Model IDs now use double-underscore separator (
model__provider) instead of space and parentheses (model (provider))/boundaries in some clientsBackward compatibility: The resolver still accepts the legacy
"model (provider)"format for existing clientsmodel__provider, canonicalprovider/model, or legacymodel (provider)Documentation updates:
Comprehensive test coverage: New test file
test_proxy_display_id_format.pyensures:model__providerformat with no spaces/parensImplementation Details
_fetch_provider_models()function now sanitizes both the upstream model ID and provider name before constructing the display ID_resolve_provider()function includes cold-cache fallback parsing for the new__separator format_upstream_idfor actual request forwardinghttps://claude.ai/code/session_018vws2p6bhd3xESL3Jx4S3h