Docs · Guide
CodeBuddy on any model
CodeBuddy is Tencent's AI coding tool: the CodeBuddy Code CLI (codebuddy, cbc) and the CodeBuddy IDE. Both the international edition (codebuddy.ai) and the China one (codebuddy.cn) take custom models. magpie writes your magpie models into that list, so CodeBuddy runs on DeepSeek, GLM, Kimi, Qwen, an OpenAI or Anthropic key, or a ChatGPT or Copilot subscription, and those models need no CodeBuddy sign-in.
CodeBuddy Code is one npm package, @tencent-ai/codebuddy-code, for both editions; the China one is told apart by CODEBUDDY_INTERNET_ENVIRONMENT=internal. Both read custom models from ~/.codebuddy/models.json (or $CODEBUDDY_CONFIG_DIR), and the CodeBuddy IDE reads the same file. So magpie has one row, CodeBuddy, for the CLI and the IDE.
Set up CodeBuddy
- Add a provider in magpieAdd an API key on the Providers page, or sign in to a subscription.
- Pick a model on CodeBuddy's rowOn the Agents page, pick a model under magpie. magpie writes every model into models.json and the one you picked into settings.json's
model. - Start a new sessionCodeBuddy Code reads its model when a session starts: restart
codebuddy, or run/clearin an open session.
magpie codebuddy deepseek/deepseek-v4-pro magpie codebuddy # show what it is set to
models.json
Each model magpie writes points at the magpie gateway on this computer and is asked under a Bearer key magpie gives CodeBuddy. CodeBuddy calls that address itself, not through Tencent's servers, with no CodeBuddy sign-in.
{"models": [{
"id": "deepseek/deepseek-v4-pro", "name": "DeepSeek V4 Pro", "vendor": "magpie",
"apiKey": "…", "url": "http://127.0.0.1:3425/v1/chat/completions",
"maxInputTokens": …, "maxOutputTokens": …,
"supportsToolCall": true, "supportsImages": …, "reasoning": {…}
}, …]}maxInputTokens and maxOutputTokens come from magpie's catalog; without maxOutputTokens CodeBuddy caps every reply at its own default. A model that thinks carries its levels (supportedEfforts, defaultEffort) and canDisableThinking when thinking can be turned off; a model with a window over 200K offers two sizes in contextWindow. CodeBuddy picks up a change to the file without a restart.
CodeBuddy Code
In the CLI, the model a session starts on is settings.json's model: one of magpie's ids from models.json, or one of CodeBuddy's own. magpie tells CodeBuddy's requests apart by their key, so Usage counts them under CodeBuddy.
CodeBuddy IDE
CodeBuddy.app (codebuddy.ai) and CodeBuddy CN.app (codebuddy.cn) read the same ~/.codebuddy/models.json. They watch the file, sync their model list when it changes, and list magpie's models in the IDE's own model picker. The IDE needs no CLI; with only the IDE installed, magpie still shows the CodeBuddy row. Two differences: the IDE always reads .codebuddy in your home folder, whatever CODEBUDDY_CONFIG_DIR says, and it doesn't read settings.json's model, so the model is picked in the IDE.
Your own models
Models you added to models.json yourself stay as they are; magpie updates only its own, in the place they were. A magpie model you turned off in CodeBuddy stays off, and a default thinking level you set on one stays while the model still offers it. When the file has availableModels (the models to show), magpie's are added to it and the rest you listed stay.
WSL
On Windows, a WSL distro with CodeBuddy Code installed has its own row. It writes the distro's ~/.codebuddy/models.json, naming the gateway as the distro reaches it, with the key it takes from there. CODEBUDDY_CONFIG_DIR isn't read there.
Switching back
Pick one of CodeBuddy's own models on the row: magpie takes its models out of models.json and sets settings.json's model to yours. Or from a terminal:
magpie codebuddy default
FAQ
Can CodeBuddy use DeepSeek, GLM, Kimi or Qwen?
Yes. magpie writes them as custom models into ~/.codebuddy/models.json, and they show in both CodeBuddy Code's and the CodeBuddy IDE's model list.
Do magpie's models need a CodeBuddy sign-in?
No. They call the magpie gateway on this computer under the key magpie gives CodeBuddy, not through a CodeBuddy account.
Does the China edition and CodeBuddy CN work?
Yes. Both CLI editions are one npm package, and CodeBuddy.app and CodeBuddy CN.app read the same models.json, so one row covers them all.
I changed the model and nothing happened.
CodeBuddy Code reads its model when a session starts. Restart codebuddy or run /clear. In the IDE, pick the model in its model picker.
More agents on the same models: Models in Claude Code, Kimi Code on any model, Qwen Code on any model and T3 Code on any model. Tencent Cloud's models: Tencent Cloud. Notes on the same models: Obsidian on any model. Something fails? See Fixing common errors, or ask on Discord.