fix(tongyi): remove Bearer prefix from DashScope authorization headers#32
Open
GOODDAYDAY wants to merge 1 commit into
Open
fix(tongyi): remove Bearer prefix from DashScope authorization headers#32GOODDAYDAY wants to merge 1 commit into
GOODDAYDAY wants to merge 1 commit into
Conversation
fix(tongyi): remove Bearer prefix from DashScope authorization headers The Alibaba Bailian (DashScope/Tongyi) API expects the apiKey to be passed directly in the Authorization header without a "Bearer " prefix. This differs from OpenAI-compatible and Doubao (Volcengine ARK) APIs which still require the "Bearer " scheme. All 9 occurrences in TongyiImageService and TongyiVideoService are updated. DoubaoImageService, DoubaoVideoService, and OpenAICompatImageService are intentionally left unchanged. @
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.
Summary
Fix the Alibaba Bailian (DashScope/Tongyi) API authentication by removing the "Bearer " prefix from Authorization headers.
Root Cause
The DashScope API expects the raw apiKey directly in the Authorization header:
Not the Bearer-scheme format used by OpenAI-compatible and Doubao gateways:
TongyiImageServiceandTongyiVideoServicewere incorrectly prependingBearer, causing auth failures.DoubaoImageService,DoubaoVideoService, andOpenAICompatImageServicecorrectly keep theBearerprefix since their gateways require it.Changes
packages/core/src/services/assetImageService.ts— 7 Authorization headers inTongyiImageServiceupdated (sync/async generation, wanx edit, I2I edit, task polling)packages/core/src/services/assetVideoService.ts— 2 Authorization headers inTongyiVideoServiceupdated (submit request + task polling)Scope
Tongyi service classes only. Doubao and OpenAI-compat providers are intentionally unchanged. All changes are in the framework core services layer — no extra scripts or configuration required.