Skip to content

sergiecode/gemini-api-chatbot-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 Minimal Gemini API Console Chat

A minimal Python console chat application using Google's Gemini API.

👨‍💻 Created by Sergie Code

Software Engineer who teaches programming on YouTube.

🔗 Follow me on:

✨ Features

  • 💬 Simple console chat with Google Gemini AI
  • 🔐 Secure API key management using .env file
  • ⚡ Fast and lightweight
  • 🛡️ Basic error handling

🚀 Quick Start

Prerequisites

  • Python 3.7 or higher
  • Google Gemini API key

Installation

  1. Install dependencies:

    pip install -r requirements.txt
  2. Set up your API key:

    copy .env.template .env

    Then edit .env and add your actual API key

  3. Run the chat:

    python chat_bot.py

    Or double-click run_chat.bat

🎮 Usage

  • Type messages to chat with Gemini
  • Type quit, exit, or bye to exit
  • Press Ctrl+C to force exit

📁 Project Structure

gemini-api-chatbol-python/
├── chat_bot.py          # Main chat application
├── .env                 # Your API key (create from template)
├── .env.template        # Template for API key setup
├── .gitignore          # Git ignore file
├── requirements.txt     # Python dependencies
├── run_chat.bat        # Windows launcher
└── README.md           # This file

🔧 Configuration

  1. Copy .env.template to .env
  2. Add your Gemini API key to the .env file:
    GEMINI_API_KEY=your_actual_api_key_here
    

📦 Dependencies

  • google-generativeai: Official Google Generative AI Python client
  • python-dotenv: Load environment variables from .env file

� Troubleshooting

  • API Key Error: Make sure .env file exists with correct API key
  • Rate Limit: Wait a few minutes if you see quota exceeded errors
  • Import Error: Run pip install -r requirements.txt

Created with ❤️ by Sergie Code

About

A minimal Python console terminal chat app using Gemini API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published