I wanted a quick, repeatable way to try Kimi K3 in the coding agents I already use—without copying a long list of environment variables and JSON settings by hand.
So I made a tiny repository with setup scripts for two tools:
- Claude Code
- OpenCode
The scripts connect the agent to Kimi Code's compatible API, select K3, and configure its 1M-token context window.
What you need
Before starting, you need:
- macOS or Linux with Bash, Zsh, and Python 3
- Claude Code or OpenCode already installed
- A Kimi Code membership with access to K3 and the 1M context window
- An API key from the Kimi Code Console
Kimi Code and the Kimi Open Platform use different keys and endpoints. These scripts expect a Kimi Code key for api.kimi.com.
Set it up
Clone the repository:
git clone https://github.com/andersonpem/kimi-coding-k3-setup-for-ai-harnesses.git
cd kimi-coding-k3-setup-for-ai-harnesses
Then review and run the script for your agent:
# Claude Code
less scripts/claude.sh
./scripts/claude.sh
# Or OpenCode
less scripts/opencode.sh
./scripts/opencode.sh
The API-key prompt does not echo your input. After setup, reload Zsh:
source ~/.zshrc
For Claude Code, start claude and use /status to confirm that the base URL is https://api.kimi.com/coding/.
For OpenCode, validate the model and start it with:
opencode models
opencode --model kimi-code/k3
What the scripts actually change
The Claude Code script preserves unrelated settings, removes provider variables that would conflict with Kimi, and creates a small managed block in .zshrc. The API key is stored in ~/.config/kimi-claude/env.zsh with 600 permissions.
The OpenCode script writes a complete ~/.config/opencode/opencode.jsonc and exports the key from .zshrc. If you already have a customized OpenCode configuration, merge the Kimi provider manually instead of treating the generated file as your final config.
Existing configuration files are backed up with timestamped names before replacement. Still, the scripts are intentionally short enough to read before running—which is always a good habit for anything that touches your shell configuration or credentials.
Why this exists
There is no framework or installer magic here. It is just a pair of auditable shell scripts that make the setup repeatable and document the required configuration in one place.
The project is open source under the MIT license. You can find it on GitHub:
andersonpem
/
kimi-coding-k3-setup-for-ai-harnesses
A set of setup scripts for using Kimi K3 Coding on Claude Code, Opencode, and others
Kimi K3 setup for AI coding agents
Small, auditable setup scripts for using Kimi K3 with Claude Code or OpenCode.
The scripts configure the Kimi Code API, select the k3 model, enable its 1M-token context window, and prompt for the API key without echoing it to the terminal.
Important
These scripts modify files in your home directory and back up configuration files as described below. Review the script you intend to run before executing it.
Supported agents
Agent
Script
Protocol
Model
Claude Code
scripts/claude.sh
Anthropic-compatible
k3[1m]
OpenCode
scripts/opencode.sh
OpenAI-compatible
kimi-code/k3
Prerequisites
- macOS or Linux with Bash and Zsh
- Python 3
- The coding agent you want to configure: Claude Code or OpenCode
- An active Kimi Code membership with access to K3 and the 1M context window
- A Kimi Code API key from the Kimi Code Console
Kimi Code keys and Kimi Open Platform keys are not interchangeable. These scripts expect…
If you use another coding agent, contributions for additional setup scripts are welcome.
Top comments (1)
Absolute goated!