Build Kaggle Multi-GPU LLM API

Job ID: 40497607

Budget: $5 – $6 USD

I need one self-contained Kaggle notebook (.ipynb) that spins up a free, publicly reachable LLM inference API. The end goal is strictly research purposes, and the responses the service returns will be used for code generation experiments.

Inside the notebook you will:

• Probe Kaggle’s environment, list every visible GPU, add the individual memory figures, and display the total combined VRAM.
• Choose the most capable Ollama model that fits that VRAM—ranging automatically from gemma3:1b on the low end up to llama3.3:70b when the hardware allows—without hard-coding a specific name.
• Launch Ollama with CUDA_VISIBLE_DEVICES set so all detected GPUs work together, yet fall back cleanly to CPU-only mode when no GPU is found.
• Open a Cloudflare Quick Tunnel, capture the freshly issued public URL programmatically, and print it in a copy-ready form.
• Run a short warm-up request so the model is loaded before first external call, then echo a minimal cURL snippet that other researchers can paste to query the API immediately.
• Keep every cell idempotent; rerunning any cell on Kaggle’s dual T4 machines must never break the session or duplicate resources.

Acceptance criteria
1. A single notebook file is the only deliverable.
2. Executing the notebook top-to-bottom on a fresh Kaggle session results in:
– the tunnel URL displayed,
– an operational endpoint that returns code-generation text,
– and zero runtime errors whether GPUs are present or not.
3. All logic is written in clean, commented Python and relies solely on publicly installable packages plus the Cloudflare tunnel binary fetched on the fly.

Relevant stack: Python, Ollama, CUDA multi-GPU handling, Cloudflare Tunnels, Jupyter, LLM inference.