Skip to main content
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. Open Trae Work model settings

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. Choose custom configuration

Step 3: Choose the API format

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. Choose OpenAI Chat Completions

Step 4: Fill the endpoint, model ID, and API key

Use the following values:
FieldRecommended value
API formatOpenAI Chat Completions
Model IDA real HaiToken model ID such as deepseek-v4-flash
API KeyYour HaiToken API key
Request URLPrefer 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
Fill the Trae Work custom model form

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

  1. Open the Trae Work chat panel.
  2. Switch to the HaiToken-backed model.
  3. Send a simple test prompt such as hi or Explain what this file does.
  4. 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.
ItemValue
Trae Work API formatOpenAI Chat Completions
Actual HaiToken endpointPOST /v1/chat/completions
Auth methodAuthorization: Bearer YOUR_API_KEY
Model sourceThe 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