OpenCode はターミナルベースの AI コーディングアシスタントです。従量課金、Coding Plan、Token Plan Personal Edition、または 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\<ユーザー名>\.config\opencode\opencode.json
課金方法を選択し、対応する設定をファイルに追加します。
- Token Plan Personal Edition: トークン消費量に基づいて個人のクレジットを消費する個人向けサブスクリプションです。
- Token Plan Team Edition: クレジットからトークン消費量が差し引かれる、シートベースのサブスクリプションです。
- Coding Plan: モデルの呼び出し回数に応じて課金される、月額固定料金のサブスクリプションです。
- 従量課金: 実際の使用量に基づく後払い方式です。
Token Plan Personal Edition
有効な Token Plan Personal Edition サブスクリプションが必要です。Token Plan Personal Edition ページで購入できます。
YOUR_API_KEY を、専用の Token Plan Personal Edition のAPI キーに置き換えます。利用可能なモデルのリストについては、「対応モデル」をご参照ください。
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"bailian-token-plan-personal": {
"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.8-max": {
"name": "Qwen3.8 Max",
"reasoning": true,
"limit": {
"context": 983616,
"output": 131072
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"effort": "xhigh"
}
},
"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-flash": {
"name": "Qwen3.6 Flash",
"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
}
}
},
"deepseek-v4.1-flash": {
"name": "DeepSeek V4.1 Flash"
},
"deepseek-v4-pro": {
"name": "DeepSeek V4 Pro"
},
"deepseek-v4-pro-0813": {
"name": "DeepSeek V4 Pro 0813"
},
"deepseek-v4-flash-0731": {
"name": "DeepSeek V4 Flash 0731"
}
}
}
}
}
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.8-max": {
"name": "Qwen3.8 Max",
"reasoning": true,
"limit": {
"context": 983616,
"output": 131072
},
"modalities": {
"input": ["text", "image"],
"output": ["text"]
},
"options": {
"effort": "xhigh"
}
},
"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.1-flash": {
"name": "DeepSeek V4.1 Flash"
},
"deepseek-v4-pro": {
"name": "DeepSeek V4 Pro"
},
"deepseek-v4-pro-0813": {
"name": "DeepSeek V4 Pro 0813"
},
"deepseek-v4-flash": {
"name": "DeepSeek V4 Flash"
},
"deepseek-v4-flash-0731": {
"name": "DeepSeek V4 Flash 0731"
},
"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 はリージョン固有です。URL 内の {WorkspaceId} を、実際のワークスペース IDに置き換えてください。API キーが選択したリージョンに対応していることを確認してください。
- 中国 (北京):
https://{WorkspaceId}.cn-beijing.maas.aliyuncs.com/apps/anthropic/v1 - シンガポール:
https://{WorkspaceId}.ap-southeast-1.maas.aliyuncs.com/apps/anthropic/v1。
{
"$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 を検索して、モデルを選択すると対話を開始できます。
よくある質問
エラーコード
設定中にエラーが発生した場合は、ご利用の課金方法に対応するよくある質問をご参照ください。
- 従量課金: Anthropic互換API - エラーコード
- Coding Plan: Coding Plan よくある質問
- Token Plan Personal Edition: Token Plan Personal Edition よくある質問
- Token Plan Team Edition: Token Plan Team Edition よくある質問