Claude Code
During software development, developers often struggle with slow coding and complex debugging. Claude Code is an AI programming tool that helps developers write and debug code efficiently using large language models. However, quickly adding these advanced AI capabilities to existing development environments has become a new challenge. You can easily connect MaaS model APIs to Claude Code using simple settings to quickly integrate API capabilities and improve your development speed.
Prerequisites
You have subscribed to built-in services or created an endpoint. For details, see Subscribing to Built-in Services or Creating an Endpoint.
Billing
When using the MaaS service, you are charged based on the number of tokens used. For details, see Text Generation Models.
Constraints
This function is only supported in the CN-Hong Kong region.
Step 1: Install Claude Code
- Install Node.js 18 or later.
- Install Git for Windows (for Windows users only).
- Open the command-line interface and run the following command to install Claude Code:
npm install -g @anthropic-ai/claude-code
- After the installation, run the following command to check whether the installation is successful:
claude --version
If the version number appears, the installation is successful.
Step 2: Configure MaaS Model APIs in Claude Code
The following sections describe detailed configuration instructions.
- Once Claude Code is installed, navigate to the Claude Code configuration directory (C:\Users\<your-username>\.claude\) and locate settings.json. If the file does not exist, create a new, empty settings.json file in that directory.
- Edit the settings.json file. If you created a new empty file, copy the configuration below into settings.json:
- <API_KEY>: Replace with your actual API key. If you do not have one, generate it on the API Key Management page.
- <Model_Name>: Replace it with the model to be used, for example, glm-5.2. For details about supported models, see Supported Models.
{ "env": { "ANTHROPIC_AUTH_TOKEN": "<API_KEY>", "ANTHROPIC_BASE_URL": "https://api-ap-southeast-1.modelarts-maas.com/anthropic", "ANTHROPIC_MODEL": "<Model_Name>", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "<Model_Name>", "ANTHROPIC_DEFAULT_SONNET_MODEL": "<Model_Name>", "ANTHROPIC_DEFAULT_OPUS_MODEL": "<Model_Name>" } }Example
Figure 1 Configuration example
- Save the configuration file and open a new terminal to apply the changes.
- Once Claude Code is installed, navigate to the Claude Code configuration directory (~/.claude/) and locate settings.json. If the file does not exist, create a new, empty settings.json file in that directory.
- Edit the settings.json file. If you created a new empty file, copy the configuration below into settings.json and then edit it. Edit the settings.json file:
nano ~/.claude/settings.json
- <API_KEY>: Replace with your actual API key. If you do not have one, generate it on the API Key Management page.
- <Model_Name>: Replace it with the model to be used, for example, glm-5.2. For details about supported models, see Supported Models.
{ "env": { "ANTHROPIC_AUTH_TOKEN": "<API_KEY>", "ANTHROPIC_BASE_URL": "https://api-ap-southeast-1.modelarts-maas.com/anthropic", "ANTHROPIC_MODEL": "<Model_Name>", "ANTHROPIC_DEFAULT_HAIKU_MODEL": "<Model_Name>", "ANTHROPIC_DEFAULT_SONNET_MODEL": "<Model_Name>", "ANTHROPIC_DEFAULT_OPUS_MODEL": "<Model_Name>" } }Example
Figure 2 Configuration example
- Save the configuration file and open a new terminal to apply the changes.
Step 3: Use Claude Code
- Start Claude Code. Open the terminal, navigate to the project directory, and run the claude command to start using Claude Code.
claude
Once it starts, trust the folder to let Claude Code access files in the directory. The following figure shows an example.

- Run /status to verify the model status. Figure 3 Viewing the model status
- Start a conversation in Claude Code. Figure 4 Example conversation
Helpful Links
- Viewing the Call Data and Monitoring Metrics of Real-Time Inference on MaaS: MaaS tracks call statistics so you can view usage and monitoring metrics of models for any specific period. You can use these details to evaluate model performance, locate and troubleshoot faults, and optimize your services.
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