DEV Community

Mattias chaw
Mattias chaw

Posted on • Originally published at aiwave.live

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
Enter fullscreen mode Exit fullscreen mode

Or without Go:

curl -fsSL https://opencode.ai/install | bash
Enter fullscreen mode Exit fullscreen mode

Verify: opencode --version

Configuration

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

{
  "provider": "openai",
  "base_url": "https://aiwave.live/v1",
  "api_key": "YOUR_API_KEY",
  "model": "deepseek-chat"
}
Enter fullscreen mode Exit fullscreen mode

Switch models with flags:

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

Or define multiple in config:

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

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

Model Comparison

Model Input (USD/1M) Output (USD/1M) Context Coding
DeepSeek V4 Flash $0.14 $0.28 1M Excellent
GLM-5 $0.20 $0.60 128K Very good
Kimi K3 $0.30 $0.90 128K Good

Cost Estimates

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

Model Per Query Per Session (15) 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

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"
Enter fullscreen mode Exit fullscreen mode

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 YOUR_API_KEY"   -H "Content-Type: application/json"   -d '{"model":"deepseek-chat","messages":[{"role":"user","content":"hello"}]}'
Enter fullscreen mode Exit fullscreen mode

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.

Sign up | Pricing | Discord

Top comments (0)