npm install -g @anthropic-ai/gemini-cli
# 或
npx https://github.com/anthropics/anthropic-quickstarts/tree/main/gemini-cli
⚠️ 请以 官方文档 为准
首次运行会引导 Google 账号登录。
| 参数 | 说明 | 示例 |
|---|---|---|
-m, --model |
指定模型 | -m gemini-2.5-flash |
--output-format |
输出格式 (text/json) | --output-format text |
--allowed-tools |
允许的工具 | --allowed-tools '' (禁用所有) |
--yolo |
YOLO 模式,跳过所有确认 | --yolo |
--sandbox |
沙箱模式 | --sandbox |
gemini-2.5-flash - 快速模型gemini-2.5-pro - 高级模型gemini-3.0-pro - 最新模型# 基础无头调用
cat input.txt | gemini -m gemini-2.5-flash --output-format text "Your prompt"
# 禁用工具调用(纯文本输出)
cat input.txt | gemini -m gemini-2.5-flash --output-format text --allowed-tools '' "Your prompt"
# YOLO 模式(跳过所有确认)
gemini --yolo "Your prompt"
export http_proxy=http://127.0.0.1:9910
export https_proxy=http://127.0.0.1:9910
--allowed-tools '' 跳过timeout 命令包装2>/dev/null