hermes - ✅(Solved) Fix bug(model-picker): OpenAI and OpenAI Direct show 0 models on latest main [1 pull requests, 3 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#14651Fetched 2026-04-24 06:15:39
View on GitHub
Comments
3
Participants
2
Timeline
8
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×3cross-referenced ×1

On latest main, the CLI /model picker still shows OpenAI and OpenAI Direct with 0 models in a clean repro, even though those providers have live catalogs available.

This appears to be narrower than the earlier duplicate-row report: the duplicate-row behavior looks addressed on main, but the live count mismatch still reproduces.

Root Cause

On latest main, the CLI /model picker still shows OpenAI and OpenAI Direct with 0 models in a clean repro, even though those providers have live catalogs available.

This appears to be narrower than the earlier duplicate-row report: the duplicate-row behavior looks addressed on main, but the live count mismatch still reproduces.

Fix Action

Fixed

PR fix notes

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

Description (problem / solution / changelog)

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: https://github.com/NousResearch/hermes-agent/issues/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=

## Changed files

- `hermes_cli/model_switch.py` (modified, +9/-0)
- `hermes_cli/models.py` (modified, +23/-0)
- `tests/hermes_cli/test_user_providers_model_switch.py` (modified, +52/-0)

Code Example

from hermes_cli.env_loader import load_hermes_dotenv
load_hermes_dotenv()
from hermes_cli.config import load_config, get_compatible_custom_providers
from hermes_cli.model_switch import list_authenticated_providers

cfg = load_config()
providers = cfg.get('providers', {}) if isinstance(cfg, dict) else {}
custom = get_compatible_custom_providers(cfg)
rows = list_authenticated_providers(
    current_provider=(cfg.get('model', {}) or {}).get('provider', ''),
    user_providers=providers,
    custom_providers=custom,
)
for r in rows:
    print(r['name'], r['slug'], r['total_models'], r.get('source', ''))

---

Ollama         ollama-launch   0   user-config
OpenRouter     openrouter      33  built-in
GitHub Copilot copilot         14  built-in
Anthropic      anthropic       8   built-in
OpenAI         openai          0   built-in
OpenAI Direct  openai-direct   0   user-config
RAW_BUFFERClick to expand / collapse

Summary

On latest main, the CLI /model picker still shows OpenAI and OpenAI Direct with 0 models in a clean repro, even though those providers have live catalogs available.

This appears to be narrower than the earlier duplicate-row report: the duplicate-row behavior looks addressed on main, but the live count mismatch still reproduces.

Repro environment

  • Repo: NousResearch/hermes-agent
  • Commit: ce089169
  • Context: clean worktree at origin/main
  • Config loaded from the user's normal Hermes config/env

Steps to reproduce

  1. Check out latest main
  2. Load normal Hermes env/config
  3. Call list_authenticated_providers() using the current config and compatibility-expanded custom_providers

Repro script:

from hermes_cli.env_loader import load_hermes_dotenv
load_hermes_dotenv()
from hermes_cli.config import load_config, get_compatible_custom_providers
from hermes_cli.model_switch import list_authenticated_providers

cfg = load_config()
providers = cfg.get('providers', {}) if isinstance(cfg, dict) else {}
custom = get_compatible_custom_providers(cfg)
rows = list_authenticated_providers(
    current_provider=(cfg.get('model', {}) or {}).get('provider', ''),
    user_providers=providers,
    custom_providers=custom,
)
for r in rows:
    print(r['name'], r['slug'], r['total_models'], r.get('source', ''))

Actual output

Ollama         ollama-launch   0   user-config
OpenRouter     openrouter      33  built-in
GitHub Copilot copilot         14  built-in
Anthropic      anthropic       8   built-in
OpenAI         openai          0   built-in
OpenAI Direct  openai-direct   0   user-config

Expected behavior

OpenAI and OpenAI Direct should not show 0 when live catalogs are available for those providers.

At minimum, the picker should surface a nonzero count consistent with the provider's available models, rather than a misleading zero.

Notes

  • This issue is intentionally scoped only to the live OpenAI/OpenAI Direct count mismatch on latest main.
  • It is separate from the earlier duplicate-row investigation/PR (#13190), which was closed as partially redundant.
  • In earlier local testing on a fix branch, probing live catalogs for openai / openai-direct resolved the zero-count symptom.

extent analysis

TL;DR

The issue can be resolved by ensuring that the live catalogs for OpenAI and OpenAI Direct providers are properly queried and their model counts are accurately reflected in the CLI /model picker.

Guidance

  • Verify that the list_authenticated_providers function is correctly calling the API endpoints for OpenAI and OpenAI Direct to fetch their live model catalogs.
  • Check the implementation of get_compatible_custom_providers to ensure it is correctly handling the custom providers, including OpenAI and OpenAI Direct.
  • Review the logic for calculating the total_models count in the list_authenticated_providers function to ensure it is not defaulting to 0 when the live catalog is available.
  • Test the repro script with additional logging or debugging statements to understand why the live catalogs for OpenAI and OpenAI Direct are not being properly queried.

Example

No code example is provided as the issue is more related to the logic and implementation of the functions rather than a specific code snippet.

Notes

The issue seems to be specific to the live OpenAI and OpenAI Direct count mismatch, and the provided repro script and environment should help in debugging and resolving the issue.

Recommendation

Apply a workaround by modifying the list_authenticated_providers function to handle the live catalogs for OpenAI and OpenAI Direct providers correctly, until a more permanent fix can be implemented.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

OpenAI and OpenAI Direct should not show 0 when live catalogs are available for those providers.

At minimum, the picker should surface a nonzero count consistent with the provider's available models, rather than a misleading zero.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING