ImaGen is a web application that generates images from text prompts using the Google Gemini AI model. It features a React frontend and an Express/Node.js backend.
- Frontend: React (powered by Vite)
- Backend: Node.js with Express.js
- AI Model: Google Gemini API (
gemini-2.0-flash)
This project uses the Google Gemini gemini-2.0-flash model for image generation.
As of the current Gemini API pricing structure, the pricing for using gemini-2.0-flash is heavily dependent on whether you use the Free Tier or the Pay-as-you-go Tier.
You can use the Gemini API for free, subject to the following limits:
- RPM (Requests Per Minute): 15
- RPD (Requests Per Day): 1,500
- Tokens Per Minute: 1 million
Note: When using the free tier, your input and output data may be used by Google to improve their products.
If you exceed free tier limits or disable data sharing, you will transition to Pay-as-you-go pricing:
- Prompts up to 128K tokens:
- Input: $0.10 per 1 million tokens
- Output: $0.40 per 1 million tokens
- Images: $0.000131 per image
- Prompts longer than 128K tokens:
- Input: $0.20 per 1 million tokens
- Output: $0.80 per 1 million tokens
- Images: $0.000262 per image
(Note: Pricing is subject to change. Always refer to the official Google Gemini API pricing page for the latest information).
- Node.js installed on your machine.
- A Google Gemini API key.
- Navigate to the backend directory:
cd imagen-backend - Install dependencies:
npm install
- Create a
.envfile in theimagen-backenddirectory and add your API key:GEMINI_API_KEY=your_api_key_here
- Start the backend server:
The backend will run on
node server.js
http://localhost:5000.
- Open a new terminal and navigate to the frontend directory:
cd imagen-frontend - Install dependencies:
npm install
- Start the development server:
npm run dev
- Open the displayed local URL (usually
http://localhost:5173) in your browser.