> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwencloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenCode

> Terminal AI coding assistant

Connect it to QwenCloud via Token Plan (Personal Edition), Token Plan (Team Edition), or pay-as-you-go billing.

## Install OpenCode

1. Install or update [Node.js](https://nodejs.org/en/download/) (v18.0 or later).

2. Run the following command in the terminal to install OpenCode.

```bash
npm install -g opencode-ai
```

Run the following command to verify the installation. The installation is successful if a version number is displayed.

```bash
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](https://home.qwencloud.com/analytics/token-plan/team).

Replace `YOUR_API_KEY` with your dedicated Token Plan (Personal Edition) [API Key](https://home.qwencloud.com/api-keys). For a list of available models, see [supported models](/token-plan/personal/token-plan-personal-overview#supported-models).

```json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "qwencloud-token-plan-personal": {
      "npm": "@ai-sdk/anthropic",
      "name": "QwenCloud",
      "options": {
        "baseURL": "https://token-plan.maas.qwencloudapi.com/apps/anthropic/v1",
        "apiKey": "YOUR_API_KEY"
      },
      "models": {
        "auto": {
          "name": "Auto",
          "modalities": {
            "input": ["text"],
            "output": ["text"]
          }
        },
        "qwen3.8-max": {
          "name": "Qwen3.8 Max",
          "reasoning": true,
          "limit": {
            "context": 983616,
            "output": 131072
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          },
          "options": {
            "effort": "xhigh"
          }
        },
        "qwen3.8-flash": {
          "name": "Qwen3.8 Flash",
          "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
            }
          }
        },
        "glm-5.3": {
          "name": "GLM-5.3",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          }
        },
        "glm-5.2": {
          "name": "GLM-5.2",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          }
        },
        "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"
        },
        "deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash"
        },
        "deepseek-v4.1-flash-1017": {
          "name": "DeepSeek V4.1 Flash 1017"
        }
      }
    }
  }
}
```

<Warning>
  **qwen3.8-max thinking mode**:

  - thinking: Supports both enabled and disabled (hybrid thinking mode).
  - 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, medium, low. Default: xhigh.
</Warning>

### Token Plan (Team Edition)

Replace `YOUR_API_KEY` with the Token Plan (Team Edition) dedicated [API Key](https://home.qwencloud.com/api-keys). For available models, see [Token Plan supported models](/token-plan/team/token-plan-team-overview#supported-models).

```json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "qwencloud-token-plan": {
      "npm": "@ai-sdk/anthropic",
      "name": "QwenCloud",
      "options": {
        "baseURL": "https://token-plan.maas.qwencloudapi.com/apps/anthropic/v1",
        "apiKey": "YOUR_API_KEY"
      },
      "models": {
        "auto": {
          "name": "Auto",
          "modalities": {
            "input": ["text"],
            "output": ["text"]
          }
        },
        "qwen3.8-max": {
          "name": "Qwen3.8 Max",
          "reasoning": true,
          "limit": {
            "context": 983616,
            "output": 131072
          },
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          },
          "options": {
            "effort": "xhigh"
          }
        },
        "qwen3.8-flash": {
          "name": "Qwen3.8 Flash",
          "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",
          "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-pro-0813": {
          "name": "DeepSeek V4 Pro 0813"
        },
        "deepseek-v4-flash-0731": {
          "name": "DeepSeek V4 Flash 0731"
        },
        "deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash"
        },
        "deepseek-v4.1-flash-1017": {
          "name": "DeepSeek V4.1 Flash 1017"
        },
        "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.3": {
          "name": "GLM-5.3",
          "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"
        }
      }
    }
  }
}
```

<Warning>
  **qwen3.8-max thinking mode**:

  - thinking: Supports both enabled and disabled (hybrid thinking mode).
  - 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, medium, low. Default: xhigh.
</Warning>

### Pay-as-you-go

Replace `YOUR_API_KEY` with the [QwenCloud API Key](https://home.qwencloud.com/api-keys). For available models, see [Anthropic compatible API](/api-reference/chat/anthropic).

The following uses the Singapore (ap-southeast-1) endpoint. For another region, replace ap-southeast-1 and use an API key from that region. See [Regions and endpoints](/developer-guides/getting-started/regions).

```json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "qwencloud": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "QwenCloud",
      "options": {
        "baseURL": "https://ap-southeast-1.maas.qwencloudapi.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": 8192
            }
          }
        },
        "qwen3.6-plus": {
          "name": "Qwen3.6 Plus",
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          }
        },
        "deepseek-v4.1-flash": {
          "name": "DeepSeek V4.1 Flash"
        },
        "deepseek-v4.1-flash-1017": {
          "name": "DeepSeek V4.1 Flash 1017"
        }
      }
    }
  }
}
```

## Verify configuration

After saving the configuration, restart OpenCode, type `/models`, search for `QwenCloud`, 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:

- Pay-as-you-go: [Error codes and troubleshooting](/api-reference/preparation/error-messages)
- Token Plan (Personal Edition): [Token Plan (Personal Edition) FAQ](/token-plan/personal/token-plan-personal-faq)
- Token Plan (Team Edition): [Token Plan (Team Edition) FAQ](/token-plan/team/token-plan-team-faq)
