AI Code With

Gemini

Install and configure the Gemini CLI (command-line tool) on your computer using environment variables

If you run into any issues, you can take a screenshot of this entire page and your problem, and send it to Doubao or deepseek or another AI, then 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

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 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 Nodejs version must be 18 or higher.

If your version is lower than this, you can ask the AI how to upgrade your Nodejs 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 Gemini CLI

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

Install claude code via a domestic mirror source
1npm install -g @google/gemini-cli --registry=https://registry.npmmirror.com/
WeCom Screenshot_17693375921491

If you encounter a message that running scripts is disabled 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 it as administrator) and execute:

Don’t forget to replace the API KEY

bash
1# Create ~/.gemini directory (no error if it already exists)
2mkdir "$env:USERPROFILE\.gemini" -Force | Out-Null
3
4# Write .env (UTF-8 without BOM, overwrite)
5$envText = @'
6GEMINI_API_KEY=replace_with_your_API_KEY_here
7GOOGLE_GEMINI_BASE_URL=https://api.aicodewith.com/gemini_cli
8GEMINI_MODEL=gemini-3-pro
9'@
10[System.IO.File]::WriteAllText("$env:USERPROFILE\.gemini\.env", $envText, (New-Object System.Text.UTF8Encoding($false)))
11
12# Write settings.json (UTF-8 without BOM, overwrite)
13$json = @'
14{
15 "ide": {
16 "enabled": true
17 },
18 "security": {
19 "auth": {
20 "selectedType": "gemini-api-key"
21 }
22 }
23}
24'@
25[System.IO.File]::WriteAllText("$env:USERPROFILE\.gemini\settings.json", $json, (New-Object System.Text.UTF8Encoding($false)))

Verify whether the configuration was successful:

bash
1Get-Content "$env:USERPROFILE\.gemini\.env"
2Get-Content "$env:USERPROFILE\.gemini\settings.json"
WeCom screenshot_17693432576436

4. Verify the configuration

In the terminal, type gemini to start it, then in the dialog box, enter: Hello!

Say hello to him. If he replies normally and you can see the invocation record in the platform, it means the configuration was successful.

WeCom Screenshot_1769343147473
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 message shown below, 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 the Gemini CLI

Install using npm:

bash
1npm install -g @google/gemini-cli --registry=https://registry.npmmirror.com/
image

3. Create a configuration file

Open the terminal and run:

Don’t forget to replace the API KEY

bash
1mkdir -p "$HOME/.gemini"
2
3cat > "$HOME/.gemini/.env" << 'EOF'
4GEMINI_API_KEY=Replace_with_your_API_KEY_here
5GOOGLE_GEMINI_BASE_URL=https://api.aicodewith.com/gemini_cli
6GEMINI_MODEL=gemini-3-pro
7EOF
8
9cat > "$HOME/.gemini/settings.json" << 'EOF'
10{
11 "ide": {
12 "enabled": true
13 },
14 "security": {
15 "auth": {
16 "selectedType": "gemini-api-key"
17 }
18 }
19}
20EOF

Verify whether the configuration was successful:

bash
1cat "$HOME/.gemini/.env"
2cat "$HOME/.gemini/settings.json"
image

4. Verify the configuration

In the terminal, type gemini to start it, then in the dialog box, enter: Hello!

Say hello to him. If he responds normally and you can see the invocation record within the platform, it means the configuration was successful.

WeCom_Screenshot_1769343147473
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 the 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 the Gemini CLI

Install using npm:

bash
1npm install -g @google/gemini-cli --registry=https://registry.npmmirror.com/

If it appears as shown in the figure below, the installation was successful.

image

3. Create a configuration file

Open the terminal and run:

Don’t forget to replace the API KEY

bash
1mkdir -p "$HOME/.gemini"
2
3cat > "$HOME/.gemini/.env" << 'EOF'
4GEMINI_API_KEY=Replace_with_your_API_KEY_here
5GOOGLE_GEMINI_BASE_URL=https://api.aicodewith.com/gemini_cli
6GEMINI_MODEL=gemini-3-pro
7EOF
8
9cat > "$HOME/.gemini/settings.json" << 'EOF'
10{
11 "ide": {
12 "enabled": true
13 },
14 "security": {
15 "auth": {
16 "selectedType": "gemini-api-key"
17 }
18 }
19}
20EOF

Verify whether the configuration was successful:

bash
1cat "$HOME/.gemini/.env"
2cat "$HOME/.gemini/settings.json"
image

4. Verify the configuration

In the terminal, type gemini to start it, then in the dialog box, enter: Hello!

Say hello to him. If he responds normally and you can see the invocation record in the platform, it means the configuration was successful.

WeCom screenshot_1769343147473
image

On this page