Skip to content

Fix Alibaba/DashScope: preserve model dots (qwen3.5-plus) and fix 401 auth (Fixes #1739)#1748

Closed
crazywriter1 wants to merge 4 commits into
NousResearch:mainfrom
crazywriter1:fix/1739-alibaba-model-dots
Closed

Fix Alibaba/DashScope: preserve model dots (qwen3.5-plus) and fix 401 auth (Fixes #1739)#1748
crazywriter1 wants to merge 4 commits into
NousResearch:mainfrom
crazywriter1:fix/1739-alibaba-model-dots

Conversation

@crazywriter1

Copy link
Copy Markdown
Contributor

Fixes #1739

1. Model name (dots)
When using Alibaba (DashScope) with an anthropic-compatible endpoint (e.g. coding plan), model names like qwen3.5-plus were being normalized to qwen3-5-plus. Alibaba's API expects the dot. As the issue author noted: "hermes replaces dots in the modelname with dashes. qwen3.5-plus -> qwen3-5-plus" we fix that.

2. 401 auth (wrong credential)
When provider is alibaba or base_url contains dashscope/aliyuncs, the agent must use only the resolved API key (DASHSCOPE_API_KEY). If that key was missing/empty, the code fell back to resolve_anthropic_token() (ANTHROPIC_TOKEN), so an Anthropic token was sent to Alibaba's endpoint → 401. We now never fall back to Anthropic token for Alibaba/DashScope; credential refresh also skips for that case.

Changes:

  • anthropic_adapter: normalize_model_name(model, preserve_dots=False) and build_anthropic_kwargs(..., preserve_dots=False) so model names keep dots when preserve_dots=True.
  • run_agent: When provider is alibaba or base_url contains dashscope/aliyuncs: pass preserve_dots=True into anthropic kwargs; for auth, use only the passed api_key (no resolve_anthropic_token() fallback); skip Anthropic credential refresh.
  • tests: test_preserve_dots_for_alibaba_dashscope in test_anthropic_adapter.py.

Testing: pytest tests/test_anthropic_adapter.py tests/test_run_agent.py all passed. Native Anthropic and other providers unchanged (only alibaba/dashscope path is special-cased).

crazywriter1 and others added 4 commits March 17, 2026 15:17
…ixes NousResearch#1739)

When provider is alibaba or base_url contains dashscope/aliyuncs, do not
convert dots to hyphens in model names. Anthropic API uses hyphens
(claude-opus-4-6) but Alibaba coding plan expects dots (qwen3.5-plus).

Made-with: Cursor
…ixes NousResearch#1739)

When provider is alibaba or base_url contains dashscope/aliyuncs, use only
the resolved api_key (DASHSCOPE_API_KEY). Do not fall back to
resolve_anthropic_token() and skip Anthropic credential refresh so
Anthropic token is never sent to Alibaba endpoint.

Made-with: Cursor
teknium1 pushed a commit that referenced this pull request Mar 21, 2026
…1 auth

When using Alibaba (DashScope) with an anthropic-compatible endpoint,
model names like qwen3.5-plus were being normalized to qwen3-5-plus.
Alibaba's API expects the dot. Added preserve_dots parameter to
normalize_model_name() and build_anthropic_kwargs().

Also fixed 401 auth: when provider is alibaba or base_url contains
dashscope/aliyuncs, use only the resolved API key (DASHSCOPE_API_KEY).
Never fall back to resolve_anthropic_token(), and skip Anthropic
credential refresh for DashScope endpoints.

Cherry-picked from PR #1748 by crazywriter1. Fixes #1739.
teknium1 added a commit that referenced this pull request Mar 21, 2026
…rovider check (salvage #1748 + fix #2314)

fix: Alibaba/DashScope: preserve model dots, fix 401 auth, fix dead provider check (salvage #1748 + fix #2314)
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #2332. Your substantive commits were cherry-picked onto current main with authorship preserved. Thanks for the fix @crazywriter1! Both the dot-preservation and the 401 auth issues are now resolved.

Also fixed a related dead-code issue in #2314 (model identity injection was checking for nonexistent provider names).

@teknium1 teknium1 closed this Mar 21, 2026
outsourc-e pushed a commit to outsourc-e/hermes-agent that referenced this pull request Mar 26, 2026
…1 auth

When using Alibaba (DashScope) with an anthropic-compatible endpoint,
model names like qwen3.5-plus were being normalized to qwen3-5-plus.
Alibaba's API expects the dot. Added preserve_dots parameter to
normalize_model_name() and build_anthropic_kwargs().

Also fixed 401 auth: when provider is alibaba or base_url contains
dashscope/aliyuncs, use only the resolved API key (DASHSCOPE_API_KEY).
Never fall back to resolve_anthropic_token(), and skip Anthropic
credential refresh for DashScope endpoints.

Cherry-picked from PR NousResearch#1748 by crazywriter1. Fixes NousResearch#1739.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…1 auth

When using Alibaba (DashScope) with an anthropic-compatible endpoint,
model names like qwen3.5-plus were being normalized to qwen3-5-plus.
Alibaba's API expects the dot. Added preserve_dots parameter to
normalize_model_name() and build_anthropic_kwargs().

Also fixed 401 auth: when provider is alibaba or base_url contains
dashscope/aliyuncs, use only the resolved API key (DASHSCOPE_API_KEY).
Never fall back to resolve_anthropic_token(), and skip Anthropic
credential refresh for DashScope endpoints.

Cherry-picked from PR NousResearch#1748 by crazywriter1. Fixes NousResearch#1739.
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
…rovider check (salvage NousResearch#1748 + fix NousResearch#2314)

fix: Alibaba/DashScope: preserve model dots, fix 401 auth, fix dead provider check (salvage NousResearch#1748 + fix NousResearch#2314)
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…1 auth

When using Alibaba (DashScope) with an anthropic-compatible endpoint,
model names like qwen3.5-plus were being normalized to qwen3-5-plus.
Alibaba's API expects the dot. Added preserve_dots parameter to
normalize_model_name() and build_anthropic_kwargs().

Also fixed 401 auth: when provider is alibaba or base_url contains
dashscope/aliyuncs, use only the resolved API key (DASHSCOPE_API_KEY).
Never fall back to resolve_anthropic_token(), and skip Anthropic
credential refresh for DashScope endpoints.

Cherry-picked from PR NousResearch#1748 by crazywriter1. Fixes NousResearch#1739.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
…rovider check (salvage NousResearch#1748 + fix NousResearch#2314)

fix: Alibaba/DashScope: preserve model dots, fix 401 auth, fix dead provider check (salvage NousResearch#1748 + fix NousResearch#2314)
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…1 auth

When using Alibaba (DashScope) with an anthropic-compatible endpoint,
model names like qwen3.5-plus were being normalized to qwen3-5-plus.
Alibaba's API expects the dot. Added preserve_dots parameter to
normalize_model_name() and build_anthropic_kwargs().

Also fixed 401 auth: when provider is alibaba or base_url contains
dashscope/aliyuncs, use only the resolved API key (DASHSCOPE_API_KEY).
Never fall back to resolve_anthropic_token(), and skip Anthropic
credential refresh for DashScope endpoints.

Cherry-picked from PR NousResearch#1748 by crazywriter1. Fixes NousResearch#1739.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
…rovider check (salvage NousResearch#1748 + fix NousResearch#2314)

fix: Alibaba/DashScope: preserve model dots, fix 401 auth, fix dead provider check (salvage NousResearch#1748 + fix NousResearch#2314)
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…1 auth

When using Alibaba (DashScope) with an anthropic-compatible endpoint,
model names like qwen3.5-plus were being normalized to qwen3-5-plus.
Alibaba's API expects the dot. Added preserve_dots parameter to
normalize_model_name() and build_anthropic_kwargs().

Also fixed 401 auth: when provider is alibaba or base_url contains
dashscope/aliyuncs, use only the resolved API key (DASHSCOPE_API_KEY).
Never fall back to resolve_anthropic_token(), and skip Anthropic
credential refresh for DashScope endpoints.

Cherry-picked from PR NousResearch#1748 by crazywriter1. Fixes NousResearch#1739.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…rovider check (salvage NousResearch#1748 + fix NousResearch#2314)

fix: Alibaba/DashScope: preserve model dots, fix 401 auth, fix dead provider check (salvage NousResearch#1748 + fix NousResearch#2314)
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…1 auth

When using Alibaba (DashScope) with an anthropic-compatible endpoint,
model names like qwen3.5-plus were being normalized to qwen3-5-plus.
Alibaba's API expects the dot. Added preserve_dots parameter to
normalize_model_name() and build_anthropic_kwargs().

Also fixed 401 auth: when provider is alibaba or base_url contains
dashscope/aliyuncs, use only the resolved API key (DASHSCOPE_API_KEY).
Never fall back to resolve_anthropic_token(), and skip Anthropic
credential refresh for DashScope endpoints.

Cherry-picked from PR NousResearch#1748 by crazywriter1. Fixes NousResearch#1739.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
…rovider check (salvage NousResearch#1748 + fix NousResearch#2314)

fix: Alibaba/DashScope: preserve model dots, fix 401 auth, fix dead provider check (salvage NousResearch#1748 + fix NousResearch#2314)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Can't use alibaba codingplan w,th hermes agent

2 participants