One-command installation of g4f for Linux and Android (via Termux).
- โ One-command installation - No manual setup required
- โ Auto-detects your system - Works on Ubuntu, Debian, Arch, Termux, etc.
- โ Silent mode support - Perfect for automation
- โ Automatic updates - Keeps g4f up to date
- โ Optional components - Choose full or slim installation
- โ Works on Android - Via Termux terminal emulator
- โก Fast Termux mode - 5-minute quick install option
~5 minutes, minimal features, perfect for testing:
pkg install curl -y
curl -fsSL https://raw.githubusercontent.com/gpt4free/g4f.sh/main/termux-fast.sh -o termux-fast.sh
chmod +x termux-fast.sh
./termux-fast.sh~20-40 minutes, all features:
pkg install curl -y
curl -fsSL https://raw.githubusercontent.com/gpt4free/g4f.sh/main/g4f_launcher.sh -o g4f_launcher.sh
chmod +x g4f_launcher.sh
./g4f_launcher.shcurl -fsSL https://raw.githubusercontent.com/gpt4free/g4f.sh/main/g4f_launcher.sh -o g4f_launcher.sh
chmod +x g4f_launcher.sh
./g4f_launcher.sh| Version | Install Time | Size | Features | Best For |
|---|---|---|---|---|
| Fast (Termux) | ~5 minutes | ~150MB | Basic API & GUI | Quick testing, impatient people ๐ |
| Full (Termux) | ~20-40 minutes | ~600MB | All features | Daily use, maximum compatibility |
| Full (Linux) | ~5 minutes | ~600MB | All features | Desktop/server deployments |
- Android 7.0+
- Termux from F-Droid (NOT Play Store - outdated!)
- Storage:
- Fast install: ~200MB free
- Full install: ~800MB free
- Note: Your phone may get warm during compilation - this is normal!
- Any modern Linux distribution
curlorwget- Storage: ~800MB free (for full installation)
./g4f_launcher.shThe launcher will:
- โ Detect your system (Termux/Ubuntu/Debian/Arch/etc.)
- โ Install Python (if needed)
- โ Install pip (if needed)
- โ Ask you to choose between full or optimized g4f installation
- โ Ask about optional ffmpeg installation
- โ Start the g4f server
./g4f_launcher.sh /silentPerfect for automation. Installs everything automatically:
- Full g4f installation (g4f[all])
- ffmpeg (optional but included)
- No user prompts
- Exits cleanly after installation
The server runs on http://localhost:8080
Web Interface:
http://localhost:8080/chat/
API Endpoints:
POST http://localhost:8080/v1/chat/completions
POST http://localhost:8080/v1/completions
GET http://localhost:8080/v1/models
A launcher script is created at:
- Termux:
~/g4f-start - Linux:
~/.local/bin/g4f-start
Run it anytime:
~/g4f-start # Termux
# or
g4f-start # Linux (if ~/.local/bin is in PATH)Just run the launcher again:
./g4f_launcher.shIt will detect g4f is installed and update it automatically.
python -m g4f.cli api --port 8080 &Stop with:
pkill -f g4fTermux compiles packages from source on your phone's ARM CPU. This is normal and expected:
- Fast install: ~5 minutes (minimal compilation)
- Full install: ~20-40 minutes (compiles Rust, C libraries, etc.)
Your phone may get warm - this is normal! Modern phones can handle it.
topLook for python, pip, rustc, or clang processes - if you see them, it's working!
Check available space:
df -h ~Need at least:
- Fast install: ~200MB free
- Full install: ~800MB free
Some Android manufacturers (Samsung, Xiaomi) may kill background processes. To prevent this:
- Open Android Settings
- Go to Apps โ Termux
- Disable battery optimization for Termux
Find your phone's IP:
ifconfig wlan0 | grep inetThen access from another device on the same network:
http://YOUR_PHONE_IP:8080/chat/
chmod +x g4f_launcher.sh
./g4f_launcher.sh # Note the ./Make sure you're in the correct directory:
ls -l g4f_launcher.sh # Should show the fileUpdate package lists first:
pkg update
pkg upgrade- โ This is normal! See "Why is Termux installation slow?" above
- โ Try the Fast install instead (5 minutes)
- โ Make sure your phone isn't in power saving mode
Install Python manually:
# Termux
pkg install python
# Ubuntu/Debian
sudo apt install python3 python3-pip
# Arch
sudo pacman -S python python-pipThe full launcher auto-installs build dependencies, but if you have issues:
pkg install rust clang make libxml2 libxslt -y- Windows Launcher: g4f.exe - Windows GUI installer by the same author
- G4F Project: gpt4free - The main g4f project by @xtekky
The official g4f installation (pip install g4f) works great for developers, but this launcher:
- โ Handles all dependencies automatically
- โ Works for non-technical users
- โ Optimized for Termux/Android
- โ Provides fast installation option
- โ Creates convenient shortcuts
- โ Supports silent/automated deployments
Official g4f method:
# User must know Python, pip, handle errors, etc.
pip install g4f[all]
python -m g4f.cli api --port 8080This launcher:
# Just worksโข
./g4f_launcher.sh- โจ Added Termux fast install mode (~5 minutes)
- ๐ง Auto-installs build dependencies on Termux
- ๐ Fixed compilation issues with lxml, primp, and other C dependencies
- ๐ Added installation time estimates
- ๐ก๏ธ Added thermal warnings for Termux users
- ๐ Improved error messages and logging
- ๐ Initial release
- โ Support for Linux and Termux
- โ Auto-detection of system
- โ Silent mode support
- โ Optional components
MIT License - See LICENSE file for details
jokukiller
- ๐ช Windows Launcher: g4f.exe
- ๐ง Linux Launcher: g4f-linux-launcher (this project)
- ๐ฌ GitHub: @jokukiller
If this helped you, consider:
- โญ Starring this repo
- โญ Starring the main g4f project
- ๐ Reporting issues
- ๐ง Contributing improvements
- ๐ข Sharing with others who might find it useful
- H Lohaus (@hlohaus) - Current g4f maintainer
- xtekky (@xtekky) - Original g4f creator
- g4f community - For the amazing AI aggregation project
- ๐ฆ Submit to Termux User Repository (TUR)
- ๐จ Add Termux:Widget support (one-tap launch from home screen)
- ๐ Auto-update checker
- ๐ Multi-language support
- ๐ฑ iOS/iSH support
Enjoy running AI locally on your device! ๐
Questions? Open an issue: GitHub Issues