OpenCode はターミナルベースの AI コーディングアシスタントです。従量課金プラン、Coding Plan、または Token Plan (Team Edition) を使用して Alibaba Cloud Model Studio に接続できます。
OpenCode のインストール
-
Node.js をバージョン 18.0 以降にインストールまたはアップデートします。
-
ターミナルで次のコマンドを実行して OpenCode をインストールします。
npm install -g opencode-ai次のコマンドを実行してインストールを検証します。コマンドがバージョン番号を返した場合、インストールは成功です。
opencode -v
アクセス認証情報の設定
次の設定ファイルをテキストエディターで開きます。ディレクトリまたはファイルが存在しない場合は作成してください。
-
macOS / Linux:
~/.config/opencode/opencode.json -
Windows:
C:\Users\<Your-Username>\.config\opencode\opencode.json
課金方法を選択し、対応する構成をファイルに追加します。
-
Token Plan (Team Edition):シートベースのサブスクリプションで、トークンの消費はクレジットから差し引かれます。
-
Coding Plan:モデルの呼び出し回数に応じて課金される、月額固定料金のサブスクリプションです。
-
従量課金:実際の使用量に基づく後払い方式です。
Token Plan (Team Edition)
アクティブな Token Plan (Team Edition) のサブスクリプションが必要です。Token Plan (Team Edition) のページで購入できます。
YOUR_API_KEY を、ご利用の Token Plan (Team Edition) 専用の API キーに置き換えてください。利用可能なモデルのリストについては、「サポートされているモデル」をご参照ください。
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"bailian-token-plan": {
"npm": "@ai-sdk/anthropic",
"name": "Alibaba Cloud Model Studio",
"options": {
"baseURL": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/apps/anthropic/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"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-pro": {
"name": "DeepSeek V4 Pro"
},
"deepseek-v4-flash": {
"name": "DeepSeek V4 Flash"
},
"deepseek-v3.2": {
"name": "DeepSeek V3.2"
},
"kimi-k2.7-code": {
"name": "Kimi K2.7 Code",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"kimi-k2.6": {
"name": "Kimi K2.6",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 8192
}
}
},
"kimi-k2.5": {
"name": "Kimi K2.5",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"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"
}
}
}
}
}
Coding Plan
YOUR_API_KEY を、ご利用の Coding Plan 専用の API キーに置き換えてください。利用可能なモデルのリストについては、「サポートされているモデル」をご参照ください。
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"bailian-coding-plan": {
"npm": "@ai-sdk/anthropic",
"name": "Alibaba Cloud Model Studio",
"options": {
"baseURL": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"qwen3.7-plus": {
"name": "Qwen3.7 Plus",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 1024
}
}
},
"qwen3.6-plus": {
"name": "Qwen3.6 Plus",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 1024
}
}
},
"qwen3.5-plus": {
"name": "Qwen3.5 Plus",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 1024
}
}
},
"qwen3-max-2026-01-23": {
"name": "Qwen3 Max 0123"
},
"qwen3-coder-next": {
"name": "Qwen3 Coder Next"
},
"qwen3-coder-plus": {
"name": "Qwen3 Coder Plus"
},
"MiniMax-M2.5": {
"name": "MiniMax M2.5"
},
"glm-5": {
"name": "GLM-5",
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 1024
}
}
},
"glm-4.7": {
"name": "GLM-4.7"
},
"kimi-k2.5": {
"name": "Kimi K2.5",
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"thinking": {
"type": "enabled",
"budgetTokens": 1024
}
}
}
}
}
}
}
従量課金
YOUR_API_KEY を、ご利用の Alibaba Cloud Model Studio API キーに置き換えてください。利用可能なモデルのリストについては、「Anthropic 互換 API」をご参照ください。
baseURL はリージョン固有です。API キーが選択したリージョンに対応していることを確認してください。
-
中国 (北京):
https://dashscope.aliyuncs.com/apps/anthropic/v1 -
シンガポール:
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic/v1。{WorkspaceId}を、ご利用の ワークスペース ID に置き換えてください。
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"bailian-payg": {
"npm": "@ai-sdk/anthropic",
"name": "Alibaba Cloud Model Studio",
"options": {
"baseURL": "https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"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
}
}
},
"deepseek-v3.2": {
"name": "DeepSeek V3.2"
}
}
}
}
}
他のモデルを追加するには、models オブジェクトに同じフォーマットで追加します。
構成の検証
設定ファイルを保存した後、OpenCode を再起動します。/models と入力し、Alibaba Cloud Model Studio を検索してから、モデルを選択して対話を開始します。
よくある質問
エラーコード
構成中にエラーが発生した場合は、ご利用の課金方法に対応するよくある質問をご参照ください。
-
Coding Plan: Coding Plan よくある質問
-
Token Plan (Team Edition): Token Plan (Team Edition) よくある質問