OpenAI Chat Completions.
This Trae Work guide is primarily GUI-based, so the core steps are generally the same on Windows, macOS, and Linux. If menu hierarchy, button placement, or dialog styling differs slightly on your system, follow the current UI, but keep the same protocol, request URL, model ID, and API key values.
What You Need
- A HaiToken API key
- At least one available model ID, such as
gpt-5.4 - HaiToken OpenAI-compatible address:
https://api.haitoken.ai/v1 - HaiToken Claude / Anthropic-compatible address:
https://api.haitoken.ai
Choose the API format first
Trae Work officially supports two common protocol formats:OpenAI Chat Completions: recommended first, simplest to configure, and the best default for most HaiToken setupsAnthropic Messages: also common, useful when you explicitly want the Claude / Anthropic ecosystem
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.
Step 3: Choose the API format
Select OpenAI Chat Completions as the API format. HaiToken provides an OpenAI-compatible chat endpoint atPOST /v1/chat/completions, and this is the simplest path for most Trae Work integrations.
If you explicitly want the Claude / Anthropic path instead, you can choose Anthropic Messages here. In that case, the request URL later should be https://api.haitoken.ai rather than the OpenAI-style /v1 address.
Step 4: Fill the endpoint, model ID, and API key
Use the following values:
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 you chose Anthropic Messages, keep the base-address style and enter https://api.haitoken.ai, then let the client call /v1/messages.
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 GPT-5.4 - 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
hiorExplain 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.
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
Next
- See Get API Key
- See OpenAI format API
- See List models