在 Kilo CLI 中使用千问AI平台模型
Kilo CLI 是 Kilo Code 的命令行客户端,可以通过按量计费、Token Plan 个人版或 Token Plan 团队版接入千问AI平台。接入 Kilo CLI 需要修改配置文件中的模型提供商。
更多使用技巧及常见命令请参考 Kilo Code 官方文档。
使用 qwen4-max-preview 时,单次输出上限默认 32000,需要更长输出可设置
KILO_EXPERIMENTAL_OUTPUT_TOKEN_MAX;只改 limit.output 不会提高上限。使用 qwen4-max 时,单次输出上限默认 32000,需要更长输出可设置
KILO_EXPERIMENTAL_OUTPUT_TOKEN_MAX;只改 limit.output 不会提高上限。qwen4-max 的上下文长度为 1M Token;非思考模式最大输出 131,072 Token,思考与最终回答合计最大 262,144 Token;默认 reasoning_effort=high,thinking_budget=131072。快速开始
1
安装 Kilo CLI
安装 Node.js(v18.0 或更高版本)。在终端中执行以下命令安装 Kilo CLI:运行以下命令验证安装。若有版本号输出,则表示安装成功。
复制
npm install -g @kilocode/cli
复制
kilo --version
2
打开或新建配置文件
- macOS / Linux:
~/.config/kilo/config.json - Windows:
C:\Users\<用户名>\.config\kilo\config.json
3
写入配置
根据所选方案写入对应配置:
- Token Plan 个人版
- Token Plan 团队版
- 按量计费
需先购买 Token Plan 个人版套餐且套餐处于有效期内。可在 Token Plan 个人版页面购买套餐。将
YOUR_API_KEY 替换为 Token Plan 个人版专属 API Key。可用模型请参考 Token Plan 个人版支持的模型。写入以下配置:复制
{
"$schema": "https://kilo.ai/config.json",
"provider": {
"qianwen-token-plan-personal": {
"npm": "@ai-sdk/anthropic",
"name": "Qianwen AI Platform",
"options": {
"baseURL": "https://token-plan.maas.qianwenaiapi.com/apps/anthropic/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"auto": {
"name": "Auto",
"modalities": {
"input": ["text"],
"output": ["text"]
}
},
"qwen4-max": {
"name": "Qwen4 Max",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
}
},
"qwen4-max-preview": {
"name": "Qwen4 Max Preview",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
}
},
"qwen3.8-max": {
"name": "Qwen3.8 Max",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 262144
}
}
},
"qwen3.8-flash": {
"name": "Qwen3.8 Flash",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 262144
}
}
},
"qwen3.7-max": {
"name": "Qwen3.7 Max",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"qwen3.7-plus": {
"name": "Qwen3.7 Plus",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"qwen3.6-flash": {
"name": "Qwen3.6 Flash",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"glm-5.3": {
"name": "GLM-5.3",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"glm-5.2": {
"name": "GLM-5.2",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash"
},
"deepseek-v4.1-flash-1017": {
"name": "DeepSeek V4.1 Flash 1017"
},
"deepseek-v4-pro": {
"name": "DeepSeek V4 Pro"
},
"deepseek-v4-pro-0813": {
"name": "DeepSeek V4 Pro 0813"
},
"deepseek-v4-flash-0731": {
"name": "DeepSeek V4 Flash 0731"
}
}
}
}
}
需先购买 Token Plan 团队版套餐且套餐处于有效期内。可在 Token Plan 团队版页面购买套餐。将
YOUR_API_KEY 替换为 Token Plan 团队版专属 API Key。可用模型请参考 Token Plan 团队版支持的模型。写入以下配置:复制
{
"$schema": "https://kilo.ai/config.json",
"provider": {
"qianwen-token-plan": {
"npm": "@ai-sdk/anthropic",
"name": "Qianwen AI Platform",
"options": {
"baseURL": "https://token-plan.maas.qianwenaiapi.com/apps/anthropic/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"auto": {
"name": "Auto",
"modalities": {
"input": ["text"],
"output": ["text"]
}
},
"qwen4-max": {
"name": "Qwen4 Max",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
}
},
"qwen4-max-preview": {
"name": "Qwen4 Max Preview",
"modalities": {
"input": [
"text",
"image"
],
"output": [
"text"
]
}
},
"qwen3.8-max": {
"name": "Qwen3.8 Max",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 262144
}
}
},
"qwen3.8-flash": {
"name": "Qwen3.8 Flash",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 262144
}
}
},
"qwen3.7-max": {
"name": "Qwen3.7 Max",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"qwen3.7-plus": {
"name": "Qwen3.7 Plus",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"qwen3.6-plus": {
"name": "Qwen3.6 Plus",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"qwen3.6-flash": {
"name": "Qwen3.6 Flash",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash"
},
"deepseek-v4.1-flash-1017": {
"name": "DeepSeek V4.1 Flash 1017"
},
"deepseek-v4-pro": {
"name": "DeepSeek V4 Pro"
},
"deepseek-v4-pro-0813": {
"name": "DeepSeek V4 Pro 0813"
},
"deepseek-v4-flash-0731": {
"name": "DeepSeek V4 Flash 0731"
},
"kimi-k2.7-code": {
"name": "Kimi K2.7 Code",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"kimi-k2.6": {
"name": "Kimi K2.6",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"kimi-k2.5": {
"name": "Kimi K2.5",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"glm-5.3": {
"name": "GLM-5.3",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"glm-5.2": {
"name": "GLM-5.2",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"glm-5.1": {
"name": "GLM-5.1",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"glm-5": {
"name": "GLM-5",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"MiniMax-M2.5": {
"name": "MiniMax M2.5"
}
}
}
}
}
将 如需添加其他模型,在
YOUR_API_KEY 替换为千问AI平台 API Key。可用模型请参考支持的模型。写入以下配置:复制
{
"$schema": "https://kilo.ai/config.json",
"provider": {
"qianwen": {
"npm": "@ai-sdk/anthropic",
"name": "Qianwen AI Platform",
"options": {
"baseURL": "https://maas.qianwenaiapi.com/apps/anthropic/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"qwen3.8-max": {
"name": "Qwen3.8 Max",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 262144
}
}
},
"qwen3.7-plus": {
"name": "Qwen3.7 Plus",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 1024
}
}
},
"qwen3.8-flash": {
"name": "Qwen3.8 Flash",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 262144
}
}
},
"deepseek-v4-pro-0813": {
"name": "DeepSeek V4 Pro 0813"
},
"deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash"
}
}
}
}
}
models 中以相同格式追加即可。4
验证
保存配置后,重启 Kilo CLI,输入 将
/models,搜索 Qianwen AI Platform,选择需要使用的模型即可开始对话。也可以通过命令行指定 provider 和模型验证:复制
kilo run "你好" -m <provider>/<model>
<provider>/<model> 替换为对应方案的 provider 和模型,例如 qianwen-token-plan/auto。错误码
配置过程中遇到报错,请参考对应计费方案的常见问题文档:- Token Plan:Token Plan 常见问题
- 按量计费:错误码排查
常见问题
模型列表中没有需要的模型
模型列表中没有需要的模型
在
config.json 的 models 中按现有格式追加模型 ID,保存后重新打开 Kilo CLI。支持的模型见对应计费方案的支持列表。调用时返回 401 Unauthorized
调用时返回 401 Unauthorized
API Key 与 Base URL 不匹配,或使用了其他计费方案的 Key。确认 Key 类型与配置中的
baseURL 对应,并重新保存配置。