A Python CLI application for interacting with Google Gemini and OpenAI (ChatGPT) APIs used for testing vortex tracing agent at https://github.com/flowerinthenight/vortex-agent.git
- Flexible CLI: prompt, context, and chatbot modes
- Supports Gemini (REST or google-generativeai) and OpenAI (ChatGPT)
- Easy switching between backends with flags
- Works on Linux, WSL, and Windows
- Get your Gemini API key from Google AI Studio
- (Optional) Get your OpenAI API key from OpenAI
- Set environment variables:
export GEMINI_API_KEY="your_gemini_api_key_here" export OPENAI_API_KEY="your_openai_api_key_here" # if using ChatGPT # To make permanent, add to ~/.bashrc or ~/.zshrc
- Install dependencies:
- System-wide (no venv):
sudo apt update sudo apt install python3 python3-pip python3-venv python3-requests
- Use a virtual environment:
python3 -m venv .venv source .venv/bin/activate pip install requests openai pip install -q -U google-genai
- System-wide (no venv):
- Get your Gemini API key from Google AI Studio
- (Optional) Get your OpenAI API key from OpenAI
- Set environment variables:
$env:GEMINI_API_KEY="your_gemini_api_key_here" [Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "your_gemini_api_key_here", "User") $env:OPENAI_API_KEY="your_openai_api_key_here" [Environment]::SetEnvironmentVariable("OPENAI_API_KEY", "your_openai_api_key_here", "User")
- Install dependencies:
- System-wide (no venv):
pip install requests openai
- Or, using a virtual environment:
python -m venv .venv .\.venv\Scripts\Activate.ps1 pip install requests openai
- System-wide (no venv):
- (Optional) For Gemini package backend:
pip install -q -U google-genai
--prompt "<your question>": Send a single prompt (default: Gemini)--use-chatgpt: Use OpenAI ChatGPT instead of Gemini--use-genai: Use google-generativeai package for Gemini backend--use-context: Use context.txt and system instruction for advanced summarization (Gemini only)
- Simple Gemini prompt:
python3 main.py --prompt "What is the capital of Philippines?" - Simple ChatGPT prompt:
python3 main.py --use-chatgpt --prompt "What is the capital of Philippines?" - Pipe input:
echo "Explain quantum computing" | python3 main.py
- Use context file (Gemini advanced):
python3 main.py --use-context
- Use google-generativeai backend:
python3 main.py --use-genai --prompt "Summarize this text."
- Start Gemini chatbot:
python3 chat_cli.py
- Start ChatGPT chatbot:
python3 chat_cli.py --use-chatgpt
- Type your message and press Enter. Type
exitorquitto end the session.
- "Summarize the following meeting notes."
- "What are the latest trends in AI?"
- "Write a Python script that reads a CSV file and plots a chart."
- "How do I set up a virtual environment in Python?"
- Linux:
chmod +x test_env_wsl.sh ./test_env_wsl.sh echo "Hello, Gemini!" | python3 main.py echo "Hello, OpenAI!" | python3 main.py --use-chatgpt
- Windows:
python test_env.py echo "Hello, Gemini!" | python main.py echo "Hello, OpenAI!" | python main.py --use-chatgpt
- If you do not provide
--prompt, the script will read from stdin. - For advanced summarization, use
--use-context(requires context.txt). - For chatbot mode, use
chat_cli.py(Gemini by default, ChatGPT with --use-chatgpt). - All API keys must be set as environment variables.