- Add a custom model directly in the WorkBuddy UI for quick verification
- Maintain models in local
models.jsonfor longer-term use or project-based management
- Use the full endpoint
https://api.haitoken.ai/v1/chat/completions - Use a real HaiToken model ID as the model name
- Use your HaiToken API key
Protocol Note
WorkBuddy’s custom model integration only supports the OpenAI Chat Completions protocol; it does not support the Anthropic Messages protocol. This guide therefore only covers the OpenAI mode, with the request URL fixed to the full endpointhttps://api.haitoken.ai/v1/chat/completions.
The WorkBuddy UI flow is usually very similar on Windows, macOS, and Linux. The parts that are more likely to differ by system are
models.json paths, environment-variable syntax, and how ~ maps to your user home directory.What You Need
- A HaiToken API key
- At least one available model ID, such as
gpt-5.4 - Full chat completions endpoint:
https://api.haitoken.ai/v1/chat/completions
Quick Mapping
In WorkBuddy, this is not a generic
Base URL. You should enter the full endpoint https://api.haitoken.ai/v1/chat/completions.Mode 1: Add It Quickly in the WorkBuddy UI
This is the best path for a first validation.Step 1: Open the custom model entry
In the chat UI, click the current model and choose Configure Custom Model from the dropdown.Step 2: Choose Custom
In the add-model dialog, choose Custom in the provider list.
Step 3: Fill the HaiToken values
Use the following values and then click Save:Step 4: Adjust advanced options if needed
If the current UI exposes capability toggles, match them to the real model capability:- Enable
Tool Callonly if the model supports tools - Enable
Reasoningonly if the model supports reasoning mode - Do not enable image capability if the model does not support image input
Step 5: Return to chat and test it
Switch to the newly added model and send a simple message such ashi.
If a normal response comes back, the integration is working.
Checklist
- The model appears in the model dropdown.
- A simple test request returns normally.
- If this WorkBuddy entry supports streaming, the reply appears progressively instead of only at the end.
FAQ
Mode 2: Configure Local models.json
This path is better for long-term model management.
WorkBuddy / CodeBuddy commonly uses two config scopes:
- User-level:
~/.codebuddy/models.json - Project-level:
<project-root>/.codebuddy/models.json
- Windows:
~usually maps to%USERPROFILE%, so the user-level path is commonly understood as%USERPROFILE%\\.codebuddy\\models.json - macOS:
~usually maps to/Users/<your-name> - Linux:
~usually maps to/home/<your-name>
Step 1: Choose the scope and create models.json
Decide where the config should live, then create or edit models.json there.
Save the file as UTF-8 without BOM. Some desktop builds fail to read models.json when it includes BOM.
Step 2: Add the HaiToken models
Example:Step 3: Set the environment variable
If you use${HAITOKEN_API_KEY}, set the variable before starting WorkBuddy.
Windows PowerShell:
Step 4: Save and reload WorkBuddy
After saving the file, first check whether WorkBuddy refreshes the model list automatically. If the model still does not appear, fully close WorkBuddy and reopen it once.Key Notes
url must be the full endpoint
Whether you add the model in the UI or register it in models.json, url must point to the full endpoint:
apiKey becomes a Bearer token
WorkBuddy expects the following auth pattern:
apiKey is written as ${HAITOKEN_API_KEY}, WorkBuddy resolves it and sends it as Authorization: Bearer ..., not as X-Api-Key.
What availableModels does
When you use models.json, availableModels controls which models appear in the WorkBuddy dropdown. It does not decide whether HaiToken actually supports the model.
How availableModels relates to /v1/models
These are easy to confuse:
GET /v1/modelsis the set of models visible to your current HaiToken API keymodels[].idis the local model ID you register in WorkBuddy and must match a real HaiToken model IDavailableModelsis only the local display allowlist in WorkBuddy
models.json controls what WorkBuddy shows and tries to call, while HaiToken GET /v1/models helps you confirm whether your API key actually has access to those models.
Check visible models first if needed:
id values exactly into the UI or into models[].id, and decide whether to include them in availableModels.
When relatedModels is useful
If you want a main model to switch automatically to a faster or stronger model in different cases, configure relatedModels.
liteusually points to a faster and cheaper modelreasoningusually points to a stronger reasoning model
Checklist
- WorkBuddy shows
HaiToken GPT-5.4or the name you configured in the model dropdown. - A simple conversation returns normally without auth failures or missing-model errors.
- If the current entry supports streaming, the reply appears incrementally rather than only at the end.
FAQ
VPN or proxy connection issues
If a VPN, system proxy, or TUN mode causes a connection error or timeout, see VPN and proxy connectivity. It explains the difference between system proxies and TUN mode, including the corresponding WorkBuddy setting.Next
- See Get API Key
- See OpenAI format API
- See List models