Custom Model Config
Overview
Manage custom AI model configurations for WorkBuddy by editing the ~/.workbuddy/models.json file. This skill enables adding OpenAI-compatible model providers (OpenAI, Anthropic-via-proxy, Kimi, Qwen/通义千问, DeepSeek, GLM/智谱, MiniMax, etc.), listing existing configurations, updating model settings, removing models, and validating configurations.
WorkBuddy loads custom models from ~/.workbuddy/models.json at startup and watches the file for live changes — no restart required. Custom models appear in the model selector prefixed with custom-local: (e.g., custom-local:gpt-5.4).
Configuration File
Path: ~/.workbuddy/models.json (on Windows: C:\Users\<username>\.workbuddy\models.json)
Format: JSON array of model objects. If the file does not exist, create it with an empty array [].
Model Object Schema
Each object in the array supports the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
id |
string | Yes | Unique model identifier. Used internally as custom-local:<id>. Must be alphanumeric with hyphens (e.g., gpt-5.4, kimi-k2.6, qwen-max). |
name |
string | Yes | Human-readable display name shown in the model selector UI. |
vendor |
string | Yes | Provider/vendor label (e.g., Custom, OpenAI, Kimi Coding Plan). |
url |
string | Yes | Full API endpoint URL for chat completions. Must be OpenAI-compatible (ends with /chat/completions or is a compatible base URL). |
apiKey |
string | Yes | API key for authentication. Sent as Authorization: Bearer <apiKey>. |
supportsToolCall |
boolean | No | Whether the model supports function/tool calling. Default: false. Set true for models with function-calling capability. |
supportsImages |
boolean | No | Whether the model accepts image inputs (multimodal). Default: false. |
supportsReasoning |
boolean | No | Whether the model supports reasoning/thinking mode. Default: false. Set true for models like GPT-o1, DeepSeek-R1, etc. |
useCustomProtocol |
boolean | No | Whether to use a custom protocol instead of standard OpenAI-compatible format. Default: false. Leave false for all standard OpenAI-compatible APIs. |
Example Configuration
[
{
"id": "gpt-5.4",
"name": "GPT-5.4",
"vendor": "OpenAI",
"url": "https://api.openai.com/v1/chat/completions",
"apiKey": "sk-xxxxxxxxxxxxxxxxxxxx",
"supportsToolCall": true,
"supportsImages": true,
"supportsReasoning": true,
"useCustomProtocol": false
},
{
"id": "kimi-k2.6",
"name": "Kimi K2.6",
"vendor": "Kimi Coding Plan",
"url": "https://api.kimi.com/coding/v1",
"apiKey": "sk-xxxxxxxxxxxxxxxxxxxx",
"supportsToolCall": true,
"supportsImages": true,
"supportsReasoning": true
}
]
Workflow: Add a Custom Model
- Read the existing
~/.workbuddy/models.jsonfile. If it does not exist, initialize with[]. - Collect the required information from the user:
- Model ID: A unique identifier (e.g.,gpt-5.4,deepseek-r1). Ask the user or infer from the provider/model name.
- Display Name: Human-readable name for the selector UI.
- Provider/Vendor: Which AI provider (OpenAI, DeepSeek, Kimi, Qwen, GLM, etc.).
- API URL: The endpoint URL. Consultreferences/providers.mdfor common provider URLs, or ask the user for the exact endpoint.
- API Key: The secret key. Never display the full key in the response — mask it (e.g.,sk-xxxx...xxxx).
- Capability flags: Whether the model supports tool calling, image inputs, and reasoning. Consultreferences/providers.mdfor known capabilities, or ask the user. - Construct the model object with all fields.
- Check for duplicate
id— if the ID already exists, ask the user whether to update or choose a new ID. - Append the new object to the array.
- Write the updated JSON back to
~/.workbuddy/models.jsonwith proper formatting (2-space indentation, UTF-8 encoding). - Inform the user that the model has been added and will appear as
custom-local:<id>in the model selector. Changes take effect immediately (hot-reload).
Workflow: List Custom Models
- Read
~/.workbuddy/models.json. - If the file does not exist or is empty, report that no custom models are configured.
- Present each model in a readable format: ID, name, vendor, URL (masked API key), and capability flags.
- Never display full API keys — always mask them as
sk-xxxx...last4.
Workflow: Update a Custom Model
- Read
~/.workbuddy/models.json. - Identify the model to update by
id(ask the user which one if multiple exist). - Apply the requested changes (e.g., update API key, change URL, toggle capability flags).
- Write the updated JSON back to the file.
- Confirm the changes to the user.
Workflow: Remove a Custom Model
- Read
~/.workbuddy/models.json. - Identify the model to remove by
id. - Remove the object from the array.
- Write the updated JSON back to the file.
- Confirm removal to the user.
Workflow: Validate Configuration
Run the validation script to check configuration integrity:
python scripts/validate_models.py
The script checks:
- JSON syntax validity
- Required fields present for each model
- URL format correctness (must start with http:// or https://)
- API key presence and non-emptiness
- No duplicate model IDs
- Optional: API connectivity test (sends a minimal test request)
Pass --test-connection to also test API reachability:
python scripts/validate_models.py --test-connection
Security Guidelines
- API Key Handling: API keys are secrets. When displaying model configurations, always mask keys as
sk-xxxx...last4. Never log full keys or include them in response text. - File Permissions: The
models.jsonfile contains sensitive API keys. Do not share its contents publicly or commit it to version control. - User Confirmation: Always confirm with the user before overwriting or removing existing model configurations.
- No Key Guessing: Never fabricate or guess API keys. Always obtain them from the user.
Common Provider Quick Reference
For detailed provider information (URLs, capability flags, notes), refer to references/providers.md. Common providers include:
| Provider | URL Pattern | Tool Call | Images | Reasoning |
|---|---|---|---|---|
| OpenAI | https://api.openai.com/v1/chat/completions |
Yes | Yes | Yes (o-series) |
| DeepSeek | https://api.deepseek.com/v1/chat/completions |
Yes | No | Yes (R1) |
| Kimi (Moonshot) | https://api.moonshot.cn/v1/chat/completions |
Yes | No | No |
| Qwen (DashScope) | https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions |
Yes | Yes (VL) | No |
| GLM (Zhipu) | https://open.bigmodel.cn/api/paas/v4/chat/completions |
Yes | Yes (VL) | No |
| MiniMax | https://api.minimax.chat/v1/text/chatcompletion_v2 |
Yes | No | No |
| SiliconFlow | https://api.siliconflow.cn/v1/chat/completions |
Yes | Yes | Yes |
| Ollama (local) | http://localhost:11434/v1/chat/completions |
Yes | No | No |
| vLLM (local) | http://localhost:8000/v1/chat/completions |
Yes | No | No |
Troubleshooting
- Model not appearing in selector: Verify
models.jsonis valid JSON (run validation script). Check that theidfield is unique and alphanumeric. - API errors when using custom model: Verify the URL is correct and OpenAI-compatible. Check that the API key is valid and has sufficient credits. Some providers require specific URL paths.
- Tool calling not working: Ensure
supportsToolCallis set totrue. Not all models support function calling even if the API endpoint accepts the parameter. - Reasoning/thinking mode not available: Ensure
supportsReasoningistrueand the model actually supports it (e.g., GPT-o1, DeepSeek-R1, Claude with extended thinking). - Enterprise policy restrictions: In enterprise environments, custom model usage may be restricted by admin policy. If custom models are not available, check with the workspace administrator.