feat: add Qwen (Alibaba Cloud DashScope) provider #898
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
Add comprehensive support for Alibaba Cloud's Qwen models via the DashScope native API (
/api/v1), providing full feature parity with other major providers.Capabilities
qwen-image-max,qwen-image-plusArchitecture
text-generationandmultimodal-generationendpoints based on message content (images present → multimodal endpoint)X-DashScope-SSEheader,incremental_outputmode)response_format: {"type": "json_object"}(broad model support) andresponse_format: {"type": "json_schema", ...}(strict schema enforcement for newer models)Files
src/Providers/Qwen/— 14 files (handlers, maps, concerns)config/prism.php,src/PrismManager.php,src/Enums/Provider.phptests/Providers/Qwen/— 9 test files, 52 tests with 176 assertionstests/Fixtures/qwen/— 14 fixture files recorded from real Qwen API responsesdocs/providers/qwen.md+ updates tostructured-output.md,text-generation.md,image-generation.md,introduction.md,ProviderSupport.vueDesign Decisions
Native API over OpenAI-compatible mode: The DashScope native API is more actively maintained by Alibaba Cloud and provides better feature coverage (multimodal, image editing, structured output modes). The OpenAI-compatible mode lacks some features and has different error response formats.
Dynamic multimodal endpoint routing: Rather than requiring users to manually select endpoints, the handlers inspect message content and automatically route to the correct DashScope endpoint. This keeps the user-facing API clean and consistent with other Prism providers.
No audio support: DashScope's TTS (CosyVoice) uses WebSocket and STT (Paraformer) uses async REST with task polling — neither is compatible with Prism's synchronous HTTP interface. This is clearly documented with alternatives.
Test Plan
Made with Cursor