Gemini CLI is a command-line tool to interact with Google's Gemini models via their REST API.
It supports plain and pretty markdown output, customizable model selection, and flexible prompt input via arguments or piped stdin.
- Send prompts to Gemini models using the Google Generative Language API.
- Output responses as plain text or pretty markdown (rendered via glow if installed).
- Choose model and request timeout via CLI flags.
- Accept prompt as CLI arguments or from piped stdin.
# Basic usage with prompt as arguments
gemini your prompt here
# Pretty markdown output (requires glow)
gemini -l your prompt here
# Specify model and timeout
gemini -m gemini-2.5-pro -l --timeout 30 your prompt here
# Pipe prompt from stdin
echo "What is Rust?" | gemini-
Clone the repository:
sh git clone https://github.com/yourusername/gemini-cli.git cd gemini-cli -
Set your Gemini API key:
sh export GEMINI_API_KEY=your_api_key_here -
Build the project:
sh cargo build --release -
(Optional) Install glow for pretty markdown rendering.
-l,--long— Pretty markdown output (opens via glow if available)-m,--model— Model name (default: gemini-2.5-flash)--timeout— Request timeout in seconds (default: 60)- prompt — Everything after
geminiis treated as the prompt. If omitted, reads from STDIN.
sh gemini -l -m gemini-2.5-pro "Explain ownership in Rust"
MIT