Skip to content

whysblog/translet-gemini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gemini Web Chat

A minimal no-login chat web app:

  • users open the page and start chatting immediately
  • the browser sends requests to your server
  • the server forwards them to Gemini with GEMINI_API_KEY
  • the API key stays on the server

Local run

python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt

Create .env in the project root:

GEMINI_API_KEY=your_real_key
GEMINI_MODEL=gemini-2.5-flash
GEMINI_MODELS=gemini-2.5-flash,gemini-3-flash-preview,gemini-2.5-flash-lite,gemini-3.1-flash-lite-preview
PORT=8000
GEMINI_CONNECT_TIMEOUT=10
GEMINI_READ_TIMEOUT=180

Then run:

python app.py

Open http://127.0.0.1:8000

Notes

  • default model is gemini-2.5-flash
  • GEMINI_MODEL can override the default
  • GEMINI_MODELS controls fallback order when a model hits quota or rate limits
  • the app loads .env automatically on startup
  • long Gemini responses can use GEMINI_CONNECT_TIMEOUT and GEMINI_READ_TIMEOUT
  • chat history lives in browser memory and clears on refresh

Ubuntu 22.04 deployment

Upload the project to the server, then run:

chmod +x deploy_ubuntu22.sh
./deploy_ubuntu22.sh

The script will:

  • switch Ubuntu 22.04 apt sources to Tsinghua Tuna by default
  • install Python packages needed on Ubuntu 22.04
  • copy the project to /opt/gemini-web-chat
  • create a virtual environment
  • install dependencies with Tsinghua PyPI by default
  • generate a systemd service

If you do not want the script to replace apt sources, run:

USE_TUNA_APT=0 ./deploy_ubuntu22.sh

If you do not want to use Tsinghua PyPI, run:

USE_TUNA_PIP=0 ./deploy_ubuntu22.sh

After that:

sudo nano /opt/gemini-web-chat/.env
sudo systemctl enable --now gemini-web-chat
sudo journalctl -u gemini-web-chat -f

Open:

http://your-server-ip:8000

About

11111

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors