ZCode
ZCode is an Agentic Development Environment (ADE) developed by Z.ai. Deeply optimized for GLM models, it supports a 1M-token context window and enables end-to-end development, from understanding requirements and breaking down plans to modifying code and validating results. ZCode also supports MaaS model APIs, giving you access to a wider range of models. This section describes how to configure MaaS model APIs in ZCode.
Prerequisites
- You have signed up for a Huawei Cloud account. For details, see Signing Up for a Huawei Cloud Account.
- You have subscribed to a built-in service or created an endpoint. For details, see Subscribing to a Built-in Service and Creating an Endpoint.
Billing
When using the MaaS model service, you are charged based on the number of tokens used. For details, see MaaS Text Generation Models.
Constraints
This function is only supported in the CN-Hong Kong region.
Step 1: Install ZCode
Download the ZCode version for your operating system from the ZCode official website and install it. ZCode supports macOS, Windows, and Linux.
After the installation is complete, open ZCode and choose to connect to a Z.ai account or a BigModel account, or use an API key to access the model. This section provides guidance on using an API key to access a MaaS model.
Step 2: Access MaaS Model APIs
- Open ZCode and choose Choose model > Manage models. Figure 1 Model settings
- On the Model settings page, click Add provider in the upper right corner and select Create custom provider. Figure 2 Add a provider
- On the New provider page, set the parameters. Figure 3 Add a custom provider
Table 1 Custom provider settings Parameter
Description
Example
Provider name
Name of the custom provider.
Click
in the upper right corner and choose Rename.Huawei Cloud MaaS
Base URL
(Mandatory) Enter a base URL.
https://api-ap-southeast-1.modelarts-maas.com/openai/v1
API format
(Mandatory) Select either of the following API formats:
- Chat Completions
- Anthropic Messages
Chat Completions
API Key
(Mandatory) Enter an API key.
You can use an existing API key. If no API key is available, obtain an API key.
gA4ocs*****Tc-Kz4AQ
- Click Add model and configure the model parameters. Figure 4 Model configuration example
Table 2 Model settings Parameter
Description
Example
Model ID
(Mandatory) Enter the model ID.
Obtain the value from Model Parameter in the model list.
deepseek-v4.1-flash
Context window
(Mandatory)
Specify the context length that can be processed by a model at a time, in tokens.
The value can be configured to the maximum input length supported by the model. You can obtain the Max input length from the model list.
Do not exceed the input length limit of the model.
1,000,000
Maximum output tokens
(Mandatory)
Enter the maximum number of tokens that can be generated for a single request, in tokens.
The value can be configured to the maximum output length supported by the model. You can obtain the Max output length from the model list.
Do not exceed the output length limit of the model.
384,000
Advanced settings
(Optional) You can set the Input types, Model capabilities, and Reasoning levels.
-
- Click Save and then click Test model in the operation column. If the connection is successful, the model was added successfully. Figure 5 Testing model connectivity

Step 3: Use ZCode
- In the navigation pane of the ZCode home page, choose . Then select the model configured in Step 2: Access MaaS Model APIs. Figure 6 Selecting a model
- Start a dialogue in the dialog box to experience the model. Figure 7 Example conversation
Common Errors
| Error | Cause | Solution |
|---|---|---|
| 404 Provider returned a business error. | The base URL contains unnecessary suffixes. | Ensure that the base URL does not contain the suffix /chat/completions or /v1/messages. |
| 401 Invalid authorization header | The API key is incorrect or incomplete. | Check whether the API key is completely copied and whether there are spaces. |
| 429 Too Many Requests | The number of requests exceeded the maximum limit. | Control the calling frequency and try again later. |
| 403 Invalid request because you do not have access to it. | The model is not enabled in MaaS. | Enable the corresponding built-in service on the MaaS console. |
| Cannot connect to API | The address is unreachable or the port number is incorrect. | Check whether the firewall and intranet address are accessible. |
| Invalid model | The model ID is misspelled. | Check for inconsistent capitalization and extra spaces. Check the correct model parameter value in the model list. |
| Connect Timeout Error | The network is unstable or the context is too long. | Check the network and shorten the input content. |
| 400 Bad request | The configured context window or maximum output token exceeds the model's upper limit. | Set the parameters based on the Length Limit in the model list. |
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot