ask-gemini
CLI tool to chat with Gemini's web interface from the terminal. No API key needed — uses your browser cookies.
For agents: See SKILL.md for agent usage patterns and best practices. Quick install:
pip install ask-gemini(PyPI) or download from GitHub Releases.
Setup
Option A: Install via pip (recommended)
pip install ask-gemini
Available on PyPI.
Option B: Download standalone executable
Download the latest macOS executable from GitHub Releases:
# Download from the latest release asset at https://github.com/Guitenbay/ask-gemini/releases
chmod +x ask-gemini
./ask-gemini "Hello!"
No Python installation required.
Option C: Build from source
git clone https://github.com/Guitenbay/ask-gemini.git
cd ask-gemini
pip install pyinstaller
bash build.sh
The executable is at dist/ask-gemini (~21MB). Or install as a Python package:
pip install -e .
Configure cookies
Option A: Auto-detect from browser
If you're logged into Gemini in Chrome or Edge, ask-gemini will auto-detect your cookies. Just run:
ask-gemini "Hello!"
Option B: Manual setup
ask-gemini --cookie-setup
Follow the instructions to copy __Secure-1PSID and __Secure-1PSIDTS from your browser, then save them in a .env file.
Usage
Single question
ask-gemini "What is Python?"
ask-gemini --model gemini-3-flash "Explain async/await"
ask-gemini --no-stream "Write a haiku about coding"
Chat mode
Enter an interactive conversation that resumes your latest web-side chat:
ask-gemini --chat
This automatically picks up where you left off on gemini.google.com. Type your message, and Gemini responds. Useful commands while in chat:
| Command | Action |
|---|---|
exit / quit |
Leave chat mode |
new |
Start a fresh conversation |
clear |
Same as new |
To always start a fresh conversation instead of resuming:
ask-gemini --chat --new-chat
Chat mode internals
- The same
cid(conversation ID) is used as the web interface, so history is shared between CLI and browser - Multiple CLI sessions in a row will keep using the same web conversation
- Switching models in an existing chat starts a new session on the web side
Named sessions
Create isolated conversations that don't interfere with each other. Perfect for multiple agents working on different tasks:
# Create or resume a named session
ask-gemini --session code-review "Analyze this code: $(cat app.py)"
# Follow-up — Gemini remembers the code review context
ask-gemini --session code-review "Now rewrite it with better error handling"
# A completely separate session
ask-gemini --session data-analysis "What is SQL?"
Manage your sessions:
ask-gemini --sessions # List all saved sessions
ask-gemini --rm-session code-review # Delete a session
Sessions are stored in ~/.ask-gemini/sessions.json and map directly to conversations on gemini.google.com.
Options
| Option | Description |
|---|---|
-m, --model |
Model to use (default: gemini-3-pro) |
-s, --stream |
Stream output as it arrives (default) |
--no-stream |
Wait for full response before printing |
--chat |
Enter interactive chat mode (resumes web conversation) |
--new-chat |
Start a fresh conversation instead of resuming |
--session <name> |
Use a named, isolated conversation session |
--sessions |
List all saved named sessions |
--rm-session <name> |
Delete a named session |
--no-rate-limit |
Disable human-like typing/cooldown delays |
--cookie-setup |
Print cookie setup instructions |
--version |
Print version |
Available Models
| Model | Description |
|---|---|
gemini-3-pro |
Most capable (default) |
gemini-3-flash |
Fast |
gemini-3-flash-thinking |
Flash with chain-of-thought |
Configuration
All configuration via environment variables in .env (project root or ~/.ask-gemini/.env):
| Variable | Description | Default |
|---|---|---|
GEMINI_PSID |
__Secure-1PSID cookie |
(auto-detect from browser) |
GEMINI_PSIDTS |
__Secure-1PSIDTS cookie |
(auto-detect from browser) |
PROXY_URL |
HTTP proxy URL | (empty) |
MODEL |
Default model | gemini-3-pro |
Rate limiting
By default, ask-gemini simulates human typing speed to avoid triggering Google's risk control:
- Typing delay:
message_length × TYPING_SPEEDseconds, clamped betweenMIN_DELAYandMAX_DELAY - Cooldown:
COOLDOWNseconds after receiving a response before the next request - Jitter: +/- 20% random variation so delays aren't perfectly uniform
Configure in .env:
| Variable | Description | Default |
|---|---|---|
RATE_LIMIT |
Enable/disable rate limiting (1 or 0) |
1 |
TYPING_SPEED |
Seconds per character (≈ 20 chars/sec) | 0.05 |
MIN_DELAY |
Minimum delay before sending (seconds) | 1.0 |
MAX_DELAY |
Maximum delay cap (seconds) | 5.0 |
COOLDOWN |
Seconds to wait after receiving a response | 2.0 |
Or disable per-call with --no-rate-limit.
Notes
- Uses the free Gemini web interface, not the paid API.
- Cookies expire. If requests fail, refresh Gemini in your browser or update cookies manually.
- Automated access may violate Google's Terms of Service. Use at your own risk.
Metadata
Release files for ask-gemini 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ask_gemini-0.2.1.tar.gz | 17.2 kB | Without provenance | Details for ask_gemini-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ask_gemini-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for ask_gemini-0.2.1-py3-none-any.whl |
Total release size: 29.5 kB
Release files / ask_gemini-0.2.1.tar.gz
| Download URL | ask_gemini-0.2.1.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5807decb108f36ccedb79784af9897fc1a7c5fc67c65b68ecd4ab6037ee80810
|
|
BLAKE2b-256 checksum How to use checksums |
a906d8cb4ec4319dc6f8f1ed4e5e3551db50c8eb7fd108e80b2305bd37945c30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / ask_gemini-0.2.1-py3-none-any.whl
| Download URL | ask_gemini-0.2.1-py3-none-any.whl |
|---|---|
| Size | 12.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b9477e960b74a604e9162b53d41d9a1aa0a4c575cd3cab8fcf6f28b6672cbca
|
|
BLAKE2b-256 checksum How to use checksums |
422aca2aeef818f48546f881bfeb3de2994767d4662c85b20d4641b041dfeead
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Security for ask-gemini 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.