Private
Public Access
1
0
Files
xcodecli-shells/docs/guide/gemini-cli.md
sususu98 b07c61aa9d
All checks were successful
Deploy to Cloudflare Pages / deploy (push) Successful in 41s
fix: 将 iwr|iex 替换为 iex(irm) 修复中文乱码
iwr -useb URL | iex 管道传递 response 对象时,
ToString() 转换会丢失 Unicode 中文字符。
改用 irm (Invoke-RestMethod) 直接返回字符串内容,
避免对象到字符串的管道转换损坏。
2026-02-28 17:00:45 +08:00

44 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Gemini CLI 配置指南
Gemini CLI 是 Google 的 AI 命令行工具。通过 XCodeCLI你可以无缝切换到自定义 API 源。
## 快速安装与配置
使用下面的单一行命令即可自动完成安装和配置。
::: code-group
```bash [macOS / Linux]
API_KEY='你的密钥' bash -c "$(curl -fsSL https://gitea.sususu.cf/sususu/xcodecli-shells/raw/branch/main/GeminiCLI/setup-gemini.sh)"
```
```powershell [Windows]
$key='你的密钥'; iex (irm https://gitea.sususu.cf/sususu/xcodecli-shells/raw/branch/main/GeminiCLI/setup-gemini.ps1)
```
:::
> 请将命令中的 `你的密钥` 替换为你的实际 API 密钥。
::: warning ⚠️ 配置完成后请重启终端
脚本会自动配置环境变量,但需要**重启终端**才能生效。
- **macOS / Linux**:重新打开终端,或执行 `source ~/.zshrc`(或 `source ~/.bashrc`
- **Windows**:重新打开 PowerShell 窗口
:::
## 手动配置说明
Gemini CLI 通常使用环境变量或 `.env` 文件进行配置。XCodeCLI 脚本配置的位置通常为 `~/.gemini/.env`。
关键环境变量:
```env
GEMINI_API_KEY=sk-your-key-here
GEMINI_API_BASE=https://api2.xcodecli.com
```
## 使用技巧
- 使用 `gemini` 开始对话。
- 确保你的网络环境可以连接到配置的 API 端点。