AI Code With

Claude Code

Install and configure the Claude Code CLI (command-line tool) on your computer using a configuration file

If you run into any issues, you can take a screenshot of this entire page and your problem, then copy them to Doubao or deepseek or another AI, and follow its instructions to run the corresponding commands.

If the AI is also unable to resolve the issue, you can contact our engineers for technical support and assistance.

Windows

1. Install Node.js / Git

Go to the Node.js official website to download and install the LTS version. (If it is already installed, you can skip this step.)

Verify the installation:

Check the Node version
1node --version

If you see the following message, it means that Node has been installed successfully.

Image

Note that the Node.js version must be 18 or higher.

If your version is lower than this, you can ask the AI how to upgrade your Node.js version. First, have the AI give you commands to collect your system information, and then it will provide the fastest and most accurate guidance.

Go to the official Git website, download the installer, and just keep clicking Yes all the way through. It’s all in English, so you don’t need to worry about the details.

Image

2. Install Claude Code CLI

Open PowerShell (it is recommended to run as administrator) and execute:

Install claude code via a domestic mirror source
1npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com/
Image

If you encounter a restriction that prevents scripts from running on this system, you need to run PowerShell with administrator privileges, and then execute Set-ExecutionPolicy Unrestricted command

3. Create a configuration file

Open PowerShell (it is recommended to run as administrator) and execute:

bash
1# Target directory: C:\Users\<you>\.claude
2$dir = Join-Path $env:USERPROFILE ".claude"
3$settingsFile = Join-Path $dir "settings.json"
4$claudeJsonFile = Join-Path $env:USERPROFILE ".claude.json"
5
6# Create directory (no error if it already exists)
7New-Item -ItemType Directory -Path $dir -Force | Out-Null
8
9# 1. Write settings.json (API configuration)
10$settingsJson = @'
11{
12 "env": {
13 "ANTHROPIC_AUTH_TOKEN": "Replace this with your _API_KEY",
14 "ANTHROPIC_BASE_URL": "https://api.aicodewith.com"
15 }
16}
17'@
18[System.IO.File]::WriteAllText($settingsFile, $settingsJson, (New-Object System.Text.UTF8Encoding($false)))
19
20# 2. Write .claude.json (skip login) - note this file is in the user home directory
21$claudeJson = @'
22{
23 "hasCompletedOnboarding": true
24}
25'@
26[System.IO.File]::WriteAllText($claudeJsonFile, $claudeJson, (New-Object System.Text.UTF8Encoding($false)))
27
28Write-Host "Configuration completed!"
29Write-Host " - settings.json: $settingsFile"
30Write-Host " - .claude.json: $claudeJsonFile"
WeCom screenshot_17693565757036

4. Verify the installation

Reopen PowerShell or your IDE and run:

bash
1Claude

If you see the following prompt, select the first "yes" option and then press Enter.

This is asking you to authorize Claude Code to access and execute the code in the current folder, so it can read, modify, and run project files.

Image

Next, you can enter the following in the dialog box: Hello! If you receive a normal reply and there is a correct invocation record in the backend, it means the configuration was successful.

WeCom_Screenshot_17692380816465
Image

macOS

1. Install Node.js

First, make sure you have Homebrew installed on your computer. If not, click the link and you’ll see a command that you can copy and run to install it in one step.

When installing Homebrew, some resources are hosted overseas, so you need to configure a TUN proxy.

Image

After the installation is complete, use Homebrew to install Node.js (you can skip this step if it is already installed).

bash
1brew install node
Image

Use the following command to verify the installation. If you see the following message, it means Node has been installed successfully.

bash
1node --version
Image

Note that the Nodejs version must be 18 or higher.

If your version is lower than this, you can ask the AI how to upgrade your Node.js version. First, have the AI give you commands to collect your system information, and then it will provide the fastest and most accurate guidance.

2. Install Claude Code CLI

Open a new terminal, then run the following command:

bash
1npm install -g @anthropic-ai/claude-code --registry=https://registry.npmmirror.com/
Image

3. Create a configuration file

Open a new terminal, then run the following command:

bash
1# Target directory: ~/.claude
2dir="$HOME/.claude"
3settingsFile="$dir/settings.json"
4claudeJsonFile="$HOME/.claude.json"
5
6# Create directory (no error if it already exists)
7mkdir -p "$dir"
8
9# 1. Write settings.json (API configuration)
10cat > "$settingsFile" << 'EOF'
11{
12 "env": {
13 "ANTHROPIC_AUTH_TOKEN": "Replace this with your _API_KEY",
14 "ANTHROPIC_BASE_URL": "https://api.aicodewith.com"
15 }
16}
17EOF
18
19# 2. Write .claude.json (skip login) - note this file is in the user home directory
20cat > "$claudeJsonFile" << 'EOF'
21{
22 "hasCompletedOnboarding": true
23}
24EOF
25
26echo "Configuration complete!"
27echo " - settings.json: $settingsFile"
28echo " - .claude.json: $claudeJsonFile"

Use the following command to view the contents of the configuration file,Be sure not to forget to replace the API KEY!

bash
1cat "$HOME/.claude/settings.json"
Image

4. Verify the installation

Reopen the terminal or IDE and run:

bash
1Claude

If you see the following prompt, select the first "yes" option and then press Enter.

This is asking you to authorize Claude Code to access and execute the code in the current folder so it can read, modify, and run project files.

Image

Next, you can enter the following in the dialog box: Hello! If you receive a normal reply and there is a correct invocation record in the backend, it means the configuration was successful.

Image
Image

Linux

1. Install Node.js

Command to install Nodejs (you can skip this if it is already installed):

bash
1curl -fsSL https://deb.nodesource.com/setup_lts.x | bash -
2apt-get install -y nodejs

Verify installation:

bash
1node --version
Image

Note that the Nodejs version must be 18 or higher.

If your version is lower than this, you can ask the AI how to upgrade your Node.js version. First, have the AI give you commands to collect your system information, and then it will provide the fastest and most accurate guidance.

2. Install Claude Code CLI

bash
1npm install -g @anthropic-ai/claude-code
Image

That last message is just saying my current npm version is relatively low. You probably won’t see it on your side, so you can just ignore it.

If you run into any other issues, you can ask the AI.

3. Create a configuration file

Open a new terminal, then run the following command:

bash
1# Target directory: ~/.claude
2dir="$HOME/.claude"
3settingsFile="$dir/settings.json"
4claudeJsonFile="$HOME/.claude.json"
5
6# Create directory (no error if it already exists)
7mkdir -p "$dir"
8
9# 1. Write settings.json (API configuration)
10cat > "$settingsFile" << 'EOF'
11{
12 "env": {
13 "ANTHROPIC_AUTH_TOKEN": "Replace with your _API_KEY_ here",
14 "ANTHROPIC_BASE_URL": "https://api.aicodewith.com"
15 }
16}
17EOF
18
19# 2. Write .claude.json (skip login) - note this file is in the user home directory
20cat > "$claudeJsonFile" << 'EOF'
21{
22 "hasCompletedOnboarding": true
23}
24EOF
25
26echo "Configuration completed!"
27echo " - settings.json: $settingsFile"
28echo " - .claude.json: $claudeJsonFile"

Use the following command to view the contents of the configuration file,Be sure not to forget to replace the API KEY!

bash
1cat "$HOME/.claude/settings.json"
Image

4. Verify the installation

Reopen the terminal or IDE and run:

bash
1Claude

If you see the following prompt, select the first "yes" and then press Enter.

This is asking you to authorize Claude Code to access and execute the code in the current folder, so it can read, modify, and run project files – common questions

Image

Next, you can type hi in the dialog box. If you receive a normal reply and there is a correct invocation record in the backend, it means the configuration was successful.

Image
Image

FAQ

1. Unable to connect to the Anthropic service

Error screenshot

Image

Solution

In the ~/.claude.json file, add the following line:"hasCompletedOnboarding": true,

Note that there is a comma at the end of this line; just add it in the middle of the JSON, as shown below.

Image

2. Invalid API key · Please run /login

Error screenshot

Image

Solution

This issue occurs because the environment variables are not configured correctly. You can refer to the earlier tutorial and reconfigure the environment variables.

Mainly these two

ANTHROPIC_BASE_URL and ANTHROPIC_AUTH_TOKEN

3. 401 {"error":"Invalid API key"}

Error screenshot

Image

Solution

This issue occurs because the key was set incorrectly. You can go to the website to generate a new key, then follow the earlier tutorial to reset the environment variable ANTHROPIC_AUTH_TOKEN environment variable.

On this page