Agentsflare CodeBuddy / WorkBuddy Configuration Guide
CodeBuddy is Tencent's AI coding assistant. Its CLI version, CodeBuddy Code, is a coding agent for professional developers; WorkBuddy is the desktop/agent version of the same product family. Both can be connected to the Agentsflare gateway to use Claude, GPT, and other models.
Installing and Configuring CodeBuddy Code
Installing CodeBuddy Code
Install via npm:
npm install -g @tencent-ai/codebuddy-codeAfter installation, run codebuddy in your terminal to start it. For other installation methods, refer to the official documentation: CodeBuddy Code Installation
Method 1: Environment Variables (Anthropic-compatible, Recommended)
CodeBuddy Code can connect to any Anthropic-compatible third-party model service by setting the Base URL, API Key, and model environment variables — no models.json changes needed.
Add the following to ~/.zshrc or ~/.bashrc:
# Endpoint and API key
export CODEBUDDY_BASE_URL="https://api.agentsflare.com/anthropic"
export CODEBUDDY_API_KEY="Your api key"
# Default model for the main agent
export CODEBUDDY_MODEL="claude-opus-5"
# Optional: large model for complex reasoning
export CODEBUDDY_BIG_SLOW_MODEL="claude-opus-5"
# Optional: small model for background/lightweight tasks
export CODEBUDDY_SMALL_FAST_MODEL="claude-sonnet-5"Then start CodeBuddy Code:
codebuddy --model claude-opus-5The variables above can also be written into the env field of ~/.codebuddy/settings.json, so they are applied automatically to every session:
{
"env": {
"CODEBUDDY_BASE_URL": "https://api.agentsflare.com/anthropic",
"CODEBUDDY_API_KEY": "Your api key",
"CODEBUDDY_MODEL": "claude-opus-5"
}
}Restart CodeBuddy Code for the configuration to take effect.
Method 2: models.json (OpenAI-compatible)
If you want to use GPT or other models through the OpenAI-compatible endpoint, edit the user-level config file ~/.codebuddy/models.json (or the project-level <project-root>/.codebuddy/models.json, which takes precedence):
{
"models": [
{
"id": "gpt-5.6",
"name": "GPT-5.6 (Agentsflare)",
"vendor": "OpenAI",
"url": "https://api.agentsflare.com/v1/chat/completions",
"apiKey": "${AGENTSFLARE_API_KEY}",
"maxInputTokens": 200000,
"maxOutputTokens": 8192,
"supportsToolCall": true,
"supportsImages": true
}
],
"availableModels": [
"gpt-5.6"
]
}Set the API key environment variable and start:
export AGENTSFLARE_API_KEY="Your api key"
codebuddy --model gpt-5.6Notes:
- The
urlfield must be the full endpoint path, ending with/chat/completions(e.g.https://api.agentsflare.com/v1/chat/completions); a bare base URL likehttps://api.agentsflare.com/v1will not work. apiKeyandurlsupport environment variable references with the${VAR_NAME}syntax, so the key does not have to be stored in plain text. It is recommended to set themodels.jsonfile permission to600.availableModelscontrols which models appear in the model dropdown; if omitted, all models are shown.- The config file supports hot reload — changes are detected automatically.
Switching Models
- Specify the main model at startup:
codebuddy --model <model-id> - Inside a session, use the
/modelcommand to switch models, or/model:lite//model:reasoningto pin the lightweight / reasoning variant models.
WorkBuddy
WorkBuddy is the desktop/agent version of the CodeBuddy product family and shares the same account and configuration system (~/.codebuddy/ directory). The environment variables and models.json described above also apply to WorkBuddy. For details, refer to the official documentation: CodeBuddy Docs
Common Issues
Configuration not taking effect
Environment variables are parsed when the CLI starts. After changing ~/.zshrc / ~/.bashrc or settings.json, restart the terminal and CodeBuddy Code. If an environment variable referenced by ${VAR_NAME} in models.json does not exist, the placeholder is kept as-is and API calls will fail — make sure the variable is exported before starting.
Model request fails with models.json
Check that the url is the full path ending with /chat/completions, and that the model id matches a model available on your Agentsflare account (see Supported Models).
