How I Ran an 18GB AI Image-gen Model on My Android Phone (Offline)

January 24, 2026

🚀 Run SDXL Turbo Locally on Android (Offline)

This guide turns your Android phone into an offline AI image generator using Termux and OnnxStream. We use a Proot (Ubuntu) environment to ensure stability and avoid Android-specific compilation errors.

⚠️ Requirements:

  • RAM: 4GB minimum (System Requirement).

  • Note: The AI itself uses ~300MB RAM, but the compilation process needs more.

  • Storage: ~10GB free space.

  • Time: ~15-30 minutes.


Phase 1: Setup the Linux Environment 🐧

  1. Open Termux and update:
pkg update && pkg upgrade -y
  1. Install Ubuntu (Proot-Distro): This creates a stable Linux environment to fix the "Termux compatibility" issues mentioned in the docs.
pkg install proot-distro
proot-distro install ubuntu
proot-distro login ubuntu

Phase 2: Build the Engine 🛠️

  1. Install Dependencies:
apt update && apt install -y build-essential cmake git wget python3
  1. Clone the Code:
git clone https://github.com/vitoplantamura/OnnxStream
cd OnnxStream/src
  1. Compile: We use -DMAX_SPEED=OFF as recommended in the docs for Termux to prevent crashes/overheating.
mkdir build && cd build
cmake -DMAX_SPEED=OFF ..
cmake --build . --config Release

Phase 3: Run & Download 🎨

We use the built-in downloader to fetch the weights automatically into a clean folder (~/models).

  1. Run the Generator:
  • --download A: Automatically downloads the model if missing.
  • --models-path ~/models: Saves the heavy files to a clean "models" folder.
./sd --turbo --download A --models-path ~/models --prompt "Cyberpunk city, neon lights, 8k"

💡 Pro Tips

  • First Run: It will take a while to download the weights (~8GB). Ensure you are on WiFi.
  • Output: The image is saved as sd_output.png in the current build folder.
  • View the Image: To see it in your Android Gallery, move it to internal storage:
cp sd_output.png /sdcard/Download/

Boom. You are live. 🚀