在 OpenClaw 快速整合阿里雲 Model Studio 與 Qwen 模型
整合不同的 AI 模型總是很麻煩,特別是當你需要處理多種計費方式和不同地區的 Endpoint 時。如果你正打算在專案中加入 Qwen 或其他在 Alibaba Cloud 上託管的大模型,Model Studio(原名百煉)提供了一個非常彈性的選擇。
Model Studio 讓你能夠存取包含 Qwen 在內的阿里雲原生模型,以及平台上託管的第三方模型。目前支援兩種計費方案:Standard(按量付費)和 Coding Plan(訂閱制)。
- Provider:
modelstudio - Auth:
MODELSTUDIO_API_KEY - API: OpenAI-compatible
標準版(按量付費)
Section titled “標準版(按量付費)”# China endpointopenclaw onboard --auth-choice modelstudio-standard-api-key-cn
# Global/Intl endpointopenclaw onboard --auth-choice modelstudio-standard-api-key編碼版(訂閱制)
Section titled “編碼版(訂閱制)”# China endpointopenclaw onboard --auth-choice modelstudio-api-key-cn
# Global/Intl endpointopenclaw onboard --auth-choice modelstudio-api-key完成 onboard 後,設定一個預設模型:
{ agents: { defaults: { model: { primary: "modelstudio/qwen3.5-plus" }, }, },}方案類型與 Endpoint
Section titled “方案類型與 Endpoint”| 方案 | 地區 | 認證選項 | Endpoint |
|---|---|---|---|
| Standard (pay-as-you-go) | 中國 | modelstudio-standard-api-key-cn | dashscope.aliyuncs.com/compatible-mode/v1 |
| Standard (pay-as-you-go) | 全球 | modelstudio-standard-api-key | dashscope-intl.aliyuncs.com/compatible-mode/v1 |
| Coding Plan (subscription) | 中國 | modelstudio-api-key-cn | coding.dashscope.aliyuncs.com/v1 |
| Coding Plan (subscription) | 全球 | modelstudio-api-key | coding-intl.dashscope.aliyuncs.com/v1 |
這個 Provider 會根據你的認證選擇自動切換 Endpoint。如果你有特殊需求,也可以在配置中透過 baseUrl 來覆蓋預設值。
獲取你的 API Key
Section titled “獲取你的 API Key”- qwen3.5-plus (預設) — Qwen 3.5 Plus
- qwen3-coder-plus, qwen3-coder-next — Qwen 程式碼專用模型
- GLM-5 — 透過阿里雲提供的 GLM 模型
- Kimi K2.5 — 透過阿里雲提供的 Moonshot AI 模型
- MiniMax-M2.7 — 透過阿里雲提供的 MiniMax 模型
部分模型(如 qwen3.5-plus, kimi-k2.5)支援圖片輸入。Context Window 範圍從 200K 到 1M tokens 不等。
環境變數說明
Section titled “環境變數說明”如果你的 Gateway 是以守護進程(daemon,如 launchd/systemd)運行,請確保 MODELSTUDIO_API_KEY 對該程序是可見的(例如設定在 ~/.openclaw/.env 或透過 env.shellEnv 傳入)。
下一步:
想快速完成設定嗎?試試我們的 AI Setup Assistant!
OpenClaw Expert
還是卡住了?
如果這篇文件沒有解決你的情境,直接問 OpenClaw Expert,拿到可執行步驟。