Skip to content
Sign Up Free
OpenCode

Kimi K3 API in OpenCode: API Key, Base URL, and Model Setup

Connect Kimi K3 to OpenCode through BetterToken. Set an API Key, Base URL, and the kimi-k3 Model ID with /connect or opencode.json. Includes setup guidance.

This guide is specifically for Kimi K3 in OpenCode. Connect BetterToken as an OpenAI-compatible provider, then enter your BetterToken API Key, the Base URL https://bettertoken.ai/v1, and the Model ID kimi-k3. For Claude Code, use the separate Kimi K3 guide because its setup protocol is different.

Key settings

FieldValue
API KeyBetterToken API Key
Base URLhttps://bettertoken.ai/v1
Modelkimi-k3

Prerequisites

Configure with /connect

Start OpenCode and run:

/connect

Choose Other, enter bettertoken as the provider id, and paste your BetterToken API Key. Then select bettertoken/kimi-k3. Restart OpenCode after saving.

Manual configuration

Open the global file ~/.config/opencode/opencode.json. For one project, you can instead use opencode.json in the project root.

{
"$schema": "https://opencode.ai/config.json",
"model": "bettertoken/kimi-k3",
"provider": {
"bettertoken": {
"npm": "@ai-sdk/openai-compatible",
"name": "BetterToken",
"options": {
"baseURL": "https://bettertoken.ai/v1",
"apiKey": "YOUR_API_KEY"
},
"models": {
"kimi-k3": {
"name": "kimi-k3"
}
}
}
}
}

Replace YOUR_API_KEY. Do not append /chat/completions to baseURL; OpenCode adds the request path itself.

Verify the connection

Open a project in OpenCode, select bettertoken/kimi-k3, and send a short prompt. A normal response confirms the connection. Fully restart OpenCode after editing JSON.

Common errors

ErrorWhat to check
401Run /connect again or check apiKey.
404Use only https://bettertoken.ai/v1 in baseURL.
Model not foundThe top-level model must be bettertoken/kimi-k3, while the key in models is kimi-k3.
Configuration is not appliedCheck whether a project-level opencode.json overrides the global file.

Technical details

Configure the model

Copy the exact Model ID from the model plaza.