Skip to main content
Clients & tools

OpenCode

Terminal AI coding assistant

OpenCode is a terminal AI coding tool. Connect it to Qwen Cloud via Token Plan (Personal Edition), Token Plan (Team Edition), Coding Plan, or pay-as-you-go billing.

Install OpenCode

  1. Install or update Node.js (v18.0 or later).
  2. Run the following command in the terminal to install OpenCode.
npm install -g opencode-ai
Run the following command to verify the installation. The installation is successful if a version number is displayed.
opencode -v

Configure access credentials

Create and open the configuration file opencode.json at one of the following paths:
  • macOS / Linux: ~/.config/opencode/opencode.json
  • Windows: C:\Users\<Your-Username>\.config\opencode\opencode.json
Add the configuration for your billing plan.

Token Plan (Personal Edition)

You must have an active Token Plan (Personal Edition) subscription. You can purchase one on the Token Plan (Personal Edition) page. Replace YOUR_API_KEY with your dedicated Token Plan (Personal Edition) API Key. For a list of available models, see supported models.
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "bailian-token-plan-personal": {
      "npm": "@ai-sdk/anthropic",
      "name": "Qwen Cloud",
      "options": {
        "baseURL": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "apiKey": "YOUR_API_KEY"
      },
      "models": {
        "qwen3.8-max-preview": {
          "name": "Qwen3.8 Max Preview",
          "contextWindow": 983616,
          "maxOutputTokens": 131072,
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 99072
            },
            "temperature": 0.6,
            "reasoning": true
          }
        },
        "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
            }
          }
        }
      }
    }
  }
}
qwen3.8-max-preview thinking mode:
  • thinking: Always enabled. Cannot be disabled.
  • temperature: Defaults to 0.6 in thinking mode. Values below 0.6 are automatically adjusted to 0.6.
  • reasoning_effort: Controls reasoning depth. Options: xhigh, high, low. Default: xhigh.

Token Plan (Team Edition)

Replace YOUR_API_KEY with the Token Plan (Team Edition) dedicated API Key. For available models, see Token Plan supported models.
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "bailian-token-plan": {
      "npm": "@ai-sdk/anthropic",
      "name": "Qwen Cloud",
      "options": {
        "baseURL": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "apiKey": "YOUR_API_KEY"
      },
      "models": {
        "qwen3.8-max-preview": {
          "name": "Qwen3.8 Max Preview",
          "contextWindow": 983616,
          "maxOutputTokens": 131072,
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 99072
            },
            "temperature": 0.6,
            "reasoning": true
          }
        },
        "qwen3.7-max": {
          "name": "Qwen3.7 Max",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          }
        },
        "qwen3.7-plus": {
          "name": "Qwen3.7 Plus",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          }
        },
        "qwen3.6-plus": {
          "name": "Qwen3.6 Plus",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          }
        },
        "qwen3.6-flash": {
          "name": "Qwen3.6 Flash",
          "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"
        }
      }
    }
  }
}
qwen3.8-max-preview thinking mode:
  • thinking: Always enabled. Cannot be disabled.
  • temperature: Defaults to 0.6 in thinking mode. Values below 0.6 are automatically adjusted to 0.6.
  • reasoning_effort: Controls reasoning depth. Options: xhigh, high, low. Default: xhigh.

Coding Plan

Replace YOUR_API_KEY with the Coding Plan dedicated API Key. For available models, see Coding Plan supported models.
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "bailian-coding-plan": {
      "npm": "@ai-sdk/anthropic",
      "name": "Qwen Cloud",
      "options": {
        "baseURL": "https://coding-intl.dashscope.aliyuncs.com/apps/anthropic/v1",
        "apiKey": "YOUR_API_KEY"
      },
      "models": {
        "qwen3.7-plus": {
          "name": "Qwen3.7 Plus",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 1024
            }
          }
        },
        "qwen3.6-plus": {
          "name": "Qwen3.6 Plus",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 1024
            }
          }
        },
        "qwen3.5-plus": {
          "name": "Qwen3.5 Plus",
          "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",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 1024
            }
          }
        },
        "kimi-k2.5": {
          "name": "Kimi K2.5",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 1024
            }
          }
        }
      }
    }
  }
}

Pay-as-you-go

Replace YOUR_API_KEY with the Qwen Cloud API Key. For available models, see Anthropic compatible API.
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "bailian-payg": {
      "npm": "@ai-sdk/anthropic",
      "name": "Qwen Cloud",
      "options": {
        "baseURL": "https://dashscope-intl.aliyuncs.com/compatible-mode/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",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 1024
            }
          }
        },
        "qwen3.6-plus": {
          "name": "Qwen3.6 Plus",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          }
        },
        "deepseek-v3.2": {
          "name": "DeepSeek V3.2"
        }
      }
    }
  }
}

Verify configuration

After saving the configuration, restart OpenCode, type /models, search for Qwen Cloud, and select the model you want to use.

FAQ

Error codes

If you encounter errors during configuration, refer to the FAQ documentation for your billing plan: