Skip to main content
ZCode is an AI coding assistant from Zhipu AI that supports custom providers compatible with the OpenAI and Anthropic protocols. For HaiToken, the OpenAI path is usually the most stable and broadly compatible choice; if you explicitly want the Claude / Anthropic ecosystem, you can also use the Anthropic path.

What you need

  • A HaiToken API key
  • HaiToken OpenAI-compatible address: https://api.haitoken.ai/v1
  • HaiToken Claude / Anthropic-compatible address: https://api.haitoken.ai
  • At least one available model ID, such as deepseek-v4-flash
ZCode is configured entirely through the GUI, so the steps are essentially the same on Windows, macOS, and Linux. If menu placement or dialog layout differs slightly on your system, follow the actual UI — the API key, Base URL, and model ID values remain the same.

Setup Steps

Choose the protocol first

In ZCode, the two common choices are:
  • OpenAI: recommended first, broader compatibility, and the main flow in this guide
  • Anthropic: also common, useful when you explicitly want the Claude / Messages ecosystem
If you do not have a strong reason, start with OpenAI.

Step 1: Open Model Settings

In the ZCode main interface, click Model Settings in the left sidebar to open the model provider management page. Open ZCode model settings

Step 2: Add a Custom Provider

In the Custom Providers area of the model settings page, click the + Add Provider button to open the provider configuration form.

Step 3: Fill in HaiToken Configuration

In the provider configuration form, enter the following:
FieldValue
Provider namehaitoken (customizable)
Base URLUse https://api.haitoken.ai/v1 for OpenAI; use https://api.haitoken.ai for Anthropic
API KeyYour HaiToken API key
API formatPrefer OpenAI; choose Anthropic Messages (/v1/messages) if you explicitly want the Claude ecosystem
If selecting OpenAI as the API format causes a /responses suffix to appear below the Base URL field, the current configuration uses the Responses API path. HaiToken is compatible with the Chat Completions path (/v1/chat/completions). Select an OpenAI option that does not include /responses to ensure the correct request path.
If you choose the Anthropic path, do not enter https://api.haitoken.ai/v1. This path should use the Anthropic-style gateway prefix https://api.haitoken.ai, and the client should call /v1/messages through that gateway.

Step 4: Add Models

In the Model List area, click + Add Model and enter the HaiToken model ID you want to use, such as deepseek-v4-flash. You can add multiple models.

Step 5: Save the Provider

After filling in the fields, click the Add Provider button at the bottom of the form to save the configuration.

Step 6: Verify Connectivity

After saving, switch to the newly configured HaiToken model in the ZCode chat or coding panel, and send a simple message (such as hello) to verify connectivity.

Notes

ItemDetails
Recommended protocolOpenAI Chat Completions
Common request pathPOST /v1/chat/completions
Claude-compatible pathPOST /v1/messages
Auth headerAuthorization: Bearer YOUR_API_KEY
Model switchingUse the model picker in the ZCode chat or coding panel
If you need to configure advanced parameters such as temperature, max output length, or system prompt, keep the defaults for your first test and verify connectivity first.

FAQ

QuestionSolution
Model list loads successfully but invocation failsCheck whether the API format is using the Responses API (URL suffix shows /responses). HaiToken is compatible with Chat Completions — select an OpenAI option that does not include /responses.
Endpoint is reported as invalidMake sure the Base URL is https://api.haitoken.ai/v1 without appending /chat/completions — ZCode appends the path automatically.
I want to use the Claude / Anthropic modeSwitch the API format to Anthropic Messages (/v1/messages), and change the Base URL to https://api.haitoken.ai without /v1. This path should call POST /v1/messages.
401 or authentication failedMake sure the API key is valid and that ZCode is using OpenAI-compatible Bearer authentication.
model not foundMake sure the model ID in ZCode exactly matches a model ID exposed by HaiToken.
Model was added but still cannot be usedAfter saving the provider, re-select the model once and, if needed, restart ZCode before testing again to avoid using a cached configuration.

Next