Skip to content

fix(tongyi): remove Bearer prefix from DashScope authorization headers#32

Open
GOODDAYDAY wants to merge 1 commit into
leigest519:mainfrom
GOODDAYDAY:fix/tongyi-bailian-auth-header
Open

fix(tongyi): remove Bearer prefix from DashScope authorization headers#32
GOODDAYDAY wants to merge 1 commit into
leigest519:mainfrom
GOODDAYDAY:fix/tongyi-bailian-auth-header

Conversation

@GOODDAYDAY
Copy link
Copy Markdown

@GOODDAYDAY GOODDAYDAY commented May 9, 2026

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:

Authorization: <apiKey>

Not the Bearer-scheme format used by OpenAI-compatible and Doubao gateways:

Authorization: Bearer <apiKey>

TongyiImageService and TongyiVideoService were incorrectly prepending Bearer , causing auth failures. DoubaoImageService, DoubaoVideoService, and OpenAICompatImageService correctly keep the Bearer prefix since their gateways require it.

Changes

  • packages/core/src/services/assetImageService.ts — 7 Authorization headers in TongyiImageService updated (sync/async generation, wanx edit, I2I edit, task polling)
  • packages/core/src/services/assetVideoService.ts — 2 Authorization headers in TongyiVideoService updated (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.

@
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.
@
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.

1 participant