OpenCode
Configure OpenCode to use Large Language Models hosted by Kimchi.
This tutorial walks you through using the Kimchi Inference API with OpenCode, an agentic coding tool. You'll configure OpenCode to use different Kimchi-hosted models for planning and for coding, giving you a cost-effective setup for AI-assisted development.
Overview
By the end of this tutorial, you'll be able to:
- Configure OpenCode to recognize Kimchi as a model provider
- Assign a Kimchi-hosted model to planning and deep reasoning tasks
- Assign a Kimchi-hosted model to code generation and execution tasks
- Set up a multi-model workflow that uses different models for different tasks
This tutorial is intended for developers familiar with command-line tools and JSON configuration files.
Prerequisites
- A Kimchi API key from app.kimchi.dev/settings
- OpenCode installed from opencode.ai or via:
curl -fsSL https://opencode.ai/install | bashNew to terminal and config files? Start here.
OpenCode stores its configuration in a JSON file at a specific location on your system. If this is your first time using OpenCode, neither the folder nor the file will exist yet — you need to create both manually.
1. Create the config directory
mkdir -p ~/.config/opencode2. Create the config file
touch ~/.config/opencode/opencode.json3. Open the file for editing
nano ~/.config/opencode/opencode.jsonOr open in VS Code:
open -a "Visual Studio Code" ~/.config/opencode/opencode.json4. Verify the file exists
ls ~/.config/opencodeYou should see opencode.json listed.
Configure OpenCode
Create the OpenCode configuration file
OpenCode needs a configuration file to recognize Kimchi as a provider. Create or edit the config file at ~/.config/opencode/opencode.json. You can find more details in the OpenCode documentation.
The following configuration assigns one model to planning and another to code execution:
{
"$schema": "https://opencode.ai/config.json",
"permission": {
"*": "ask"
},
"compaction": {
"auto": true,
"prune": true
},
"model": "kimchi/minimax-m3",
"mode": {
"plan": {
"model": "kimchi/kimi-k3"
},
"build": {
"model": "kimchi/minimax-m3"
}
},
"provider": {
"kimchi": {
"npm": "@ai-sdk/openai-compatible",
"name": "Kimchi",
"options": {
"baseURL": "https://llm.kimchi.dev/openai/v1",
"litellmProxy": true,
"apiKey": "$KIMCHI_API_KEY"
},
"models": {
"kimi-k3": {
"id": "kimi-k3",
"tool_call": true,
"reasoning": false,
"modalities": {
"input": [
"text",
"image",
"video"
],
"output": [
"text"
]
},
"limit": {
"context": 262144,
"output": 262144
}
},
"minimax-m3": {
"name": "minimax-m3",
"tool_call": true,
"reasoning": false,
"limit": {
"context": 196608,
"output": 32768
}
}
}
}
}
}Replace $KIMCHI_API_KEY with your Kimchi API key.
Verify your configuration
Open a terminal, navigate to a project directory, and start OpenCode:
cd ~/your-project
opencodeTry a simple prompt to verify the connection is working:
What security risks can you identify in this project?OpenCode will use the planning model for the analysis and the build model for code review.
Advanced: Multi-agent orchestration with GSD
For more complex workflows, you can use the Get Shit Done (GSD) framework to orchestrate multiple agents with different models assigned to each task type.
Install GSD:
npx gsd-opencodeThen update your opencode.json to include agent-specific model assignments:
{
"$schema": "https://opencode.ai/config.json",
"permission": {
"*": "ask"
},
"compaction": {
"auto": true,
"prune": true
},
"model": "kimchi/minimax-m3",
"mode": {
"plan": {
"model": "kimchi/kimi-k3"
},
"build": {
"model": "kimchi/minimax-m3"
}
},
"provider": {
"kimchi": {
"npm": "@ai-sdk/openai-compatible",
"name": "Kimchi",
"options": {
"baseURL": "https://llm.kimchi.dev/openai/v1",
"litellmProxy": true,
"apiKey": "$KIMCHI_API_KEY"
},
"models": {
"kimi-k3": {
"id": "kimi-k3",
"tool_call": true,
"reasoning": false,
"modalities": {
"input": [
"text",
"image",
"video"
],
"output": [
"text"
]
},
"limit": {
"context": 262144,
"output": 262144
}
},
"minimax-m3": {
"name": "minimax-m3",
"tool_call": true,
"reasoning": false,
"limit": {
"context": 196608,
"output": 32768
}
}
}
}
},
"agent": {
"gsd-planner": {
"model": "kimchi/kimi-k3"
},
"gsd-plan-checker": {
"model": "kimchi/kimi-k3"
},
"gsd-phase-researcher": {
"model": "kimchi/kimi-k3"
},
"gsd-roadmapper": {
"model": "kimchi/kimi-k3"
},
"gsd-project-researcher": {
"model": "kimchi/kimi-k3"
},
"gsd-research-synthesizer": {
"model": "kimchi/kimi-k3"
},
"gsd-codebase-mapper": {
"model": "kimchi/kimi-k3"
},
"gsd-executor": {
"model": "kimchi/minimax-m3"
},
"gsd-debugger": {
"model": "kimchi/minimax-m3"
},
"gsd-verifier": {
"model": "kimchi/kimi-k3"
},
"gsd-integration-checker": {
"model": "kimchi/kimi-k3"
},
"gsd-set-profile": {
"model": "kimchi/kimi-k3"
},
"gsd-settings": {
"model": "kimchi/kimi-k3"
},
"gsd-set-model": {
"model": "kimchi/kimi-k3"
}
}
}This configuration uses the planning model for planning, research, and verification tasks, while the build model handles actual code execution and debugging. You can also configure GSD interactively by running /gsd-settings within OpenCode.
Advanced: GSD 2.0
GSD 2.0 no longer integrates with the OpenCode TUI — it comes bundled with its own TUI via the PI harness.
Run gsd config to generate a basic configuration. Then create the following files:
.gsd/agent/models.json
{
"providers": {
"kimchi": {
"baseUrl": "https://llm.kimchi.dev/openai/v1",
"api": "openai-completions",
"apiKey": "$KIMCHI_API_KEY",
"models": [
{
"id": "kimi-k3",
"name": "Kimi K3",
"reasoning": false,
"input": ["text", "image", "video"],
"contextWindow": 262144,
"maxTokens": 262144,
"cost": { "input": 1, "output": 3.2, "cacheRead": 0, "cacheWrite": 0 }
},
{
"id": "minimax-m3",
"name": "MiniMax M3",
"reasoning": false,
"input": ["text"],
"contextWindow": 196608,
"maxTokens": 32768,
"cost": { "input": 0.51, "output": 2.04, "cacheRead": 0, "cacheWrite": 0 }
}
]
}
}
}.gsd/preferences.md
---
version: 1
models:
research: kimi-k3
planning: kimi-k3
execution: minimax-m3
completion: minimax-m3
auto_supervisor:
model: kimi-k3
soft_timeout_minutes: 20
idle_timeout_minutes: 10
hard_timeout_minutes: 30
token_profile: quality
budget_ceiling: 500.00
budget_enforcement: warn
git:
auto_push: false
merge_strategy: squash
isolation: branch
commit_docs: false
skill_discovery: suggest
notifications:
on_complete: false
on_milestone: true
on_attention: true
auto_visualize: true
---Replace $KIMCHI_API_KEY with your own key.
Advanced: Superpowers
Superpowers is a lightweight skills-based workflow framework. Unlike GSD, it adds no extra processes or config — it's a set of prompt skills that guide your existing agent, with lower token overhead and less setup friction.
Add the plugin to your ~/.config/opencode/opencode.json alongside the existing provider config:
{
"plugin": ["superpowers@git+https://github.com/obra/superpowers.git"]
}Restart OpenCode. Verify by asking: Tell me about your superpowers
Superpowers provides skills for brainstorming, writing plans, test-driven development, parallel subagent dispatch, systematic debugging, and branch completion workflows. Skills trigger automatically based on what you're doing — no slash commands needed.
Next steps
Updated about 1 month ago