> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kuajieaigc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Gemini CLI 常见问题

> Gemini CLI 常见问题解答

> Gemini CLI 常见问题解答

## 安装与更新

> **命令未找到**
>
> **macOS Homebrew 安装**
>
> ```bash theme={null} theme={null}
> brew install gemini-cli
> ```
>
> **NPM 安装**
>
> 确保 npm 全局路径已添加到 PATH
>
> ```bash theme={null} theme={null}
> npm config get prefix
> # 添加到 PATH
> echo 'export PATH="$HOME/.npm-global/bin:$PATH"' >> ~/.zshrc
> source ~/.zshrc
> ```

> **如何更新 Gemini CLI**
>
> **Homebrew**
>
> ```bash theme={null} theme={null}
> brew upgrade gemini-cli
> ```
>
> **NPM**
>
> ```bash theme={null} theme={null}
> npm install -g @google/gemini-cli
> ```

> **安装失败**
>
> **排查步骤**
>
> 1. 检查网络连接
> 2. 确保 Node.js 18+ 已安装（NPM 方式）
> 3. 确保有管理员权限（Windows）或使用 sudo（macOS/Linux）
> 4. 使用镜像源（npm 可使用 `--registry` 参数）

## 配置问题

> **配置文件在哪里**
>
> * **macOS/Linux**: `~/.gemini/`
> * **Windows**: `C:\Users\你的用户名\.gemini\`
>
> 只需要一个文件：`.env`

> **请求地址配置**
>
> Gemini CLI 请求地址**不包含** `/v1` 路径
>
> ```env theme={null} theme={null}
> GOOGLE_GEMINI_BASE_URL=https://api.kuajieaigc.com
> ```

> **.env 文件格式**
>
> 正确的 `.env` 文件格式
>
> ```env theme={null} theme={null}
> GOOGLE_GEMINI_BASE_URL=https://api.kuajieaigc.com
> GEMINI_API_KEY=your-api-key-here
> GEMINI_MODEL=your-gemini-model-id
> ```
>
> > [!WARNING]
> >
> > 不要使用引号包裹值

> **API 连接失败**
>
> 检查配置文件
>
> ```bash theme={null} theme={null}
> cat ~/.gemini/.env
> # 测试网络连接
> curl -I https://api.kuajieaigc.com
> ```
>
> 确认 `.env` 文件中的配置正确。网络不稳定时，可以将 `GOOGLE_GEMINI_BASE_URL` 确认使用 `https://api.kuajieaigc.com`

## 使用问题

> **如何测试配置是否成功**
>
> 启动 Gemini CLI 后，发送测试消息
>
> ```bash theme={null} theme={null}
> gemini
> ```
>
> 在对话界面输入：
>
> ```
> 你好，请帮我创建一个 Python 的 hello world 程序
> ```
>
> 如果正常响应，说明配置成功

> **Gemini CLI 使用建议**
>
> **现状说明**
>
> Gemini CLI 目前存在一些使用问题，例如可能无法正常调用模型、无法粘贴图片
>
> **推荐方式**
>
> * 将 Gemini CLI 更新到最新版本后再试
>
> * 优先使用第三方 VS Code 插件（如 Cline）
>
> > [!WARNING]
> >
> > 如遇到问题，可以考虑使用其他编辑器插件替代 Gemini CLI

## 错误排查

> **API Key 无效**
>
> * 确认 API Key 已正确复制（无多余空格）
> * 检查密钥是否在有效期内
> * 验证账户权限是否正常
> * Gemini CLI 使用 `https://api.kuajieaigc.com`（无 `/v1`）

## 其他问题

> **[跨界AI官网](https://www.kuajieaigc.com)**
>
> 如果以上方法无法解决问题，请联系技术支持


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.