Skip to content

Repository files navigation

Gemini Legacy TUI

A lightweight terminal UI for the Gemini Flash catalog you chose, plus the single PaLM chat candidate chat-bison-001.

It intentionally excludes every Pro model, every Flash-Lite model, text-bison, and the moving chat-bison alias. It does not provide LaMDA because Google never exposed LaMDA as a public API model.

Run it on macOS or Linux

Python 3.9+ is enough; no package installation is needed. If the repository is in your Downloads folder, run:

cd ~/Downloads/terminal-chatbot
GEMINI_API_KEY="your-key" python3 gemini_legacy_tui.py

If you extracted a ZIP named terminal-chatbot-main, use that folder name instead. You can run the same commands from any other location by changing the first line.

You can also start it without an environment variable and press F4 to enter a key for that process only:

python3 gemini_legacy_tui.py

Run it on Windows

Use Python 3.9+ in Windows Terminal or PowerShell. The launcher installs the small windows-curses compatibility package automatically when it is missing:

cd "$HOME\Downloads\terminal-chatbot"
.\run_windows.bat

If you extracted a ZIP named terminal-chatbot-main, use that folder name instead. You can also install and run it manually:

py -m pip install -r requirements.txt
$env:GEMINI_API_KEY = "your-key"
py .\gemini_legacy_tui.py

The API key is optional at launch on every platform; press F4 inside the app to enter it for the current process. See WINDOWS.md for Windows troubleshooting and controls.

To load a key from a private file, use python3 gemini_legacy_tui.py --api-key-file PATH. The app sends API keys in Google's x-goog-api-key header, never places them in request URLs, and does not accept secrets as command-line values where process listings could expose them.

The app saves its transcript, chosen model, and system instruction in ./.gemini-legacy-tui/session.json with private file permissions where the operating system supports them. It repairs malformed session fields when possible, refuses symlinked or oversized session files, and never writes an API key to disk. Supply another location with --state-dir PATH.

Controls

Control Action
F1 or /help Help
Tab Main menu
/ Searchable slash-command menu
Up / Down or Page Up / Page Down Scroll through the reflowed transcript
F6 Open the complete transcript reader
Ctrl+P / Ctrl+O Recall previous / next submitted prompt
/model Searchable model picker
/settings Streaming toggle, theme picker, system instruction, API key, and availability check
/transcript Open the complete transcript reader with Up/Down scrolling
/clear Clear the shared conversation context
/retry Retry the most recent failed prompt
/restart or /reopen Close and reopen the TUI without rerunning the shell command
/models Show the built-in catalog
/quit Exit

Model catalog

Main Flash models:

gemini-3.6-flash
gemini-3.5-flash
gemini-3-flash-preview
gemini-2.5-flash
gemini-flash-latest

Legacy Flash candidates:

gemini-1.5-flash
gemini-1.5-flash-001
gemini-1.5-flash-002
gemini-2.0-flash
gemini-2.0-flash-001
gemini-2.0-flash-exp

PaLM chat candidate:

chat-bison-001

The availability check is deliberately advisory: it uses the current models.list endpoint, while the PaLM entry uses its original legacy chat endpoint. Google retired the PaLM API and has also shut down some older Gemini Flash versions, so receiving a 404, 403, or “not found” message for those entries is expected for most current API keys.

API behavior

Gemini entries stream by default through v1beta/models/{model}:streamGenerateContent; toggle Streaming off in Settings to use the non-streaming generateContent endpoint instead. chat-bison-001 uses the old PaLM v1beta3/models/chat-bison-001:generateMessage request shape. Keeping those code paths separate is important: PaLM Chat was a conversational API and does not accept the modern Gemini contents schema.

Settings includes persistent terminal themes: Midnight Cyan, Matrix Green, Amber CRT, Arctic Blue, and Neon Noir. Matrix Green uses green text on a black background. Settings also accepts a custom Gemini model ID. Custom IDs use the modern Gemini API and appear on replies exactly as entered. Terminal controls font size rather than the TUI. macOS Terminal uses Command-Plus and Command-Minus and may resize its window while zooming; Windows Terminal uses Ctrl-Plus and Ctrl-Minus. A curses app cannot override the terminal application's font behavior.

New sessions include an editable system instruction that tells models they are responding inside a terminal, to use plain text without Markdown emphasis or visual styling, and that blank lines between blocks are acceptable. Open Settings or run /system to view or change it.

The transcript is shared when you switch Gemini models, so the selected model sees the prior conversation. Each assistant reply is tagged with the model that generated it. Use Ctrl+N, /new, or /clear to start without that context.

For macOS Terminal Command-key equivalents, see MACOS_TERMINAL_SHORTCUTS.md.

Sources: Google Gemini models, Gemini model deprecations, and Generative Language API models reference.

About

Access your Gemini API through the terminal.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages