Cline CLI 安裝與 Azure 部署小記
環境:
- macOS 14.5
- Node.js v20.12.0
- Cline CLI 1.0.0
有時候訂閱制的 AI 工具, 像是 Codex / Claude / Gemini 有時候額度不夠, 但是又不想要多訂閱, 保持彈性, 想法上就動到使用 Azure 上的模型來幫忙做事,嘗試幾個工具後, 決定來裝 Cline CLI,把 ChatGPT 5.4 部署上去測試。
Cline 官網
- https://github.com/cline/cline
- 我有用過他的 vscode extension , 但是 extension 有些限制, 所以這次採取 CLI, 之後想要測試他的 Kanban
1. 在 Azure 部署 ChatGPT 5.4
這裡我們直接用 Azure CLI 來建立資源與部署模型,請確保已經使用 az login 登入。
先建立 Cognitive Services Account(假設 Resource Group cline-aoai-eastus2-rg 已經建好):
az cognitiveservices account create -n clineeastus2dbg1 -g cline-aoai-eastus2-rg --location eastus2 --kind OpenAI --sku S0
- 這邊可以置換成 你的 Resource Group / Region 以及資源名稱
接著部署 gpt-5.4 模型,設定容量為 100K TPM,並且將 Deployment name 取為 gpt54-dev:
az cognitiveservices account deployment create \ -g cline-aoai-eastus2-rg \ -n clineeastus2dbg1 \ --deployment-name gpt54-dev \ --model-name gpt-5.4 \ --model-version 2026-03-05 \ --model-format OpenAI \ --sku-name GlobalStandard \ --sku-capacity 100
- 這邊比較重要的是 deployment-name , 因為 cline cli 識認你的 deployment name 不是模型名稱
- sku-capacity 也很重要 這個如果設定太小就會遇到 Error: too many requests
拿好 Endpoint 跟 API Key:
# 取得 Endpoint (我們只需要前面的 Resource 網址,例如 https://clineeastus2dbg1.openai.azure.com/) az cognitiveservices account show -n clineeastus2dbg1 -g cline-aoai-eastus2-rg --query properties.endpoint # 取得 API Key az cognitiveservices account keys list -n clineeastus2dbg1 -g cline-aoai-eastus2-rg --query key1
2. 安裝 Cline CLI
直接用 npm 全域安裝:
npm install -g cline-cli
裝完後測試一下版本:
cline --version
3. 設定 Cline CLI
Cline 實際讀取的設定檔在 ~/.cline/data/settings/providers.json。
我們手動建立或編輯它,讓 Cline 透過 openai-compatible 介接 Azure:
{
"version": 1,
"lastUsedProvider": "openai-compatible",
"providers": {
"openai-compatible": {
"settings": {
"provider": "openai-compatible",
"apiKey": "YOUR_AZURE_OPENAI_API_KEY",
"model": "gpt54-dev",
"baseUrl": "https://clineeastus2dbg1.openai.azure.com/openai/v1/"
},
"tokenSource": "manual"
}
}
}
- 小提醒:
baseUrl後面固定接/openai/v1/ model要填你的 Azure Deployment Name,不是底層模型名稱喔。- api key 請填上自已的 key
設定完後確認一下目錄結構:
ls -al ~/.cline/data/settings/ total 8 drwxr-xr-x 3 user staff 96 Jun 14 15:00 . drwxr-xr-x+ 50 user staff 1600 Jun 14 15:00 .. -rw-r--r-- 1 user staff 200 Jun 14 15:05 providers.json
設定好後,進入互動模式看看:
cline -i
有吐出回應就大功告成啦。
又前進一步 ~ enjoy it



沒有留言:
張貼留言