中文

Guides

Use DeepSeek, Qwen, Kimi, GLM in OpenCode: config guide

Answer

OpenCode ships 75+ built-in providers including DeepSeek: run /connect in the TUI (key stored in ~/.local/share/opencode/auth.json) or set the provider's env var (e.g. DEEPSEEK_API_KEY). Any other OpenAI-compatible API goes in the provider block of opencode.json with npm @ai-sdk/openai-compatible, options.baseURL, options.apiKey as {env:VAR} (or /connect first) and a models map. Live-tested: DeepSeek (OpenCode 1.19.3, text calls pass). Other providers are not live-tested and are marked “to be verified”. (source · verified)

Reference price via DeepSeek: DeepSeek V4.1 Flash: blended $0.523 per 1M tokens (official China site). (source · verified)

OpenCode ships 75+ built-in providers including DeepSeek: run /connect in the TUI (key stored in ~/.local/share/opencode/auth.json) or set the provider's env var (e.g. DEEPSEEK_API_KEY). Any other OpenAI-compatible API goes in the provider block of opencode.json with npm @ai-sdk/openai-compatible, options.baseURL, options.apiKey as {env:VAR} (or /connect first) and a models map. Official docs

DeepSeek

opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "deepseek": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "DeepSeek",
      "options": {
        "baseURL": "https://api.deepseek.com",
        "apiKey": "{env:DEEPSEEK_API_KEY}"
      },
      "models": {
        "deepseek-flash": {
          "name": "deepseek-flash"
        }
      }
    }
  }
}

Text call passes Tested 2026-10-17 with OpenCode 1.19.3: one text request OK (tool calls not tested).

Official OpenCode setup for DeepSeek

Provider docs · Pricing

Alibaba Qwen (Model Studio)

No officially documented setup for this tool yet.

Pay-as-you-go uses a Bailian API key (sk-…); Coding Plan uses https://coding.dashscope.aliyuncs.com/apps/anthropic

Provider docs · Pricing

Moonshot AI (Kimi)

opencode.json To be verified: assembled from documented generic fields, not run

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "moonshot": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Moonshot AI (Kimi)",
      "options": {
        "baseURL": "https://api.moonshot.cn/v1",
        "apiKey": "{env:MOONSHOT_API_KEY}"
      },
      "models": {
        "kimi-k3": {
          "name": "kimi-k3"
        }
      }
    }
  }
}

Kimi also offers an Anthropic-compatible Messages API (URL not on this page; unverified)

Provider docs · Pricing

Zhipu GLM (Z.ai)

No officially documented setup for this tool yet.

Official route: run Coding Tool Helper; for GLM-5.2 1M context add the env above to ~/.claude/settings.json

Provider docs · Pricing

Field names come from the linked official docs; replace placeholders with your key. Examples marked “to be verified” combine the tool’s documented fields with the provider’s OpenAI-compatible endpoint and were not run.