TL;DR
- Google's official Gemini CLI has ~1 second Node.js startup overhead
- I rewrote it in Go → startup is now 0.01 seconds (68x faster)
- Reuses auth from official CLI, so your free tier / Workspace quota just works
https://github.com/tomohiro-owada/gmn
Why I Built This
Google's official Gemini CLI is an amazing tool. Rich TUI, seamless Google authentication, excellent MCP support. I loved using it.
But there was one issue for my use case: startup time.
$ time gemini --version
0.22.2
gemini --version 1.00s user 0.24s system 129% cpu 0.951 total
~1 second just to start. That's the Node.js runtime overhead. Fine for interactive use, but painful when you're calling it repeatedly in shell scripts.
The Solution: gmn
So I rewrote the core functionality in Go. The result is gmn (short for gemini-mini):
$ time gmn --version
gmn version 0.2.0
gmn --version 0.00s user 0.00s system 47% cpu 0.014 total
0.014 seconds. 68x faster.
Benchmarks
| Metric | gmn | Official CLI | Improvement |
|---|---|---|---|
| Startup | 0.01s | 0.95s | 68x |
| Binary | 5.6MB | ~200MB | 35x |
| Runtime | None | Node.js | - |
With API response time included:
$ time gmn "hi"
Hello! How can I help you today?
gmn "hi" 0.01s user 0.02s system 0% cpu 3.205 total
$ time gemini -p "hi"
I'm ready to help. What would you like to do?
gemini -p "hi" 2.13s user 0.53s system 24% cpu 10.933 total
Installation
Prerequisites (Important!)
gmn doesn't have its own authentication. You must authenticate once with the official Gemini CLI first:
npm install -g @google/gemini-cli
gemini # Choose "Login with Google"
gmn reuses credentials from ~/.gemini/. Your free tier quota or Workspace Code Assist quota applies.
Install gmn
Homebrew:
brew install tomohiro-owada/tap/gmn
Go:
go install github.com/tomohiro-owada/gmn@latest
Binary:
Download from Releases
Usage
# Simple prompt
gmn "Explain quantum computing"
# With file context
gmn "Review this code" -f main.go
# Pipe input
cat error.log | gmn "What's wrong?"
# JSON output
gmn "List 3 colors" -o json
# Different model
gmn "Write a poem" -m gemini-2.5-pro
Technical Details
Discovering the API
Initially, I tried using generativelanguage.googleapis.com (the public Gemini API), but got 403 errors due to OAuth scope mismatch.
Reading the official CLI source code, I discovered it actually uses the Code Assist API (cloudcode-pa.googleapis.com). This is an internal Google Cloud API, not publicly documented.
Auth Reuse
The official CLI stores OAuth tokens in ~/.gemini/oauth_creds.json. gmn reads this file and refreshes tokens when needed:
if creds.IsExpired() {
creds, err = authMgr.RefreshToken(creds)
}
MCP Support
gmn also supports MCP (Model Context Protocol). It reads the same ~/.gemini/settings.json config:
gmn mcp list
gmn mcp call my-server tool-name arg=value
What's NOT Included
gmn is focused on non-interactive use cases:
- Interactive/TUI mode → use official CLI
- OAuth flow → authenticate with official CLI first
- API Key / Vertex AI auth
Conclusion
This is a love letter to Google's official Gemini CLI. I just needed something faster for scripting.
If you use Gemini in shell scripts or automation, give gmn a try:
brew install tomohiro-owada/tap/gmn
gmn "Hello, World!"
https://github.com/tomohiro-owada/gmn
Acknowledgments
- Google Gemini CLI — The incredible original
- Google Gemini API — The underlying API
Top comments (0)