Gemini
您需要一个 Gemini API 密钥。
首先,安装 aider:
python -m pip install aider-install
aider-install
然后配置您的 API 密钥:
export GEMINI_API_KEY=<key> # Mac/Linux
setx GEMINI_API_KEY <key> # Windows,执行 setx 后需重启 shell
开始在您的代码库中使用 aider 和 Gemini:
# 切换到您的代码库目录
cd /to/your/project
# 可以使用以下快捷方式运行 Gemini 2.5 Pro 模型:
aider --model gemini
# 可以免费运行 Gemini 2.5 Pro Exp,但有使用限制:
aider --model gemini-exp
# 列出 Gemini 提供的可用模型
aider --list-models gemini/
您可能需要安装 google-generativeai
包。
# 如果使用 aider-install 或 `uv tool` 安装
uv tool run --from aider-chat pip install google-generativeai
# 或者使用 pipx...
pipx inject aider-chat google-generativeai
# 或者使用 pip
pip install -U google-generativeai