fix(providers): wire API-key model-provider plugins into runtime and /model - #21695
fix(providers): wire API-key model-provider plugins into runtime and /model#21695qWaitCrypto wants to merge 3 commits into
Conversation
82f630e to
250f90c
Compare
|
Updated #21695 to cover this path too. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing the picker-to-switch failure; that explicit-provider defect still exists on current main (hermes_cli/model_switch.py:862-889 → hermes_cli/providers.py:700-770).
Problems
hermes_cli/runtime_provider.py:1407only consults a plugin profile when no registry entry exists. Current main auto-registers API-keyProviderProfiles intoPROVIDER_REGISTRY(hermes_cli/auth.py:447-477), so this path drops a plugin's declaredapi_modeafter salvage.hermes_cli/auth.py:543-546accepts every profile env var as a secret. Main explicitly separates*_BASE_URL/*_URLfrom key vars (hermes_cli/auth.py:464-472); the draft must preserve that distinction. The picker has the same issue athermes_cli/model_switch.py:1479-1486.tests/providers/test_plugin_discovery.py:49-63uses a fixed profile count. Current main intentionally uses a directory/registry invariant instead (tests/providers/test_plugin_discovery.py:47-73).
Suggested changes
- Rework the patch around main's existing registration and canonical-picker paths, retaining the missing
resolve_provider_full()profile resolution and profile API-mode propagation. - Add a profile with both a key var and base-URL var, plus a non-default API mode, to test the integrated current-main path.
Automated hermes-sweeper review.
Resolve provider plugin runtime and picker review feedback.
What does this PR do?
This fixes a gap in the v0.13.0 model-provider plugin rollout for API-key providers.
Before this change, plugin-backed
ProviderProfileentries could be discovered throughproviders/, but they did not fully integrate with the runtime provider resolver or the shared/modelpicker:resolve_provider()could still reject a plugin provider slug as unknown unless it also existed inPROVIDER_REGISTRYresolve_api_key_provider_credentials()andget_api_key_provider_status()only handled built-inProviderConfigentriesresolve_runtime_provider()could not route plugin-only API-key providers through the normal generic API-key runtime path/modelbuilt its provider list from models.dev mappings, overlays, canonical built-ins, and user config, but not plugin-only provider profilesThis PR wires API-key model-provider plugins into those paths while preserving the existing special-case runtime logic for providers like
openrouterandcustom.Related Issue
Fixes #21685
Type of Change
Changes Made
hermes_cli/auth.pyresolve_provider()to accept plugin-backed API-key provider slugs and aliasesresolve_api_key_provider_credentials()andget_api_key_provider_status()to support plugin-backed API-key providershermes_cli/runtime_provider.pyopenrouterandcustomlist_authenticated_providers()so/modelincludes plugin-only API-key providers/modelvisibilityHow to Test
$HERMES_HOME/plugins/model-providers/<name>/withenv_vars,base_url, andfallback_modelspython -m pytest tests/hermes_cli/test_provider_plugin_runtime_and_picker.py -qpython -m pytest tests/hermes_cli/test_runtime_provider_resolution.py tests/hermes_cli/test_model_switch_custom_providers.py tests/hermes_cli/test_provider_plugin_runtime_and_picker.py -qpython -m pytest tests/providers/test_plugin_discovery.py tests/hermes_cli/test_api_key_providers.py -qChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/AScreenshots / Logs
python -m pytest tests/hermes_cli/test_runtime_provider_resolution.py tests/hermes_cli/test_model_switch_custom_providers.py tests/hermes_cli/test_provider_plugin_runtime_and_picker.py -q→132 passedpython -m pytest tests/providers/test_plugin_discovery.py tests/hermes_cli/test_api_key_providers.py -q→161 passed