Friday, October 3, 2025

Ultimate all-in-one script that does everything in one command in AI browser

 Visual diagram/infographic showing this full pipeline from download → conversion → registration → LocalAI server → AI browser usage, which is perfect for documentation or presentations.

Ultimate all-in-one script that does everything in one command in AI browser


Perfect! 😎 Here’s the ultimate all-in-one script that does everything in one command:

  • Downloads all 200+ models from your models_catalog.json
  • Converts them to GGUF (quantized for low-RAM)
  • Registers them with LocalAI
  • Starts the LocalAI server with all models ready for API calls

All-in-One Script (all_in_one_localai.sh)

#!/bin/bash

# -----------------------------
# ALL-IN-ONE: Download, Convert, 
Register, Start LocalAI
# -----------------------------
# Requirements:
#   pip install huggingface_hub 
transformers gguf-converter localai
#   Python 3.10+
# -----------------------------

MODEL_DIR="$HOME/localai_models"
mkdir -p "$MODEL_DIR"
LOG_FILE="$MODEL_DIR/all_in_one.log"
echo "All-in-One Process started at $(date)" >
 "$LOG_FILE"

# Check Python
if ! command -v python3 &> /dev/null
then
    echo "Python3 not found. Install 
Python 3.10+ first." | tee -a "$LOG_FILE"
    exit 1
fi

# Step 1: Download + Convert + Register
python3 <<EOF
import json, os, subprocess
from huggingface_hub import snapshot_download

catalog_path = "$MODEL_DIR/models_catalog.json"
if not os.path.exists(catalog_path):
    print(f"Error: {catalog_path} not found!")
    exit(1)

with open(catalog_path) as f:
    models = json.load(f)

save_dir = "$MODEL_DIR"
os.makedirs(save_dir, exist_ok=True)

for m in models:
    model_id = m.get("model_id")
    print(f"\nDownloading: {model_id}")
    try:
        path = snapshot_download
(repo_id=model_id, cache_dir=save_dir,
 resume_download=True)
        print(f"Downloaded at: {path}")

        # GGUF conversion
        gguf_model_path = os.path.join
(save_dir, model_id.replace('/', '_') + ".gguf")
        if not os.path.exists(gguf_model_path):
            print(f"Converting 
{model_id} -> GGUF")
            subprocess.run([
                "python3", "-m", 
"gguf_converter",
                "--input", path,
                "--output", 
gguf_model_path,
                "--quantize", "int4"
            ], check=False)
            print(f"GGUF saved at:
 {gguf_model_path}")

        # Register with LocalAI
        print(f"Registering 
{gguf_model_path} with LocalAI")
        subprocess.run([
            "localai", 
"register", "--model", gguf_model_path
        ], check=False)
    except Exception as e:
        print(f"Failed: {model_id} -> {e}")
EOF

# Step 2: Start LocalAI
PORT=8080
echo "Starting LocalAI server on port $PORT..."
localai start --models "$MODEL_DIR" --port $PORT

echo "All-in-One process completed at
 $(date)" >> "$LOG_FILE"
echo "LocalAI server running on 
http://localhost:$PORT with all 
GGUF models loaded"

How to Use

  1. Save as all_in_one_localai.sh
  2. Make it executable:
    chmod +x all_in_one_localai.sh
    
  3. Place models_catalog.json in the same folder.
  4. Run it:
    ./all_in_one_localai.sh
    
  5. After completion:
    • All 200+ models downloaded
    • Converted to GGUF
    • Registered with LocalAI
    • LocalAI server running on http://localhost:8080

Benefits

  • Single-command setup for your entire AI model library
  • Optimized GGUF models for low-RAM
  • Fully automated integration with LocalAI
  • Ready for AI browsers, scripts, or API clients


What is Generative AI?

  What is Generative AI? Artificial Intelligence (AI) has transformed the way humans interact with technology, from voice assistants and r...