A boilerplate repository for connecting to Google Gemini via API.
- Simple integration with Google Gemini API
- Easy setup and configuration
- Ready-to-use Python environment
- The model doesn't keep the memory or maintains any session so each prompt is a whole new conversation
-
Navigate to Google AI Studio and get a API Key
-
Clone the repository
git clone <repository-url> cd llm-via-api
-
Create a virtual environment
python -m venv venv
-
Activate the virtual environment
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
source venv/bin/activate
- On Windows:
-
Install dependencies
pip install -r requirements.txt
-
Set up environment variables
- On Windows(powershell):
$env:GEMINI_API_KEY="YOUR_API_KEY_HERE"
- On macOS/Linux:
export GEMINI_API_KEY='YOUR_API_KEY_HERE'
- On Windows(powershell):
Run the main program:
python main.py- Ensure you have a valid Google Gemini API key.
- For more details, refer to the code and comments.