Skip to content

fix(cli): non-zero /model counts for native OpenAI and direct API rows#14753

Closed
XieNBi wants to merge 1 commit into
NousResearch:mainfrom
XieNBi:fix/model-picker-openai-native-counts
Closed

fix(cli): non-zero /model counts for native OpenAI and direct API rows#14753
XieNBi wants to merge 1 commit into
NousResearch:mainfrom
XieNBi:fix/model-picker-openai-native-counts

Conversation

@XieNBi

@XieNBi XieNBi commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes misleading total_models: 0 in list_authenticated_providers() for:

  1. Built-in openai — the Hermes↔models.dev mapping existed, but _PROVIDER_MODELS had no "openai" entry, so the curated list was always empty.
  2. providers: rows that point at the official OpenAI API (api.openai.com) but omit an explicit models / default_model list — the picker now falls back to the same native OpenAI curated catalog instead of showing zero.

Also extends provider_model_ids("openai") to probe /v1/models when OPENAI_API_KEY is set, with static catalog as fallback.

Aligns with upstream issue: #14651

Changes

  • hermes_cli/models.py — add _PROVIDER_MODELS["openai"]; optional live model list via fetch_api_models + env OPENAI_API_KEY / OPENAI_BASE_URL.
  • hermes_cli/model_switch.py — for user providers: entries with empty model lists and an official OpenAI base URL, backfill from the built-in openai curated list.
  • tests/hermes_cli/test_user_providers_model_switch.py — regression tests for static catalog, built-in row totals, and user-provider fallback.

Test plan

python -m pytest tests/hermes_cli/test_user_providers_model_switch.py -q -o addopts=

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard provider/openai OpenAI / Codex Responses API labels Apr 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #14651 (upstream issue this fixes) and prior attempt #13190.

@XieNBi

XieNBi commented Apr 23, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for flagging overlap with #13190.

#13190 was closed as partially redundant: the duplicate-row work landed on main via _section3_emitted_pairs, while the live OpenAI count enrichment path from that PR was not merged. Issue #14651 tracks the remaining symptom (OpenAI / OpenAI Direct still showing total_models: 0 on latest main).

#14753 is intentionally narrower than #13190: it adds a native openai curated catalog in _PROVIDER_MODELS, a small providers: fallback when the base URL is api.openai.com with no explicit models, and an optional /v1/models probe in provider_model_ids("openai") — without re-landing the already-resolved dedupe changes from #13190.

Happy to adjust if maintainers prefer a different approach, but this is meant as the #14651 follow-up, not a re-submission of the full #13190 bundle.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for this fix, @XieNBi! These changes have already landed on main — this PR's commit was applied directly to the branch.

Automated hermes-sweeper review confirms the implementation is present:

  • _PROVIDER_MODELS["openai"] catalog entry added at hermes_cli/models.py line 145 (commit 4a51ab61)
  • api.openai.com fallback for empty user-provider model lists at hermes_cli/model_switch.py line 1283
  • Optional /v1/models probe in provider_model_ids("openai") at hermes_cli/models.py line 1814
  • Regression tests present in tests/hermes_cli/test_user_providers_model_switch.py line 204

The fix is pending inclusion in the next tagged release. Closing as implemented on main.

@teknium1 teknium1 closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists provider/openai OpenAI / Codex Responses API type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants