Skip to main content
Use in AI Tools

OpenCode

Use Token Plan with OpenCode

OpenCode is an open-source AI coding tool that runs in the terminal.

Install OpenCode

  1. Install or update Node.js (v18.0+).
  2. Install OpenCode:
npm install -g opencode-ai
Verify the installation:
opencode -v

Set up Token Plan

Create and open opencode.json at one of these paths:
  • macOS or Linux: ~/.config/opencode/opencode.json
  • Windows: C:\Users\<username>\.config\opencode\opencode.json
Add the following:
  • baseURL: https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1. Do not use endpoints from other plans.
  • apiKey: Replace YOUR_API_KEY with your Token Plan API key.
Save the file. Restart OpenCode to apply changes.
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "qwen-cloud-token-plan": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Qwen Cloud Token Plan",
      "options": {
        "baseURL": "https://token-plan.ap-southeast-1.maas.aliyuncs.com/compatible-mode/v1",
        "apiKey": "YOUR_API_KEY"
      },
      "models": {
        "qwen3.6-plus": {
          "name": "Qwen3.6 Plus",
          "modalities": {
            "input": ["text", "image"],
            "output": ["text"]
          },
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          },
          "limit": {
            "context": 1000000,
            "output": 65536
          }
        },
        "MiniMax-M2.5": {
          "name": "MiniMax M2.5",
          "modalities": {
            "input": ["text"],
            "output": ["text"]
          },
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          },
          "limit": {
            "context": 196608,
            "output": 24576
          }
        },
        "glm-5": {
          "name": "GLM-5",
          "modalities": {
            "input": ["text"],
            "output": ["text"]
          },
          "options": {
            "thinking": {
              "type": "enabled",
              "budgetTokens": 8192
            }
          },
          "limit": {
            "context": 202752,
            "output": 16384
          }
        },
        "deepseek-v3.2": {
          "name": "DeepSeek V3.2",
          "modalities": {
            "input": ["text"],
            "output": ["text"]
          },
          "limit": {
            "context": 131072,
            "output": 16384
          }
        }
      }
    }
  }
}
budgetTokens sets the maximum thinking budget. Setting it too low may interrupt reasoning. For MiniMax-M2.5, the sum of budgetTokens and output must be less than or equal to 32,768.

Use OpenCode

Start OpenCode in your terminal:
opencode
Type /models, search for Qwen Cloud Token Plan, and select a model.
Image generation models use a separate API and must be integrated through extension mechanisms. See Integrate multimodal generation models.

FAQ

See FAQ.
OpenCode - Qwen Cloud