AI client Tools

Upgrade NodeJs and install GeminiCli

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

# install nvm

sudo curl -o- https://gitee.com/mirrors/nvm/raw/v0.39.1/install.sh | bash


# pick stable nodejs

nvm list-remote --lts

nvm install v20.20.0

nvm use v20.20.0

# 缺少sys lib
user@Dhost:/mnt/d/Git/mypages$ node -v
node: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by node)

wsl 1-> 2尝试

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

$ wsl --list --verbose
NAME STATE VERSION
* Ubuntu Running 1

wsl --set-default-version 2

wsl --set-version Ubuntu 2

C:\WINDOWS\system32>wsl --install -d Ubuntu-22.04
正在启动 Ubuntu 22.04 LTS...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: ubuntu2204

# rerun all nvm commands and works

安装gemini-cli

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

# WSL2中使用Gemini CLI写代码的步骤说明

# 1. 安装Node.js和npm(如果尚未安装)
# sudo apt update
# sudo apt install nodejs npm

# 2. 全局安装Gemini CLI
npm install -g @google/gemini-cli

# 3. 设置API密钥(需要先在Google AI Studio获取)
setx GEMINI_API_KEY=xxxxx

# 注入代理
set https_proxy=http://127.0.0.1:10809
set GEMINI_API_KEY=AIzaSyCwOMos4b8nF31yqDSLZUlvaBKJb_bFt_w
set GOOGLE_GEMINI_BASE_URL=
set GEMINI_MODEL=
# set all_proxy=socks5://127.0.0.1:10808

curl https://ipinfo.io

# proxy open api

set GOOGLE_GEMINI_BASE_URL=https://llm.xiaochisaas.com
set GEMINI_API_KEY=sk-
set GEMINI_MODEL=gemini-3-flash

# 如果需要wsl2访问win32代理,请替换 `-InterfaceAlias` 值为你上一步查到的网卡名称, `-LocalPort` 为你的代理端口(如10809)
New-NetFirewallRule -DisplayName "WSL2 Proxy Access (Restricted)" -Direction Inbound -LocalPort 10809 -Protocol TCP -Action Allow -InterfaceAlias "vEthernet (WSL)"

# 测试代理IP Win32

curl --socks5-hostname 127.0.0.1:10808 https://ipinfo.io

curl -x 127.0.0.1:10809 https://ipinfo.io
curl -x 172.22.224.1:10809 https://ipinfo.io

# 4. 启动Gemini CLI
gemini

# 5. 在CLI中输入自然语言指令,例如:
# "用Python写一个快速排序算法"

# 6. 根据Gemini的代码建议进行选择和修改

gemini query "test"

# Gemini API (with an unpaid API Key): You generally have 250 model requests per day and 10 model requests per minute, limited to the Flash model.

claude

linux 环境中的nat模式不支持win宿主机代理,只能通过api gateway付费代理。

1
2
3
4
5
6
7
8
9
10
11
12
13

npm install -g @anthropic-ai/claude-code
# 设置自定义 API 地址 (关键步骤)
export ANTHROPIC_BASE_URL="https://llm.xiaochisaas.com" # 例如: https://openrouter.ai/api/v1

# 设置该服务要求的认证令牌
export ANTHROPIC_AUTH_TOKEN="sk-xxx"

# (可选) 指定要使用的模型名称
export ANTHROPIC_MODEL="gpt-5" # 或 openai/gpt-5-mini 等 [citation:4][citation:7]

# 然后正常启动 Claude Code
claude