Skip to content

Fix custom provider model validation when /v1/models endpoint is unavailable#12157

Open
happy5318 wants to merge 1 commit into
NousResearch:mainfrom
happy5318:fix-custom-provider-validation
Open

Fix custom provider model validation when /v1/models endpoint is unavailable#12157
happy5318 wants to merge 1 commit into
NousResearch:mainfrom
happy5318:fix-custom-provider-validation

Conversation

@happy5318

Copy link
Copy Markdown
Contributor

Summary

  • Match custom:* provider format (not just custom)
  • Fallback to config's models list when API endpoint fails

Problem

When using a custom OpenAI-compatible provider whose /v1/models endpoint returns errors (e.g., HTTP 500 or malformed response), Hermes fails to validate and switch to models defined in custom_providers config, even though:

  1. The model IS listed in the config's models field
  2. The chat completions API works perfectly fine
  3. Only the /v1/models endpoint is broken

Solution

  1. Changed the condition from normalized == "custom" to normalized == "custom" or normalized.startswith("custom:") to match all custom provider formats

  2. Added fallback logic: when /v1/models is unavailable, validate against the user-defined models list in custom_providers config

Testing

Tested with a custom provider that has a broken /v1/models endpoint - model switching now works correctly.

Fixes #12153

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic

…ailable

- Match 'custom:*' provider format (not just 'custom')
- Fallback to config's models list when API endpoint fails

Some OpenAI-compatible providers have broken /v1/models endpoints
but fully functional chat APIs. Users who define models in config
should not be blocked by a broken discovery endpoint.

Fixes NousResearch#12153
@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 area/config Config system, migrations, profiles labels Apr 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Related to #12155 (base_url matching for bare custom provider) and #12153 (the issue this fixes).

@vpelikh

vpelikh commented May 6, 2026

Copy link
Copy Markdown

Hey, @alt-glitch. Is there any reason why this MR can't be merged? This bug is preventing me from using hermes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/config Config system, migrations, profiles comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom provider model validation fails when /v1/models endpoint is unavailable

3 participants