hermes - ✅(Solved) Fix [BUG] Model switching fails when using Alibaba Coding Plan custom provider - auto-resolution ignores user config [2 pull requests, 1 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#14940Fetched 2026-04-24 10:44:09
View on GitHub
Comments
1
Participants
2
Timeline
10
Reactions
0
Author
Participants
Timeline (top)
labeled ×4cross-referenced ×2referenced ×2closed ×1

Error Message

⚠️ API call failed (attempt 1/3): AuthenticationError [HTTP 401] 🔌 Provider: custom Model: kimi-k2.5 🌐 Endpoint: https://coding-intl.dashscope.aliyuncs.com/v1 📝 Error: HTTP 401: invalid access token or token expired

Fix Action

Fixed

PR fix notes

PR #14961: fix(providers): register alibaba-coding-plan as a first-class provider

Description (problem / solution / changelog)

Problem

The alibaba-coding-plan provider (coding-intl.dashscope.aliyuncs.com/v1) was not registered in providers.py or auth.py. When users set provider: alibaba_coding or provider: alibaba-coding-plan in config.yaml, Hermes could not resolve credentials and fell back to OpenRouter (HTTP 402) or rejected with HTTP 401.

Fix

  • providers.py: add HermesOverlay for alibaba-coding-plan + aliases (alibaba_coding, alibaba-coding, alibaba_coding_plan)
  • auth.py: add ProviderConfig with correct endpoint (coding-intl.dashscope.aliyuncs.com/v1) and env vars (ALIBABA_CODING_PLAN_API_KEY, DASHSCOPE_API_KEY)

Fixes #14940

Changed files

  • hermes_cli/auth.py (modified, +8/-0)
  • hermes_cli/providers.py (modified, +7/-0)

PR #15045: fix(providers): register alibaba-coding-plan as a first-class provider (salvage #14961)

Description (problem / solution / changelog)

Salvage of #14961 by @ygd58 onto current main, with a follow-up fix.

Closes #14940.

What this PR does

Registers alibaba-coding-plan (endpoint coding-intl.dashscope.aliyuncs.com/v1) as a first-class provider so users can set provider: alibaba_coding in config.yaml without falling through to OpenRouter.

Changes

  • @ygd58 (#14961): adds ProviderConfig in hermes_cli/auth.py, HermesOverlay in hermes_cli/providers.py, three aliases (alibaba_coding, alibaba-coding, alibaba_coding_plan).
  • Follow-up: mirrors the three aliases into auth.py::resolve_provider()::_PROVIDER_ALIASES. Without this, the issue's exact repro (provider: alibaba_coding) still raised Unknown provider because resolve_provider has its own alias table separate from providers.py::ALIASES.

Validation

BeforeAfter
resolve_provider('alibaba_coding')AuthError: Unknown provider'alibaba-coding-plan'
resolve_provider('alibaba-coding-plan')AuthError: Unknown provider'alibaba-coding-plan'
PROVIDER_REGISTRY endpointmissingcoding-intl.dashscope.aliyuncs.com/v1

tests/hermes_cli/test_runtime_provider_resolution.py, test_api_key_providers.py, test_auth_provider_gate.py — 215/215 pass.

Co-authored-by: @ygd58

Changed files

  • hermes_cli/auth.py (modified, +10/-0)
  • hermes_cli/providers.py (modified, +7/-0)

Code Example

model:
  default: kimi-k2.5
  provider: alibaba_coding
  api_key: sk-sp-***(your actual API key)

---

ALIBABA_CODING_PLAN_API_KEY=sk-sp-***(your actual API key)

---

⚠️ API call failed (attempt 1/3): AuthenticationError [HTTP 401]
🔌 Provider: custom  Model: kimi-k2.5
🌐 Endpoint: https://coding-intl.dashscope.aliyuncs.com/v1
📝 Error: HTTP 401: invalid access token or token expired

---

⚠️ API call failed: HTTP 402
🔌 Provider: custom  Model: kimi-k2.5
🌐 Endpoint: https://openrouter.ai/api/v1
RAW_BUFFERClick to expand / collapse

Problem Description

Model switching fails when using Alibaba Cloud Dashscope Coding Plan models. The default model works perfectly, but switching to any other model via /model <model-name> results in authentication errors (401) or fallback to incorrect providers (OpenRouter).

Hermes Agent Version

Latest version as of April 24, 2026

Operating System

Windows with WSL2 (Ubuntu)

Steps to Reproduce

  1. Configure config.yaml with an Alibaba Coding Plan model as default:
model:
  default: kimi-k2.5
  provider: alibaba_coding
  api_key: sk-sp-***(your actual API key)
  1. The default model works correctly
  2. Attempt to switch to another model: /model MiniMax-M2.5
  3. Error occurs - Hermes auto-resolves to alibaba-coding-plan provider but fails

Expected Behavior

Switching models should use the same provider configuration as the default model, or respect the user-defined provider settings in config.yaml.

Actual Behavior

Hermes ignores the provider field in config.yaml for models and uses auto-resolution from models_dev_cache.json, which causes authentication failures.

Additional Relevant Information

.env configuration:

ALIBABA_CODING_PLAN_API_KEY=sk-sp-***(your actual API key)

Providers in models_dev_cache.json:

  • alibaba - endpoint: dashscope-intl.aliyuncs.com/compatible-mode/v1 (standard)
  • alibaba-coding-plan - endpoint: coding-intl.dashscope.aliyuncs.com/v1 (coding plan)

Model distribution:

  • Models like kimi-k2.5, MiniMax-M2.5, glm-5 are in alibaba-coding-plan
  • Model qwen3-coder-plus is in alibaba (standard)

Observed Errors

⚠️ API call failed (attempt 1/3): AuthenticationError [HTTP 401]
🔌 Provider: custom  Model: kimi-k2.5
🌐 Endpoint: https://coding-intl.dashscope.aliyuncs.com/v1
📝 Error: HTTP 401: invalid access token or token expired

When using provider: alibaba-coding-plan:

⚠️ API call failed: HTTP 402
🔌 Provider: custom  Model: kimi-k2.5
🌐 Endpoint: https://openrouter.ai/api/v1

Configurations Attempted (all failed)

  1. provider: alibaba_coding - default works, switching fails
  2. provider: alibaba-coding-plan - Hermes ignores and falls back to OpenRouter
  3. provider: custom with base_url - endpoint correct but API key rejected
  4. Using aliases with leo- prefix - "model not supported"
  5. Modifying models_dev_cache.json - no effect

Hypothesis

Hermes has a provider auto-resolution system (step 4 in the precedence order) that overrides user configuration. When switching models, Hermes:

  1. Looks up the model in models_dev_cache.json
  2. Finds the model belongs to alibaba-coding-plan
  3. Ignores user-defined provider in config.yaml
  4. Uses wrong provider or fails to read environment variables correctly

extent analysis

TL;DR

The most likely fix is to ensure Hermes respects the user-defined provider settings in config.yaml when switching models, potentially by adjusting the provider auto-resolution logic.

Guidance

  • Verify that the ALIBABA_CODING_PLAN_API_KEY environment variable is correctly set and accessible to Hermes.
  • Check the models_dev_cache.json file to ensure the model and provider mappings are correct and consistent with the config.yaml settings.
  • Attempt to set the provider field in config.yaml to alibaba-coding-plan and verify if this resolves the authentication issues when switching models.
  • Consider modifying the Hermes code to prioritize user-defined provider settings over auto-resolution when switching models.

Example

No code snippet is provided as the issue seems to be related to configuration and provider resolution rather than a specific code error.

Notes

The issue appears to be related to the provider auto-resolution system in Hermes, which overrides user configuration when switching models. The exact solution may require adjustments to the Hermes code or configuration files.

Recommendation

Apply a workaround by setting the provider field in config.yaml to alibaba-coding-plan and ensuring the ALIBABA_CODING_PLAN_API_KEY environment variable is correctly set, as this may help resolve the authentication issues when switching models.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix [BUG] Model switching fails when using Alibaba Coding Plan custom provider - auto-resolution ignores user config [2 pull requests, 1 comments, 2 participants]