Trae Work supports custom model services through OpenAI-compatible or Anthropic-compatible protocols. For HaiToken, the most reliable setup is OpenAI Chat Completions.
What You Need
- A HaiToken API key
- At least one available model ID, such as
deepseek-v4-flash
- HaiToken OpenAI-compatible address:
https://api.haitoken.ai/v1
Setup Steps
Step 1: Open the model settings
In Trae Work, go to Settings > Models.
If the current page shows Add Model, click it to open the add-model dialog.
Step 2: Choose Custom Configuration
In the add-model dialog, switch from preset providers to Custom Configuration.
This allows Trae Work to call HaiToken directly with the protocol, endpoint, and model ID you provide.
Select OpenAI Chat Completions as the API format.
HaiToken provides an OpenAI-compatible chat endpoint at POST /v1/chat/completions, and this is the simplest path for most Trae Work integrations.
Step 4: Fill the endpoint, model ID, and API key
Use the following values:
| Field | Recommended value |
|---|
| API format | OpenAI Chat Completions |
| Model ID | A real HaiToken model ID such as deepseek-v4-flash |
| API Key | Your HaiToken API key |
| Request URL | Prefer https://api.haitoken.ai/v1 |
If the UI provides a Full URL switch, it is safer to keep it off first and enter the base address https://api.haitoken.ai/v1.
If Full URL is already enabled, then use the full endpoint https://api.haitoken.ai/v1/chat/completions instead.
If the dialog also exposes optional fields, adjust them according to the real model capability:
- Multimodal: enable only if the model supports image input
- Display name: for example
HaiToken DeepSeek V4 Flash
- Context window and max output: keep the defaults if you are unsure
Step 5: Add the model and enable it
Click Add Model.
If Trae Work reports a successful connection, the model should appear in the model list. Make sure it is enabled and switch to it in the chat UI.
Verification
- Open the Trae Work chat panel.
- Switch to the HaiToken-backed model.
- Send a simple test prompt such as
hi or Explain what this file does.
- If the reply returns normally, the integration is working.
Notes
If you are using base-address mode in Trae Work, enter https://api.haitoken.ai/v1. If you are using Full URL mode, enter https://api.haitoken.ai/v1/chat/completions. Do not mix the two modes.
| Item | Value |
|---|
| Trae Work API format | OpenAI Chat Completions |
| Actual HaiToken endpoint | POST /v1/chat/completions |
| Auth method | Authorization: Bearer YOUR_API_KEY |
| Model source | The model ID you manually added in Trae Work |
Trae Work’s official model documentation states that custom configuration supports both OpenAI Chat Completions and Anthropic Messages. For HaiToken, the OpenAI path is usually the most direct. Official model docs
FAQ
The request URL is reported as invalid
First check which mode you are currently using:
- If Full URL is off, enter
https://api.haitoken.ai/v1
- If Full URL is on, enter
https://api.haitoken.ai/v1/chat/completions
The most common mistake is mixing base-address mode and full-URL mode.
401 or authentication failed
Make sure the API key is valid. HaiToken uses OpenAI-compatible Bearer authentication:
Authorization: Bearer YOUR_API_KEY
model not found
Make sure the model ID in Trae Work exactly matches a model ID returned by HaiToken.
The model was added but does not appear in the chat UI
Go back to the model management page and confirm the model was added successfully and is enabled.
If it still does not show up, reopen the model list or restart Trae Work once and check again.
Next