Gemini CLI
Gemini CLI is Google's command-line tool for interacting with Gemini models. Squeezr supports the Gemini API format including the /v1beta/models/* endpoint structure.
Setup
Run squeezr setup first. It automatically sets GEMINI_API_BASE_URL=http://localhost:8080 in your environment. Then start the proxy:
squeezr setup # one-time
squeezr startGemini CLI reads GEMINI_API_BASE_URL automatically. Your existing GEMINI_API_KEY is forwarded to the Google API transparently.
API format
Squeezr handles the Gemini API endpoints:
POST /v1beta/models/gemini-2.0-flash:generateContent
POST /v1beta/models/gemini-2.0-flash:streamGenerateContentThe proxy parses the Gemini content structure (parts array with text, functionCall, and functionResponse types) and applies compression to the appropriate parts.
API key handling
Squeezr handles both Gemini authentication methods transparently:
- Header-based:
x-goog-api-keyheader is forwarded as-is. - Query parameter:
?key=...is detected, stripped from the proxied URL, and reattached when forwarding to the Google API.
What gets compressed
In the Gemini format, tool results are sent as functionResponse parts. Squeezr compresses the response field of these parts:
- File read results are deduplicated across turns.
- Shell command output is pattern-matched and compressed.
- Large text blocks are summarized while preserving errors and key info.
Streaming support
When Gemini CLI uses the streamGenerateContent endpoint, Squeezr compresses the request and streams the response back without buffering. Server-sent events (SSE) are proxied in real-time.