Skip to content

fix(models): /model fails for Alibaba/DashScope coding endpoint — /models returns 404 #12272

@yolopsx

Description

@yolopsx

Problem

/model Qwen (or any Alibaba model) fails with:

Error: Could not reach the Alibaba Cloud (DashScope) API to validate `qwen3.6-plus`. If the service isn't down, this model may not be valid.

Root Cause

The validate_requested_model() function in `hermes_cli/models.py` probes the provider's `/models` endpoint to verify model existence. However, DashScope's coding endpoint (`https://coding.dashscope.aliyuncs.com/v1\`) does not support the `/models` endpoint — it returns HTTP 404.

This means:

  1. `fetch_api_models()` returns `None` (can't reach API)
  2. Code falls through to line 2195-2202 which returns `{"accepted": False}`
  3. The model switch is hard-rejected

When This Broke

  • Before commit `aeb53131f` (Apr 13, 2026), the "couldn't reach API" fallback returned `{"accepted": True, "persist": True}` with a warning — so model switching worked.
  • Commit `aeb53131f` changed it to `{"accepted": False}` to prevent "fake models", but this broke providers that don't expose `/models` (DashScope coding endpoint being the main one).

Affected Users

Any user who:

  1. Has an Alibaba/DashScope coding plan account
  2. Sets `providers.alibaba.base_url` to `https://coding.dashscope.aliyuncs.com/v1\`
  3. Tries to switch models via `/model`

The classic endpoint (`dashscope.aliyuncs.com/compatible-mode/v1`) does support `/models` but requires a different API key.

Suggested Fix

Add provider-specific handling for `alibaba` in `validate_requested_model()` before the generic "couldn't reach" fallback, similar to how `bedrock` and `openai-codex` already have their own validation paths.

# DashScope coding endpoint does not expose /models (returns 404).
# Fall back to models.dev catalog for alibaba provider.
if normalized == "alibaba":
    known = provider_model_ids("alibaba")
    if requested in known:
        return {"accepted": True, "persist": True, "recognized": True}
    return {"accepted": True, "persist": True, "recognized": False, "message": "..."}

Reproduction

  1. Set in config.yaml:
    ```yaml
    providers:
    alibaba:
    base_url: https://coding.dashscope.aliyuncs.com/v1
    ```
  2. Restart gateway
  3. Send `/model Qwen`
  4. Observe error instead of successful switch

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/cliCLI entry point, hermes_cli/, setup wizardprovider/qwenQwen / Alibaba Cloud (OAuth)type/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