Skip to content

[Bug]: Telegram model picker does not list models from providers.custom.models dict #11499

@michealmachine

Description

@michealmachine

Bug Description

When Hermes is configured with a custom OpenAI-compatible provider using the newer providers.<name> shape (base_url, model, and models as a dict), the Telegram /model picker does not show the full model list for that provider.

In our case, the picker only surfaced the default model and could also show duplicate provider entries such as custom (0) and custom (1) instead of a single provider with the full model list.

Steps to Reproduce

  1. Configure a custom provider in ~/.hermes/config.yaml using the newer shape:
providers:
  custom:
    base_url: http://example.com/v1
    model: gpt-5.4
    models:
      gpt-5.4: {}
      grok-4.20-beta: {}
      minimax-m2.7: {}
  1. Start the Telegram gateway.
  2. Open the /model picker.
  3. Inspect the provider list and the models shown for custom.

Expected Behavior

  • The picker should show a single custom provider entry.
  • The picker should list all models defined in providers.custom.models.
  • The default model should be included, but not duplicated.

Actual Behavior

  • The picker only showed the default model from model.
  • In some cases it also showed duplicate provider entries such as custom (0) and custom (1).

Affected Component

  • Gateway (Telegram)
  • Configuration (config.yaml, custom providers)
  • CLI/model switch shared provider listing logic

Operating System

Debian 13 (trixie)

Python Version

3.11.x

Hermes Version

Current main as of 2026-04-17

Root Cause Analysis

list_authenticated_providers() in hermes_cli/model_switch.py handled older custom-provider shapes (default_model, list-style models) but did not fully support the newer config shape that uses:

  • base_url
  • model
  • models as a dict keyed by model name

There was also no deduplication between the direct providers.custom view and the compatibility-layer custom_providers view, which could surface duplicate provider rows.

Proposed Fix

Update list_authenticated_providers() to:

  1. accept base_url as the provider API URL source,
  2. accept model as the default model source,
  3. expand models when it is a dict by using its keys as model names,
  4. deduplicate provider slugs so the same provider is not shown twice.

I already have a local patch and regression tests for this and can open a PR linked to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/configConfig system, migrations, profilescomp/cliCLI entry point, hermes_cli/, setup wizardcomp/gatewayGateway runner, session dispatch, deliveryplatform/telegramTelegram bot adaptertype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions