Gemini Stream Chat is a modern, responsive chat application that leverages Google's Generative AI (Gemini) to provide real-time, streaming conversational experiences. Built with React and Vite, it offers a seamless interface for interacting with AI, managing conversation history, and monitoring token usage.
- Streaming AI Responses: Experience real-time text generation with a typing effect.
- Conversation History: Automatically saves and organizes your chat history locally.
- Token Counting: Real-time estimation of prompt tokens to help manage usage.
- Responsive Design: A clean, modern UI built with Tailwind CSS that works on desktop and mobile.
- Markdown Support: Renders AI responses with proper formatting for code blocks, lists, and more.
- Frontend: React 19, Vite, TypeScript
- Styling: Tailwind CSS
- AI Integration: Google Generative AI SDK (
@google/genai) - Icons: Lucide React
- Node.js (Latest LTS version recommended)
- A Google Cloud Project with the Gemini API enabled and an API key.
-
Clone the repository (if applicable) or download the source code.
-
Install dependencies:
npm install
- Set up your environment variables:
- Create a
.envfile in the root directory. - Add your Gemini API key:
GEMINI_API_KEY=your_api_key_here
- Create a
- Start the development server:
npm run dev
- Open your browser and navigate to
http://localhost:3000(or the port shown in your terminal).
src/components: Reusable UI components (ChatWindow, MessageInput, Sidebar).src/services: API service functions (Gemini integration).src/types: TypeScript type definitions.src/App.tsx: Main application component managing state and layout.
To create a production build:
npm run buildThis will generate the static files in the dist directory.