Configuration Guide
Customize Gemini CLI to fit your workflow with comprehensive configuration options for API settings, interface preferences, and security controls.
Configuration Commands
Essential commands for managing your configuration
gemini config list
Show all current configuration settings
gemini config get <key>
Get the value of a specific setting
gemini config set <key> <value>
Set a configuration value
gemini config unset <key>
Remove a configuration setting (revert to default)
gemini config reset
Reset all settings to default values
gemini config export
Export configuration to a file
gemini config import <file>
Import configuration from a file
Configuration Options
Detailed settings organized by category
API Configuration
Configure API keys and model settings
api-key
RequiredYour Google AI API key
Example:
gemini config set api-key YOUR_API_KEY
model
Default model to use
gemini-pro
Example:
gemini config set model gemini-pro
temperature
Creativity level (0.0 to 1.0)
0.7
Example:
gemini config set temperature 0.7
max-tokens
Maximum response length
2048
Example:
gemini config set max-tokens 2048
Interface Settings
Customize the CLI appearance and behavior
theme
Color theme for the CLI
auto
Example:
gemini config set theme dark
output-format
Default output format
text
Example:
gemini config set output-format markdown
stream
Enable streaming responses
true
Example:
gemini config set stream true
history-limit
Number of conversation turns to remember
10
Example:
gemini config set history-limit 20
Tools & Extensions
Configure tools and plugin settings
tools-enabled
Enable tool usage
true
Example:
gemini config set tools-enabled true
tool-timeout
Tool execution timeout (seconds)
30
Example:
gemini config set tool-timeout 30
plugins-dir
Directory for custom plugins
~/.gemini/plugins
Example:
gemini config set plugins-dir ~/.gemini/plugins
Security Settings
Security and privacy configurations
safe-mode
Enable safe mode for tool execution
true
Example:
gemini config set safe-mode true
log-level
Logging verbosity level
info
Example:
gemini config set log-level info
data-collection
Allow anonymous usage data collection
false
Example:
gemini config set data-collection false
Environment Variables
Alternative configuration using environment variables
Common Environment Variables
GEMINI_API_KEY=your_api_key
API key for authentication
GEMINI_MODEL=gemini-pro
Default model to use
GEMINI_CONFIG_DIR=~/.config/gemini
Configuration directory
Setting Environment Variables
Bash/Zsh:
export GEMINI_API_KEY=your_key
PowerShell:
$env:GEMINI_API_KEY="your_key"
.env file:
GEMINI_API_KEY=your_key
Configuration Files
Understanding configuration file locations and formats
File Locations
Global Config:
~/.config/gemini/config.json
Project Config:
.gemini/config.json
Environment File:
.env
Example Config File
{
"api-key": "your_api_key",
"model": "gemini-pro",
"temperature": 0.7,
"max-tokens": 2048,
"theme": "dark",
"stream": true,
"tools-enabled": true,
"safe-mode": true
}
Best Practices
Recommendations for secure and effective configuration
Security
- β’ Never commit API keys to version control
- β’ Use environment variables for sensitive data
- β’ Enable safe mode for tool execution
- β’ Regularly rotate your API keys
- β’ Review and limit tool permissions
Performance
- β’ Adjust temperature based on use case
- β’ Set appropriate token limits
- β’ Enable streaming for better UX
- β’ Configure reasonable timeouts
- β’ Limit conversation history size
Related Resources
Explore more configuration and setup guides