CodeBuddy
AI coding assistant that connects to OpenAI-compatible APIs through a local JSON model configuration.
Introduction
WorkBuddy / CodeBuddy is an AI Agent and coding assistant tool that manages available models through a local JSON model configuration file. It uses the OpenAI-compatible Chat Completions API and can be seamlessly connected to Models Hub.
📦 Before You Start
What you need
- WorkBuddy / CodeBuddy installed
- A working Models Hub URL (must end with
/v1) - A working Models Hub API Key (generated in the console)
- The name of the model you want to use (e.g.,
claude-sonnet-4-6,gemini-2.5-flash, etc.), which must exactly match the model ID in the Models Hub console
🚀 Step 1: Edit the Model Configuration File
Find WorkBuddy / CodeBuddy's local model configuration JSON file (usually located in your user directory) and add the Models Hub models:
{
"models": [
{
"id": "claude-sonnet-4-6",
"name": "Claude Sonnet 4.6 (Models Hub)",
"vendor": "Models Hub",
"url": "https://modelsok.com/v1/chat/completions",
"apiKey": "${MODELSOK_API_KEY}",
"maxInputTokens": 200000,
"maxOutputTokens": 8192,
"supportsToolCall": true,
"supportsImages": true
},
{
"id": "gemini-2.5-flash",
"name": "Gemini 2.5 Flash (Models Hub)",
"vendor": "Models Hub",
"url": "https://modelsok.com/v1/chat/completions",
"apiKey": "${MODELSOK_API_KEY}",
"maxInputTokens": 1000000,
"maxOutputTokens": 8192,
"supportsToolCall": true,
"supportsImages": false
}
],
"availableModels": [
"claude-sonnet-4-6",
"gemini-2.5-flash"
]
}Field notes
urlmust be the full Chat Completions endpoint address (including/v1/chat/completions)idshould be the actual model name exposed by the Models Hub console- Adjust
maxInputTokens/maxOutputTokensbased on the actual model capabilities availableModelscontrols the list of models selectable in the UI
🔑 Step 2: Set the API Key Environment Variable
Linux / macOS
export MODELSOK_API_KEY="ms_live_your_key"Windows (PowerShell)
$env:MODELSOK_API_KEY="your-modelsok-api-key"It is recommended to add the environment variable to your shell configuration file (~/.bashrc / ~/.zshrc / PowerShell Profile) to make it persistent.
✅ Step 3: Verify the Connection
Start WorkBuddy / CodeBuddy, select the Models Hub model you just added (e.g., claude-sonnet-4-6) in the model selector, and send a test message:
Write me a TypeScript implementation of quicksortIf the model responds normally, the connection is successful.
❓ FAQ
| Issue | Solution |
|---|---|
| The new model does not appear in the model selector | Check whether availableModels includes the model ID, then restart the app |
| 401 / Invalid API Key | Confirm the environment variable is set and that the process picked up the new value |
url must end with /chat/completions | Confirm url is the full endpoint; do not stop at /v1 |
| Model does not exist | Confirm id exactly matches the model ID in the Models Hub console |
| Output is truncated | Increase the maxOutputTokens limit |