Skip to main content
OpenCode uses opencode.json for model and endpoint configuration. Put this configuration in the global config file so OpenCode uses DUIAPI by default.

1. Open the configuration directory

Press Win + R, enter the following path, and press Enter:
%userprofile%\.config\opencode
If the directory does not exist, create it. If opencode.json does not exist, create and open it.

2. Write opencode.json

Replace <API_KEY> with your API key, such as sk-xxxxxx. Replace model names with the models you use.
{
  "models": {
    "deepseek-v4-pro": {
      "name": "deepseek-v4-pro"
    },
    "glm-5.2": {
      "name": "glm-5.2"
    },
    "qwen3.7-max": {
      "name": "qwen3.7-max"
    }
  },
  "npm": "@ai-sdk/anthropic",
  "options": {
    "apiKey": "<API_KEY>",
    "baseURL": "https://www.duiapi.com/v1",
    "setCacheKey": true
  }
}

3. Test the configuration

opencode