Qwen Code 的设置记录及Claude Code利用其终结点

Node 20 以上版本的Windows或者Linux下运行npm install -g @qwen-code/qwen-code 安装qwen code后,运行出现下述问题。

qwen
██╗       ██████╗ ██╗    ██╗███████╗███╗   ██╗
╚██╗     ██╔═══██╗██║    ██║██╔════╝████╗  ██║
 ╚██╗    ██║   ██║██║ █╗ ██║█████╗  ██╔██╗ ██║
 ██╔╝    ██║▄▄ ██║██║███╗██║██╔══╝  ██║╚██╗██║
██╔╝     ╚██████╔╝╚███╔███╔╝███████╗██║ ╚████║
╚═╝       ╚══▀▀═╝  ╚══╝╚══╝ ╚══════╝╚═╝  ╚═══╝


Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. /help for more information.


╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ You are running Qwen Code in your home directory. It is recommended to run in a project-specific directory.                                               │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                           │
│ Get started                                                                                                                                               │
│                                                                                                                                                           │
│ How would you like to authenticate for this project?                                                                                                      │
│                                                                                                                                                           │
│ ● OpenAI                                                                                                                                                  │
│                                                                                                                                                           │
│ (Use Enter to Set Auth)                                                                                                                                   │
│                                                                                                                                                           │
│ Terms of Services and Privacy Notice for Qwen Code                                                                                                        │
│                                                                                                                                                           │
│ https://github.com/QwenLM/Qwen3-Coder/blob/main/README.md                                                                                                 │
│                                                                                                                                                           │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

~                                                no sandbox (see /docs)                                                   qwen3-coder-max (100% context left)

file:///usr/local/lib/node_modules/@qwen-code/qwen-code/bundle/gemini.js:261626
        onSelect(items[activeIndex].value);
                                    ^

TypeError: Cannot read properties of undefined (reading 'value')
    at RadioButtonSelect.use_input_default.isActive (file:///usr/local/lib/node_modules/@qwen-code/qwen-code/bundle/gemini.js:261626:37)
    at file:///usr/local/lib/node_modules/@qwen-code/qwen-code/bundle/gemini.js:225665:11
    at exports3.batchedUpdates (file:///usr/local/lib/node_modules/@qwen-code/qwen-code/bundle/gemini.js:21561:16)
    at EventEmitter.handleData (file:///usr/local/lib/node_modules/@qwen-code/qwen-code/bundle/gemini.js:225664:28)
    at EventEmitter.emit (node:events:536:35)
    at ReadStream.handleReadable (file:///usr/local/lib/node_modules/@qwen-code/qwen-code/bundle/gemini.js:224959:34)
    at ReadStream.emit (node:events:524:28)
    at emitReadable_ (node:internal/streams/readable:834:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

Node.js v20.19.4

看来代码有bug,搜索发现,可以选择跳过OpenAI,然后再运行Qwen
使用 上下箭头键 取消选中 OpenAI 选项 , 然后回车即可。
image

设置 .env

OPENAI_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
OPENAI_API_KEY=sk-ali_bailian_apikey
OPENAI_MODEL=qwen3-coder-plus

也可以在终端设置环境变量。
国内用户获取一般通过阿里云百炼平台获取API KEY,或者一些第三方的。
模型名称参考通义前问模型能力qwen-coder帮助 选择,qwen3-coder-480b-a35b-instruct或qwen3-coder-plus等。

如果是Claude Code,参考Qwen3-Coder: Agentic Coding in the World
PowerShell下可以按如下设置

$ENV:ANTHROPIC_AUTH_TOKEN="sk-ali_bailian_apikey"
$ENV:ANTHROPIC_BASE_URL="https://dashscope.aliyuncs.com/api/v2/apps/claude-code-proxy"

一般来看,
国内用户使用 tongyi.com, 注册https://www.aliyun.com/product/bailian, 通过https://modelscope.cn/models/Qwen/Qwen3-Coder-480B-A35B-Instruct 下载模型,使用https://dashscope.aliyuncs.com/compatible-mode/v1
国际用户使用 qwen.ai, 注册https://modelstudio.console.alibabacloud.com/, 通过https://huggingface.co/Qwen/Qwen3-Coder-480B-A35B-Instruct 下载模型,使用https://dashscope-intl.aliyuncs.com/compatible-mode/v1

image
显示 Input Tokens 畸高,社区也有反馈没使用几次就被扣几十元乃至上百元的问题,目前来看使用应该留意一下费用等问题。

update: 目前可以通过 qwen oauth 方式登录,每天2000次的免费额度。npx @qwen-code/qwen-code@latest https://github.com/QwenLM/qwen-code

查看阿里百炼 qwen3-coder-plus 免费额度使用情况
(笔者就不小心使用完了qwen3-coder-plus的免费额度,但问题没有解决)推荐使用魔塔社区的 https://www.modelscope.cn/models/Qwen/Qwen3-Coder-480B-A35B-Instruct,同样有免费额度。
https://bailian.console.aliyun.com/?tab=model#/model-market/detail/group-qwen3-coder-plus?modelGroup=group-qwen3-coder-plus
image

费用与成本下,查看消费账单
https://billing-cost.console.aliyun.com/finance/month-bill/account
https://billing-cost.console.aliyun.com/finance/expense-report/expense-detail-by-instance?StatisticItem=DEFAULT_CHARGE_ITEM&StatisticCycle=MONTHLY

posted @ 2025-07-23 14:20  geyee  阅读(946)  评论(0)    收藏  举报