Fix Alibaba/DashScope: preserve model dots (qwen3.5-plus) and fix 401 auth (Fixes #1739)#1748
Closed
crazywriter1 wants to merge 4 commits intoNousResearch:mainfrom
Closed
Fix Alibaba/DashScope: preserve model dots (qwen3.5-plus) and fix 401 auth (Fixes #1739)#1748crazywriter1 wants to merge 4 commits intoNousResearch:mainfrom
crazywriter1 wants to merge 4 commits intoNousResearch:mainfrom
Conversation
…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
…ive_key (PR NousResearch#1748 / NousResearch#1739) 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
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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1739
1. Model name (dots)
When using Alibaba (DashScope) with an anthropic-compatible endpoint (e.g. coding plan), model names like
qwen3.5-pluswere being normalized toqwen3-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
provideris alibaba orbase_urlcontains dashscope/aliyuncs, the agent must use only the resolved API key (DASHSCOPE_API_KEY). If that key was missing/empty, the code fell back toresolve_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:
normalize_model_name(model, preserve_dots=False)andbuild_anthropic_kwargs(..., preserve_dots=False)so model names keep dots whenpreserve_dots=True.providerisalibabaor base_url containsdashscope/aliyuncs: passpreserve_dots=Trueinto anthropic kwargs; for auth, use only the passedapi_key(noresolve_anthropic_token()fallback); skip Anthropic credential refresh.test_preserve_dots_for_alibaba_dashscopein test_anthropic_adapter.py.Testing:
pytest tests/test_anthropic_adapter.py tests/test_run_agent.pyall passed. Native Anthropic and other providers unchanged (only alibaba/dashscope path is special-cased).