A command-line interface (CLI) application to interact with Google's Gemini models. You can use it for single queries, queries with file context, or to start an interactive chat session.
This tool uses bat to provide nicely formatted Markdown output directly in your terminal.
-
Google Gemini API Key:
- You need an API key from Google AI Studio to use this application.
- You can obtain one here: https://aistudio.google.com/
-
batInstallation:batis used to display the model's responses with syntax highlighting and Markdown formatting in the terminal.- Installation instructions for
batcan be found here: https://github.com/sharkdp/bat - For example, on macOS with Homebrew:
brew install bat - On Debian/Ubuntu:
sudo apt install bat(the command might bebatcat)
- Clone the Repository (if you haven't already)
- Get your api key for using Google AI Studio.
- Build the dart program via
dart compile exe bin/chatbot_cli.dart -o chatbot.exe --target-os macos --define=API_KEY={YOUR_API_KEY} --define=TMP_FILE_PATH={PATH_TO_DIRECTORY_TO_SAVE_RESPONSES} - NOTE: Adjust the target os you're running on
- Then you can simply run the executable
-i, --input <prompt>: (Mandatory) The input prompt or your initial message to the model.-f, --file <path/to/file>: (Optional) Specify a path to a file to include as context for your query. This is not supported in chat mode (-c).-d, --delete: (Optional) Model responses are temporarily saved to a file forbatto process. Use this flag if you want this temporary file to be deleted after the run. By default, temporary files are kept.-c, --chat: (Optional) Start an interactive chat session with the model. If this flag is used, the-f(file) flag is not supported.
-
Single Query:
chatbot_cli.exe -i "What is the capital of France?" -
Single Query and Delete Temporary File:
chatbot_cli.exe -i "Explain quantum entanglement in simple terms." -d -
Query with a File as Context: (Ensure
my_document.txtexists)chatbot_cli.exe -i "Summarize this document for me" -f "path/to/my_document.txt"
-
Start an Interactive Chat Session:
chatbot_cli.exe -i "Hello, let's talk about space exploration." -cAfter the initial response, you can type your follow-up messages directly into the terminal and press Enter. To stop the chat just exit the program.
- You provide a prompt (and optionally a file).
- The CLI sends your request to the configured Google Gemini model.
- The model's response (which is requested in Markdown format) is received.
- This response is saved to a temporary Markdown file.
batis then used to display the content of this temporary file in your terminal, providing rich formatting.- The temporary file can be automatically deleted if the
-dflag is used.
- The interactive chat will be able to also include files
- Currently, there is only one supported model
gemini-2.5-flashbut there are more to come - Code cleanup (everything is kinda functional now)
- More options to adjust the model, basically everything that the
google_generative_aipackage allows. Since it is deprecated though it will be also maintained (NOTE See the fork in pubspec.yaml) - Creating files and also saving chat history