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

# Gemini

> Gemini 配置教程

## 环境准备

<Info>
  请先完成 [环境配置](/environment/setup)，确保 Node.js 已正确安装
</Info>

## 安装

<Tabs>
  <Tab title="macOS">
    **方法一：Homebrew（推荐）**

    ```bash theme={null}
    brew install gemini-cli
    ```

    **方法二：NPM**

    ```bash theme={null}
    npm install -g @google/gemini-cli
    ```
  </Tab>

  <Tab title="Windows">
    在终端中运行：

    ```bash theme={null}
    npm install -g @google/gemini-cli
    ```
  </Tab>

  <Tab title="Linux">
    在终端中运行：

    ```bash theme={null}
    npm install -g @google/gemini-cli
    ```
  </Tab>
</Tabs>

## 配置

配置文件位于：

* **macOS/Linux**: `~/.gemini/`
* **Windows**: `C:\Users\你的用户名\.gemini\`

**创建 .env 文件**

```env theme={null}
GOOGLE_GEMINI_BASE_URL=https://code.rayinai.com
GEMINI_API_KEY=your-api-key-here
GEMINI_MODEL=gemini-3-pro-preview
```

<Warning>
  将 `your-api-key-here` 替换为你的 API Key
</Warning>

## 使用

在终端运行 `gemini`，看到对话界面并能正常回复即表示配置完成

```bash theme={null}
gemini
```

<img src="https://mintcdn.com/zller/B4dE7O3I3qDrpqQ7/images/gemini-running.png?fit=max&auto=format&n=B4dE7O3I3qDrpqQ7&q=85&s=60014cbb8f8cc5e719ea5ba9e0f7b19a" alt="Gemini 运行界面" width="2378" height="926" data-path="images/gemini-running.png" />

## 遇到问题

<Card title="Gemini 常见问题" icon="circle-question" href="/gemini/faq">
  查看 Gemini 配置相关的常见问题
</Card>
