feat(cli): add list_picker_providers for credential-filtered picker (salvage #13561)#20298
Merged
Conversation
The Telegram/Discord /model pickers currently call list_authenticated_providers(), which returns every provider whose credentials resolve locally and every model in its curated snapshot. Two failure modes fall out: - OpenRouter rows can include IDs the live catalog no longer carries. - Provider rows can surface with zero callable models (e.g. a slug whose credential pool entry exists but has nothing behind it). list_picker_providers() wraps the base function and post-processes the result so the interactive picker only shows models the user can actually select: - OpenRouter's models come from fetch_openrouter_models() (live-catalog filtered against the curated OPENROUTER_MODELS snapshot). - Rows with an empty models list are dropped, except custom endpoints (is_user_defined=True with an api_url) where the user may enter model ids manually. - All other fields pass through unchanged. The gateway /model handler switches to the new helper for the interactive picker payload only. Typed /model <name> and the text fallback list stay on list_authenticated_providers() so nothing is hidden from power users or platforms without a picker. Covered by nine focused unit tests in tests/hermes_cli/test_list_picker_providers.py. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Salvages @Tkander1715's PR #13561 onto current main.
What it does
The Telegram/Discord
/modelinteractive pickers calledlist_authenticated_providers(), which included OpenRouter IDs the live catalog no longer carries and providers with zero callable models. The picker then showed selections that 404'd on use.Adds
list_picker_providers()as a post-processor: OpenRouter models come fromfetch_openrouter_models()(live-catalog-filtered), empty-models rows are dropped (except custom endpoints where users type IDs manually), everything else passes through. Gateway's interactive-picker call site switches; typed/model <name>and text-fallback listings stay on the base function so power users aren't gated.Changes
hermes_cli/model_switch.py— newlist_picker_providershelper.gateway/run.py— picker code path uses the new helper.tests/hermes_cli/test_list_picker_providers.py— 9 focused tests.scripts/release.py— AUTHOR_MAP entry for Tkander1715.Validation
tests/hermes_cli/ -k 'authenticated or picker'— 109 passed locally.Closes #13561 via salvage.