CodeBuddy
WorkBuddy / CodeBuddy tutorial โ Add EasyRouter as a custom model provider through a local JSON config file, using the OpenAI-compatible Chat Completions API.
Project Introduction
WorkBuddy / CodeBuddy is an AI agent and coding assistant that manages available models via a local JSON config file. It talks to models through the standard OpenAI-compatible Chat Completions API, making it easy to point at EasyRouter.
๐ฆ Prerequisites
What you'll need
- WorkBuddy / CodeBuddy installed
- An EasyRouter endpoint (must end with
/v1) - An EasyRouter API key (generated in the console)
- A model ID exactly matching one exposed by your EasyRouter console (e.g.
claude-sonnet-4-6,gemini-2.5-flash)
๐ Step 1: Edit the model config file
Find the local JSON model config (usually under your user directory). Add the EasyRouter models:
{
"models": [
{
"id": "claude-sonnet-4-6",
"name": "Claude Sonnet 4.6 (EasyRouter)",
"vendor": "EasyRouter",
"url": "https://easyrouter.io/v1/chat/completions",
"apiKey": "${EASYROUTER_API_KEY}",
"maxInputTokens": 200000,
"maxOutputTokens": 8192,
"supportsToolCall": true,
"supportsImages": true
},
{
"id": "gemini-2.5-flash",
"name": "Gemini 2.5 Flash (EasyRouter)",
"vendor": "EasyRouter",
"url": "https://easyrouter.io/v1/chat/completions",
"apiKey": "${EASYROUTER_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 (including/v1/chat/completions)idmust match the model ID exposed by your EasyRouter console- Adjust
maxInputTokens/maxOutputTokensto the real capability of each model availableModelscontrols which models appear in the UI
๐ Step 2: Set the API key environment variable
Linux / macOS
export EASYROUTER_API_KEY="your-easyrouter-api-key"Windows (PowerShell)
$env:EASYROUTER_API_KEY="your-easyrouter-api-key"Persist it in your shell profile (~/.bashrc / ~/.zshrc / PowerShell Profile) so you don't have to re-export every session.
โ Step 3: Verify
Launch WorkBuddy / CodeBuddy, pick an EasyRouter model (e.g. claude-sonnet-4-6) from the model switcher, and send a test message:
Write a quicksort implementation in TypeScript.A normal response means you're set.
โ Troubleshooting
| Issue | Fix |
|---|---|
| New model doesn't show in the picker | Check availableModels contains the ID and restart the app |
| 401 / Invalid API key | Confirm the env var is set and the process picked up the new value |
url must end with /chat/completions | Use the full endpoint, not just /v1 |
| Model not found | Make sure id exactly matches your EasyRouter console |
| Output truncated | Raise maxOutputTokens |