Make Gemini CLI usage last longer
Gemini CLI has built-in commands to see token use and shrink context. Token caching only applies when you use an API key or Vertex AI. Each tip below cites the official doc it comes from (read 2026-10-21). We don't estimate how much each one saves; vendors don't publish that.
See token counts and quota
/stats model shows model-specific usage, including token counts and quota information.
/stats model
github.com checked 2026-10-21
Compress long sessions
/compress replaces the whole chat context with a summary, which the docs say saves tokens for future tasks.
/compress
github.com checked 2026-10-21
Clear between tasks
/clear clears the conversation context and starts a new session. Ctrl+L only clears the screen and keeps the context.
/clear
github.com checked 2026-10-21
Reference directories, not every file
@ with a directory passes the path so the model can inspect it with tools, without eagerly reading every nested file. Git-ignored files are excluded by default.
@src/my_project/ Summarize the code in this directory.
github.com checked 2026-10-21
Use an API key to get token caching
Token caching reuses system instructions and context on API key (Gemini API or Vertex AI) auth. It is not available for OAuth (Google account) users. /stats shows cached-token savings.
export GEMINI_API_KEY=... /stats
github.com checked 2026-10-21