OpenCode + Chinese AI Models: Setup Guide for DeepSeek, GLM & Kimi

OpenCode is a terminal-native AI coding assistant — no IDE required. You interact with it entirely through your shell, making it ideal for SSH sessions, headless servers, and developers who live in the terminal.

Chinese AI models from DeepSeek, Zhipu (GLM), and Moonshot (Kimi) are serious contenders for coding tasks at a fraction of the cost of GPT-4o or Claude. This guide covers the full setup.

Why OpenCode for Chinese Models?

OpenCode works with any OpenAI-compatible API. Since AIWave exposes Chinese models through a standard endpoint, the integration is straightforward — set a base URL and API key, then pick your model.

Practical advantages of the terminal-first approach:

  • SSH workflows: AI coding on remote servers without forwarding ports or VS Code Remote
  • Speed: No Electron overhead, responses render directly in terminal
  • Scripting: Pipe file contents, redirect output, chain with other CLI tools
  • Installation

    
    go install github.com/opencode-ai/opencode@latest
    

    Or without Go:

    
    curl -fsSL https://opencode.ai/install | bash
    

    Verify: opencode --version

    Configuration

    Create ~/.config/opencode/config.json:

    
    {
      "provider": "openai",
      "base_url": "https://aiwave.live/v1",
      "api_key": "***",
      "model": "deepseek-chat"
    }
    

    Switch models with flags:

    
    opencode --model deepseek-chat   # Fast, cheap
    opencode --model glm-5            # Stronger reasoning
    opencode --model kimi-k3           # Good balance
    

    Or define multiple in config:

    
    {
      "provider": "openai",
      "base_url": "https://aiwave.live/v1",
      "api_key": "***",
      "models": {
        "fast": "deepseek-chat",
        "reasoning": "glm-5",
        "balanced": "kimi-k3"
      },
      "default_model": "fast"
    }
    

    Then use opencode --model reasoning or opencode --model balanced.

    Model Comparison

    DeepSeek V4 FlashGLM-5Kimi K3
    Input (USD/1M tokens)$0.14$0.20$0.30
    Output (USD/1M tokens)$0.28$0.60$0.90
    Context window1M128K128K
    Coding strengthExcellentVery goodGood
    Terminal latencySub-second1-2s1-3s

    *Prices from AIWave pricing.*

    Cost Estimates

    Terminal sessions use shorter contexts than IDE workflows. Assumptions: 15 prompts per session, 1K input + 500 output tokens per prompt.

    ModelPer QueryPer Session (15 prompts)Monthly (20 sessions)
    DeepSeek V4 Flash$0.00028$0.0042$0.08
    GLM-5$0.00050$0.0075$0.15
    Kimi K3$0.00075$0.0113$0.23
    GPT-4o (reference)$0.00750$0.1125$2.25

    *Formula: (1000/1M x input_price) + (500/1M x output_price) per query, x15 prompts, x20 sessions.*

    A month of daily terminal coding with DeepSeek V4 Flash costs under 10 cents. GPT-4o costs 27x more per session. A $1 credit covers about 238 DeepSeek sessions — roughly a year of daily use.

    Practical Usage

    
    # Code generation
    opencode "Add input validation to parse_config in config.py"
    
    # Analyze logs
    cat error.log | opencode "What caused this error and how to fix it?"
    
    # Code review
    git diff main | opencode "Review this diff for bugs"
    

    Troubleshooting

    Connection refused: Verify base URL ends with /v1 (no trailing slash). Test with curl first:

    
    curl https://aiwave.live/v1/chat/completions \
      -H "Authorization: Bearer ***" \
      -H "Content-Type: application/json" \
      -d '{"model":"deepseek-chat","messages":[{"role":"user","content":"hello"}]}'
    

    Model not found: Names must match exactly — deepseek-chat (not deepseek-v4-flash), glm-5 (not glm-5.1). Check AIWave models page.

    Slow on large files: Truncate to relevant sections before piping. The 1M context window handles a lot, but sending 500K tokens of irrelevant log data wastes time and money.


    OpenCode combined with Chinese models creates an extremely cheap terminal coding workflow. Install in under two minutes, and the $1 free credit on AIWave covers a year of daily DeepSeek V4 Flash sessions.