Skip to content

feat: implement Qwen provider with AI SDK#11197

Open
daniel-lxs wants to merge 2 commits intomainfrom
feat/implement-qwen-ai-sdk
Open

feat: implement Qwen provider with AI SDK#11197
daniel-lxs wants to merge 2 commits intomainfrom
feat/implement-qwen-ai-sdk

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Feb 4, 2026

Summary

Adds a new Qwen provider (distinct from Qwen Code) using the qwen-ai-provider-v5 package and AI SDK. Uses Alibaba Cloud's DashScope API.

Changes

  • Add QwenHandler using AI SDK with streamText/generateText
  • Add 14 Qwen models with proper configurations
  • Add UI settings component with API key field
  • Add 22 tests for the provider

Models included

  • qwen-max, qwen-max-latest - Most capable model, best for complex reasoning
  • qwen-plus, qwen-plus-latest - Balanced performance and cost (default)
  • qwen-turbo, qwen-turbo-latest - Fastest and most cost-effective
  • qwen2.5-72b/32b/14b/7b-instruct - Open models with strong performance
  • qwen2.5-14b-instruct-1m - Extended 1M context window variant
  • qwen3-235b-a22b - Largest Qwen 3 model with MoE architecture
  • qwen-vl-max, qwen-vl-plus - Vision models supporting images

Testing

  • 22 unit tests covering constructor, getModel, createMessage, completePrompt, and model variants
  • All tests passing
  • TypeScript compilation successful

Closes EXT-712


Important

Implements Qwen provider with AI SDK, adds 14 models, updates UI, and includes comprehensive testing.

  • Behavior:
    • Implements QwenHandler using AI SDK with streamText and generateText functions.
    • Adds 14 Qwen models with specific configurations in qwen.ts.
    • Integrates Qwen provider into UI with API key field in ApiOptions.tsx.
  • Testing:
    • Adds 22 unit tests for QwenHandler in qwen.spec.ts covering constructor, getModel, createMessage, completePrompt, and model variants.
  • Misc:
    • Updates provider-settings.ts and index.ts to include Qwen provider.
    • Adds i18n support for Qwen API key in multiple language files.
    • Updates package.json to include qwen-ai-provider-v5 dependency.

This description was created by Ellipsis for c94b6d1. You can customize this summary. It will automatically update as commits are pushed.

Adds a new Qwen provider (distinct from Qwen Code) using the qwen-ai-provider-v5
package and AI SDK. Uses Alibaba Cloud's DashScope API.

- Add QwenHandler using AI SDK with streamText/generateText
- Add 14 Qwen models (qwen-max, qwen-plus, qwen-turbo, vision models, etc.)
- Add UI settings component with API key field
- Add 22 tests for the provider

Models included:
- qwen-max, qwen-max-latest
- qwen-plus, qwen-plus-latest (default)
- qwen-turbo, qwen-turbo-latest
- qwen2.5-72b/32b/14b/7b-instruct
- qwen2.5-14b-instruct-1m (1M context)
- qwen3-235b-a22b
- qwen-vl-max, qwen-vl-plus (vision)

Closes EXT-712
@daniel-lxs daniel-lxs requested review from cte, jr and mrubens as code owners February 4, 2026 22:06
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Enhancement New feature or request labels Feb 4, 2026
@roomote
Copy link
Contributor

roomote bot commented Feb 4, 2026

Rooviewer Clock   See task on Roo Cloud

Reviewed latest changes adding Qwen translations. Found a duplicate key in the English locale file.

  • Remove unused import QWEN_API_BASE_URL_CHINA in src/api/providers/qwen.ts
  • Remove duplicate key getQwenApiKey in webview-ui/src/i18n/locales/en/settings.json
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Comment on lines +5 to +11
import {
qwenModels,
qwenDefaultModelId,
QWEN_API_BASE_URL,
QWEN_API_BASE_URL_CHINA,
type ModelInfo,
} from "@roo-code/types"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QWEN_API_BASE_URL_CHINA is imported but never used in this file. The handler only uses QWEN_API_BASE_URL as the default when options.qwenBaseUrl is not provided. Consider removing this unused import.

Suggested change
import {
qwenModels,
qwenDefaultModelId,
QWEN_API_BASE_URL,
QWEN_API_BASE_URL_CHINA,
type ModelInfo,
} from "@roo-code/types"
import {
qwenModels,
qwenDefaultModelId,
QWEN_API_BASE_URL,
type ModelInfo,
} from "@roo-code/types"

Fix it with Roo Code or mention @roomote and request a fix.

"getDoubaoApiKey": "Get Doubao API Key",
"qwenApiKey": "Qwen API Key",
"getQwenApiKey": "Get Qwen API Key",
"getQwenApiKey": "Get Qwen API Key",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate key getQwenApiKey - the line above already defines this key. In JSON objects, duplicate keys cause the second value to overwrite the first. This line should be removed.

Suggested change
"getQwenApiKey": "Get Qwen API Key",

Fix it with Roo Code or mention @roomote and request a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant