开源OpenAI 兼容Alibaba Qwen
Qwen Code
面向 Qwen 优化的开源智能体,OpenAI 兼容。
Qwen Code 用三个环境变量走 OpenAI 兼容:密钥、base URL、模型名。填好这三个就能指向任意兼容渠道。
配置步骤
- 1
安装 Qwen Code
需要 Node.js 20 及以上,会装上全局命令 qwen。
bashnpm install -g @qwen-code/qwen-code - 2
设置三个变量
填上你的密钥、端点地址和模型 id。Windows 用 setx 并重开终端。
bash / zshexport OPENAI_API_KEY="your-api-key" export OPENAI_BASE_URL="https://api.example.com/v1" export OPENAI_MODEL="your-model-name" - 3
开始使用
在项目目录里运行,即可开始使用该模型。
bashqwen
提示: 支持 DashScope、OpenRouter、ModelScope 以及自建服务器,只要对方提供 OpenAI 兼容端点即可。