Skip to content

Commit 2e99d5b

Browse files
roomote[bot]roomotedaniel-lxscte
authored
feat: Add Qwen Code CLI API Support with OAuth Authentication (#7380)
Co-authored-by: Roo Code <[email protected]> Co-authored-by: daniel-lxs <[email protected]> Co-authored-by: cte <[email protected]>
1 parent 3dd3d7b commit 2e99d5b

34 files changed

+503
-48
lines changed

packages/types/npm/package.metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@roo-code/types",
3-
"version": "1.59.0",
3+
"version": "1.60.0",
44
"description": "TypeScript type definitions for Roo Code.",
55
"publishConfig": {
66
"access": "public",

packages/types/src/provider-settings.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
mistralModels,
1919
moonshotModels,
2020
openAiNativeModels,
21+
qwenCodeModels,
2122
rooModels,
2223
sambaNovaModels,
2324
vertexModels,
@@ -48,6 +49,7 @@ export const providerNames = [
4849
"moonshot",
4950
"deepseek",
5051
"doubao",
52+
"qwen-code",
5153
"unbound",
5254
"requesty",
5355
"human-relay",
@@ -311,6 +313,10 @@ const ioIntelligenceSchema = apiModelIdProviderModelSchema.extend({
311313
ioIntelligenceApiKey: z.string().optional(),
312314
})
313315

316+
const qwenCodeSchema = apiModelIdProviderModelSchema.extend({
317+
qwenCodeOauthPath: z.string().optional(),
318+
})
319+
314320
const rooSchema = apiModelIdProviderModelSchema.extend({
315321
// No additional fields needed - uses cloud authentication
316322
})
@@ -352,6 +358,7 @@ export const providerSettingsSchemaDiscriminated = z.discriminatedUnion("apiProv
352358
fireworksSchema.merge(z.object({ apiProvider: z.literal("fireworks") })),
353359
featherlessSchema.merge(z.object({ apiProvider: z.literal("featherless") })),
354360
ioIntelligenceSchema.merge(z.object({ apiProvider: z.literal("io-intelligence") })),
361+
qwenCodeSchema.merge(z.object({ apiProvider: z.literal("qwen-code") })),
355362
rooSchema.merge(z.object({ apiProvider: z.literal("roo") })),
356363
defaultSchema,
357364
])
@@ -390,6 +397,7 @@ export const providerSettingsSchema = z.object({
390397
...fireworksSchema.shape,
391398
...featherlessSchema.shape,
392399
...ioIntelligenceSchema.shape,
400+
...qwenCodeSchema.shape,
393401
...rooSchema.shape,
394402
...codebaseIndexProviderSchema.shape,
395403
})
@@ -506,6 +514,7 @@ export const MODELS_BY_PROVIDER: Record<
506514
label: "OpenAI",
507515
models: Object.keys(openAiNativeModels),
508516
},
517+
"qwen-code": { id: "qwen-code", label: "Qwen Code", models: Object.keys(qwenCodeModels) },
509518
roo: { id: "roo", label: "Roo", models: Object.keys(rooModels) },
510519
sambanova: {
511520
id: "sambanova",

packages/types/src/providers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export * from "./moonshot.js"
1919
export * from "./ollama.js"
2020
export * from "./openai.js"
2121
export * from "./openrouter.js"
22+
export * from "./qwen-code.js"
2223
export * from "./requesty.js"
2324
export * from "./roo.js"
2425
export * from "./sambanova.js"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import type { ModelInfo } from "../model.js"
2+
3+
export type QwenCodeModelId = "qwen3-coder-plus" | "qwen3-coder-flash"
4+
5+
export const qwenCodeDefaultModelId: QwenCodeModelId = "qwen3-coder-plus"
6+
7+
export const qwenCodeModels = {
8+
"qwen3-coder-plus": {
9+
maxTokens: 65_536,
10+
contextWindow: 1_000_000,
11+
supportsImages: false,
12+
supportsPromptCache: false,
13+
inputPrice: 0,
14+
outputPrice: 0,
15+
cacheWritesPrice: 0,
16+
cacheReadsPrice: 0,
17+
description: "Qwen3 Coder Plus - High-performance coding model with 1M context window for large codebases",
18+
},
19+
"qwen3-coder-flash": {
20+
maxTokens: 65_536,
21+
contextWindow: 1_000_000,
22+
supportsImages: false,
23+
supportsPromptCache: false,
24+
inputPrice: 0,
25+
outputPrice: 0,
26+
cacheWritesPrice: 0,
27+
cacheReadsPrice: 0,
28+
description: "Qwen3 Coder Flash - Fast coding model with 1M context window optimized for speed",
29+
},
30+
} as const satisfies Record<QwenCodeModelId, ModelInfo>

pnpm-lock.yaml

Lines changed: 11 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
ChutesHandler,
3131
LiteLLMHandler,
3232
ClaudeCodeHandler,
33+
QwenCodeHandler,
3334
SambaNovaHandler,
3435
IOIntelligenceHandler,
3536
DoubaoHandler,
@@ -108,6 +109,8 @@ export function buildApiHandler(configuration: ProviderSettings): ApiHandler {
108109
return new DeepSeekHandler(options)
109110
case "doubao":
110111
return new DoubaoHandler(options)
112+
case "qwen-code":
113+
return new QwenCodeHandler(options)
111114
case "moonshot":
112115
return new MoonshotHandler(options)
113116
case "vscode-lm":

src/api/providers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export { OllamaHandler } from "./ollama"
2121
export { OpenAiNativeHandler } from "./openai-native"
2222
export { OpenAiHandler } from "./openai"
2323
export { OpenRouterHandler } from "./openrouter"
24+
export { QwenCodeHandler } from "./qwen-code"
2425
export { RequestyHandler } from "./requesty"
2526
export { SambaNovaHandler } from "./sambanova"
2627
export { UnboundHandler } from "./unbound"

0 commit comments

Comments
 (0)