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 listShow 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 resetReset all settings to default values
gemini config exportExport 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_KEYmodel
Default model to use
gemini-proExample:
gemini config set model gemini-protemperature
Creativity level (0.0 to 1.0)
0.7Example:
gemini config set temperature 0.7max-tokens
Maximum response length
2048Example:
gemini config set max-tokens 2048Interface Settings
Customize the CLI appearance and behavior
theme
Color theme for the CLI
autoExample:
gemini config set theme darkoutput-format
Default output format
textExample:
gemini config set output-format markdownstream
Enable streaming responses
trueExample:
gemini config set stream truehistory-limit
Number of conversation turns to remember
10Example:
gemini config set history-limit 20Tools & Extensions
Configure tools and plugin settings
tools-enabled
Enable tool usage
trueExample:
gemini config set tools-enabled truetool-timeout
Tool execution timeout (seconds)
30Example:
gemini config set tool-timeout 30plugins-dir
Directory for custom plugins
~/.gemini/pluginsExample:
gemini config set plugins-dir ~/.gemini/pluginsSecurity Settings
Security and privacy configurations
safe-mode
Enable safe mode for tool execution
trueExample:
gemini config set safe-mode truelog-level
Logging verbosity level
infoExample:
gemini config set log-level infodata-collection
Allow anonymous usage data collection
falseExample:
gemini config set data-collection falseEnvironment Variables
Alternative configuration using environment variables
Common Environment Variables
GEMINI_API_KEY=your_api_keyAPI key for authentication
GEMINI_MODEL=gemini-proDefault model to use
GEMINI_CONFIG_DIR=~/.config/geminiConfiguration directory
Setting Environment Variables
Bash/Zsh:
export GEMINI_API_KEY=your_keyPowerShell:
$env:GEMINI_API_KEY="your_key".env file:
GEMINI_API_KEY=your_keyConfiguration Files
Understanding configuration file locations and formats
File Locations
Global Config:
~/.config/gemini/config.jsonProject Config:
.gemini/config.jsonEnvironment File:
.envExample 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