CodeBuddy Code
Connect CodeBuddy Code to Yolo Router and use a selected model for coding assistance.
- CodeBuddy Code is installed and available as
codebuddy. - A working Yolo Router endpoint, for example
https://api.yolorouter.com. - A Yolo Router API Key generated from the console.
- The model ID you want to use, for example
deepseek-v4-pro. It must exactly match the model ID in the Yolo Router console.
CodeBuddy Code custom models use an OpenAI-compatible interface format. In
models.json, theurlmust be a complete endpoint path, usually ending with/v1/chat/completions; do not use only the gateway root URL.
Setup
Check CodeBuddy Code
Run:
codebuddy --versionIf it is not installed yet, install it with the official package:
npm install -g @tencent-ai/codebuddy-codeCreate models.json
CodeBuddy Code registers custom models through models.json. You can use either user-level or project-level configuration:
- User-level:
~/.codebuddy/models.json, applies to all projects - Project-level:
<project-root>/.codebuddy/models.json, applies only to the current project and has higher priority
The user-level path on Windows is usually:
%USERPROFILE%\.codebuddy\models.jsonWrite the following content:
{
"models": [
{
"id": "deepseek-v4-pro",
"name": "deepseek-v4-pro",
"vendor": "YoloRouter",
"url": "https://api.yolorouter.com/v1/chat/completions",
"apiKey": "${YOLOROUTER_API_KEY}",
"maxInputTokens": 128000,
"maxOutputTokens": 8192,
"supportsToolCall": true,
"supportsImages": false
},
{
"id": "deepseek-v4-flash",
"name": "deepseek-v4-flash",
"vendor": "YoloRouter",
"url": "https://api.yolorouter.com/v1/chat/completions",
"apiKey": "${YOLOROUTER_API_KEY}",
"maxInputTokens": 128000,
"maxOutputTokens": 8192,
"supportsToolCall": true,
"supportsImages": false
}
],
"availableModels": [
"deepseek-v4-pro",
"deepseek-v4-flash"
]
}If your Yolo Router endpoint already includes /v1, for example https://api.yolorouter.com/v1, set url to https://api.yolorouter.com/v1/chat/completions; do not duplicate it as /v1/v1/chat/completions.
Set the Yolo Router API Key
The models.json above uses ${YOLOROUTER_API_KEY}, so set the environment variable before starting CodeBuddy Code.
export YOLOROUTER_API_KEY="sk-yolo-..."$env:YOLOROUTER_API_KEY = "sk-yolo-..."set YOLOROUTER_API_KEY=sk-yolo-...Do not write the real API Key into models.json or commit it to your repository.
Start and select the model
Open any project directory and start CodeBuddy Code:
codebuddy --model deepseek-v4-proFor a print-mode test, also pass --model explicitly:
codebuddy --model deepseek-v4-pro -p "Introduce the model you are using in one sentence"After a normal response, check the Yolo Router console request log and confirm the request used deepseek-v4-pro.
Optional: set the sub-agent model
If you want CodeBuddy Code sub-agents to use the faster model, set:
export CODEBUDDY_CODE_SUBAGENT_MODEL="deepseek-v4-flash"$env:CODEBUDDY_CODE_SUBAGENT_MODEL = "deepseek-v4-flash"set CODEBUDDY_CODE_SUBAGENT_MODEL=deepseek-v4-flashTroubleshooting
The response says GLM-5.1 or another default model
This means CodeBuddy Code did not use your registered custom model. Check these first:
models.jsonis located at~/.codebuddy/models.jsonor<project-root>/.codebuddy/models.jsonavailableModelsincludesdeepseek-v4-pro- the launch command explicitly includes
--model deepseek-v4-pro YOLOROUTER_API_KEYis set in the same terminal session- CodeBuddy Code was restarted after changing the configuration
401 or authentication error
Check that YOLOROUTER_API_KEY is set to your Yolo Router API Key and has no extra spaces.
404 or endpoint not found
Check that the url in models.json is a complete endpoint path, for example https://api.yolorouter.com/v1/chat/completions. Do not use only https://api.yolorouter.com or https://api.yolorouter.com/v1.
Model not found
Check that id, name, availableModels, and the launch parameter --model exactly match the model ID in the Yolo Router console. Do not use a display name, alias, or value with extra spaces.