Skip to content

Change model display format from "model (provider)" to "model__provider"#27

Merged
BillJr99 merged 2 commits into
mainfrom
claude/brave-carson-0U2UL
May 25, 2026
Merged

Change model display format from "model (provider)" to "model__provider"#27
BillJr99 merged 2 commits into
mainfrom
claude/brave-carson-0U2UL

Conversation

@BillJr99
Copy link
Copy Markdown
Owner

Summary

This PR changes the model ID display format returned by GET /v1/models from "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))

    • Eliminates spaces and parentheses that break strict validators (e.g., Hermes)
    • Avoids silent truncation at / boundaries in some clients
    • Sanitizes spaces in upstream model IDs and provider names to underscores
  • Backward compatibility: The resolver still accepts the legacy "model (provider)" format for existing clients

    • Cold-cache fallback parsing added for both new and legacy formats
    • Clients can submit any of three forms: new model__provider, canonical provider/model, or legacy model (provider)
  • Documentation updates:

    • README now documents the new display format and explains why it was chosen
    • Docstrings updated to reflect format changes and backward compatibility
    • Test client validation updated to recognize all three accepted formats
  • Comprehensive test coverage: New test file test_proxy_display_id_format.py ensures:

    • Display IDs follow the model__provider format with no spaces/parens
    • Spaces in upstream model names and provider names are sanitized to underscores
    • Original upstream IDs are preserved for routing
    • Legacy format still resolves correctly for backward compatibility

Implementation Details

  • The _fetch_provider_models() function now sanitizes both the upstream model ID and provider name before constructing the display ID
  • The _resolve_provider() function includes cold-cache fallback parsing for the new __ separator format
  • Route cache continues to use the sanitized display ID as the key, while the original upstream ID is preserved in _upstream_id for actual request forwarding

https://claude.ai/code/session_018vws2p6bhd3xESL3Jx4S3h

claude added 2 commits May 25, 2026 15:56
…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.
@BillJr99 BillJr99 merged commit d1518e2 into main May 25, 2026
4 checks passed
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.

2 participants