2.4 KiB
2.4 KiB
Here's the English translation of the provided Markdown document:
Gemini CLI Parameter Reference
Source: Official Documentation
Installation
npm install -g @anthropic-ai/gemini-cli
Authentication
The first run will guide you through Google account login, or you can set environment variables:
export GEMINI_API_KEY="YOUR_API_KEY"
Core Command Line Parameters
| Parameter | Description | Example |
|---|---|---|
--model <model> |
Specify model | --model gemini-2.5-flash |
--yolo |
YOLO mode, automatically approve all tool calls | gemini --yolo |
--approval-mode <mode> |
Approval mode: default/auto_edit/yolo |
--approval-mode auto_edit |
--allowed-tools <tools> |
List of allowed tools (comma separated) | --allowed-tools '' (disable all) |
--output-format <format> |
Output format: text/json/stream-json |
--output-format text |
--sandbox / -s |
Enable sandbox mode | gemini -s |
--prompt <prompt> / -p |
Non-interactive mode, pass prompt directly | gemini -p "query" |
--prompt-interactive <prompt> / -i |
Interactive mode with initial prompt | gemini -i "explain" |
--debug / -d |
Enable debug mode | gemini -d |
Available Models
gemini-2.5-flash- Fast modelgemini-2.5-pro- Advanced modelgemini-3-flash-preview- Latest Flashgemini-3-pro-preview- Latest Pro
Headless Mode Usage
# Basic headless call (piped input)
cat input.txt | gemini -p "Your prompt" --output-format text
# Disable tool calls (plain text output)
cat input.txt | gemini -p "Your prompt" --output-format text --allowed-tools ''
# YOLO mode (skip all confirmations)
gemini --yolo "Your prompt"
# Or use approval-mode
gemini --approval-mode yolo "Your prompt"
Configuration File
Configuration is stored in ~/.gemini/settings.json or project .gemini/settings.json:
{
"security": {
"disableYoloMode": false
},
"model": {
"name": "gemini-2.5-flash"
}
}
Proxy Configuration
export http_proxy=http://127.0.0.1:9910
export https_proxy=http://127.0.0.1:9910
Frequently Asked Questions
- MCP initialization is slow: Use
--allowed-tools ''to skip. - Timeout: Use the
timeoutcommand wrapper. - Output includes logs: Redirect stderr
2>/dev/null.