RunPod + n8n: Run a Private AI Model in 30 Minutes

RunPod + n8n: Eigenes KI-Modell in 30 Minuten betreiben

🇬🇧 English

This article contains affiliate links. If you buy through them, we may earn a commission at no extra cost to you.

Why Run Your Own AI Model Instead of Using a Public API?

Public AI APIs like OpenAI are convenient, but they come with trade-offs: your data leaves your infrastructure, costs scale with every token, and you have no control over model behaviour or availability. If you work with sensitive data, need a custom fine-tuned model, or simply want predictable costs, running a private open-source LLM is the smarter path.

The combination of Runpod for GPU cloud hosting and n8n for workflow automation gives you a fully private, trigger-from-anywhere AI stack — without managing physical servers or writing complex deployment code.

This guide walks you through the full setup in around 30 minutes, from spinning up a GPU pod to making your first automated API call from an n8n workflow.

What You Will Need

  • A RunPod account (pay-per-use, no upfront commitment)
  • An n8n instance — self-hosted or n8n Cloud
  • Basic comfort with HTTP requests and JSON
  • A model to serve — this guide uses Mistral 7B via Ollama, but the steps apply to any OpenAI-compatible endpoint

Step 1: Deploy a GPU Pod on RunPod

Log in to your RunPod dashboard and click Deploy. Choose a GPU tier that fits your model size:

  • RTX 3090 / 4090 (24 GB VRAM) — good for 7B–13B parameter models
  • A100 (40/80 GB VRAM) — for 30B+ models or low-latency production use

For the container image, use the official Ollama Docker image: ollama/ollama. Set the container port to 11434 (Ollama's default HTTP port) and enable HTTP port exposure so n8n can reach it over the internet.

Click Deploy On-Demand. Your pod will be ready in under two minutes.

Pull Your Model Inside the Pod

Open the RunPod web terminal (or SSH in) and run:

ollama pull mistral

Ollama will download Mistral 7B (~4 GB). Once complete, the model is ready to serve requests at http://<your-pod-public-ip>:11434/api/generate.

Test it quickly with curl:

curl http://<your-pod-ip>:11434/api/generate \
 -d '{"model":"mistral","prompt":"Hello, what can you do?","stream":false}'

If you get a JSON response with a response field, your private model is live.

Step 2: Connect Your Model to n8n via HTTP Node

Open your n8n workflow editor. Add an HTTP Request node with these settings:

  • Method: POST
  • URL: http://<your-pod-ip>:11434/api/generate
  • Body Type: JSON
  • Body:
    {
     "model": "mistral",
     "prompt": "{{ $json.prompt }}",
     "stream": false
    }

The {{ $json.prompt }} expression pulls the prompt text from whatever node feeds into this one — a webhook, a form, a CRM record, or any other trigger. This is the bridge between your data and your private AI model.

Parse the Response

Ollama returns a JSON object. The generated text lives in response.response. Add a Set node after the HTTP Request node and map:

ai_output = {{ $json.response }}

That value is now available to every downstream node in your workflow.

Step 3: Build a Real Workflow Around Your Model

Once the HTTP node is working, you can trigger your private AI from virtually any source. Here are three practical patterns:

Pattern 1 — Webhook-triggered Summariser

Trigger: Webhook → HTTP Request (Mistral) → Send Email / Slack Message with the summary. Any external app that can POST to a URL — Zapier, Make, your own backend — can now use your private model.

Pattern 2 — Scheduled Document Classifier

Trigger: Schedule → Read rows from Google Sheets → HTTP Request (classify each row) → Write category back to the sheet. Fully automated, zero API fees, data never leaves your cloud.

Pattern 3 — Form-based Q&A Bot

Trigger: n8n Form → HTTP Request (Mistral answers the question) → Respond to Webhook sends the answer back to the form in real time. Instant private chatbot, no OpenAI account required.

Step 4: Secure Your Endpoint

A public IP with no authentication is a risk. Apply at least one of these controls before going to production:

  • RunPod network volumes and private networking — keep the pod off the public internet entirely and reach it via RunPod's internal network from another pod running n8n.
  • API key header — add a custom header (e.g. X-API-Key) in Ollama's proxy layer or via an nginx reverse proxy, and validate it in n8n's HTTP Request node under Header Auth.
  • IP allowlist — restrict inbound traffic to your n8n server's static IP using RunPod firewall rules.

Cost Estimate

A RunPod RTX 3090 pod costs roughly $0.44/hour on-demand. For a workflow that runs 500 times a day with an average latency of 2 seconds per call, the pod needs to be active for about 17 minutes — costing under $0.13/day. Compare that to OpenAI API fees for 500 Mistral-equivalent calls and the savings are significant, especially at scale.

You can also use RunPod Serverless (auto-scaling workers) so you only pay per request and the pod scales to zero when idle.

Troubleshooting Common Issues

  • Connection refused: Check that port 11434 is exposed in RunPod's port mapping settings and that the Ollama service started correctly (ollama serve must be running).
  • Timeout in n8n: Increase the HTTP Request node timeout to 60–120 seconds for large models. First-token latency on cold starts can be high.
  • Out of memory: Switch to a quantised model variant (e.g. mistral:7b-instruct-q4_K_M) to reduce VRAM usage by ~40%.
  • Stream mode breaking JSON parse: Always set "stream": false when calling from n8n unless you are using a streaming HTTP node with chunked response handling.

Next Steps: Fine-tuning and Custom Models

Once the basic setup works, RunPod also lets you run fine-tuning jobs on the same GPU infrastructure. Upload your dataset to a RunPod network volume, run a fine-tuning script (e.g. with Axolotl or Unsloth), and serve the resulting model checkpoint directly with Ollama. The n8n workflow stays exactly the same — you just point it at a different model name.

If you want to run a private AI model and trigger it from any workflow without paying per token, you can get GPU cloud access via Runpod — pay per use with no upfront commitment — to keep your data private and your costs predictable. Already have your model running? Build the trigger workflows with n8n, which offers 400+ integrations and a free self-hosted option.

🇩🇪 Deutsch

Dieser Artikel enthält Affiliate-Links (Werbung). Kaufst du darüber, erhalten wir ggf. eine Provision – für dich ohne Mehrkosten.

Warum ein eigenes KI-Modell statt einer öffentlichen API?

Öffentliche KI-APIs wie OpenAI sind bequem, haben aber entscheidende Nachteile: Deine Daten verlassen deine Infrastruktur, die Kosten skalieren mit jedem Token, und du hast keine Kontrolle über Modellverhalten oder Verfügbarkeit. Wer mit sensiblen Daten arbeitet, ein eigens feingetuntes Modell benötigt oder einfach planbare Kosten will, fährt mit einem privaten Open-Source-LLM deutlich besser.

Die Kombination aus Runpod für GPU-Cloud-Hosting und n8n für Workflow-Automatisierung ergibt einen vollständig privaten KI-Stack, den du aus beliebigen Workflows aufrufen kannst — ohne physische Server zu verwalten oder komplexen Deployment-Code zu schreiben.

Diese Anleitung führt dich in ca. 30 Minuten durch das gesamte Setup: vom Start eines GPU-Pods bis zum ersten automatisierten API-Aufruf aus einem n8n-Workflow.

Was du brauchst

  • Ein RunPod-Konto (Pay-per-use, keine Vorauszahlung)
  • Eine n8n-Instanz — selbst gehostet oder n8n Cloud
  • Grundkenntnisse mit HTTP-Anfragen und JSON
  • Ein Modell zum Betreiben — diese Anleitung verwendet Mistral 7B über Ollama, die Schritte gelten aber für jeden OpenAI-kompatiblen Endpunkt

Schritt 1: GPU-Pod auf RunPod deployen

Melde dich in deinem RunPod-Dashboard an und klicke auf Deploy. Wähle ein GPU-Tier passend zur Modellgröße:

  • RTX 3090 / 4090 (24 GB VRAM) — gut für 7B–13B-Parameter-Modelle
  • A100 (40/80 GB VRAM) — für Modelle ab 30B oder latenzarmen Produktionseinsatz

Als Container-Image verwendest du das offizielle Ollama-Docker-Image: ollama/ollama. Setze den Container-Port auf 11434 (Ollamas Standard-HTTP-Port) und aktiviere die HTTP-Port-Freigabe, damit n8n den Pod über das Internet erreichen kann.

Klicke auf Deploy On-Demand. Dein Pod ist in unter zwei Minuten bereit.

Modell im Pod herunterladen

Öffne das RunPod-Webterminal (oder verbinde dich per SSH) und führe aus:

ollama pull mistral

Ollama lädt Mistral 7B herunter (~4 GB). Danach ist das Modell bereit und bedient Anfragen unter http://<deine-pod-public-ip>:11434/api/generate.

Schnelltest mit curl:

curl http://<deine-pod-ip>:11434/api/generate \
 -d '{"model":"mistral","prompt":"Hallo, was kannst du?","stream":false}'

Wenn du eine JSON-Antwort mit einem response-Feld erhältst, läuft dein privates Modell.

Schritt 2: Modell über den HTTP-Node mit n8n verbinden

Öffne den n8n-Workflow-Editor und füge einen HTTP Request-Node mit folgenden Einstellungen hinzu:

  • Methode: POST
  • URL: http://<deine-pod-ip>:11434/api/generate
  • Body-Typ: JSON
  • Body:
    {
     "model": "mistral",
     "prompt": "{{ $json.prompt }}",
     "stream": false
    }

Der Ausdruck {{ $json.prompt }} zieht den Prompt-Text aus dem vorgelagerten Node — einem Webhook, einem Formular, einem CRM-Datensatz oder einem beliebigen anderen Trigger. Das ist die Brücke zwischen deinen Daten und deinem privaten KI-Modell.

Antwort verarbeiten

Ollama gibt ein JSON-Objekt zurück. Der generierte Text steckt in response.response. Füge nach dem HTTP-Request-Node einen Set-Node ein und mappe:

ai_output = {{ $json.response }}

Dieser Wert steht nun allen nachgelagerten Nodes in deinem Workflow zur Verfügung.

Schritt 3: Echten Workflow rund um dein Modell aufbauen

Sobald der HTTP-Node funktioniert, kannst du deine private KI aus nahezu jeder Quelle aufrufen. Hier sind drei praxisnahe Muster:

Muster 1 — Webhook-gesteuerter Zusammenfasser

Trigger: Webhook → HTTP Request (Mistral) → E-Mail / Slack-Nachricht mit der Zusammenfassung. Jede externe App, die einen POST-Request senden kann — Zapier, Make, dein eigenes Backend — kann jetzt dein privates Modell nutzen.

Muster 2 — Geplanter Dokumenten-Klassifizierer

Trigger: Schedule → Zeilen aus Google Sheets lesen → HTTP Request (jede Zeile klassifizieren) → Kategorie zurück ins Sheet schreiben. Vollständig automatisiert, keine API-Gebühren, Daten verlassen nie deine Cloud.

Muster 3 — Formular-basierter Q&A-Bot

Trigger: n8n-Formular → HTTP Request (Mistral beantwortet die Frage) → Respond to Webhook schickt die Antwort in Echtzeit zurück. Privater Chatbot sofort einsatzbereit — kein OpenAI-Konto nötig.

Schritt 4: Endpunkt absichern

Eine öffentliche IP ohne Authentifizierung ist ein Sicherheitsrisiko. Wende mindestens eine dieser Maßnahmen an, bevor du produktiv gehst:

  • RunPod Private Networking — halte den Pod komplett vom öffentlichen Internet fern und erreiche ihn über RunPods internes Netzwerk von einem anderen Pod, auf dem n8n läuft.
  • API-Key-Header — füge einen benutzerdefinierten Header (z. B. X-API-Key) in der Proxy-Schicht von Ollama oder über einen nginx-Reverse-Proxy hinzu und validiere ihn im n8n-HTTP-Request-Node unter Header Auth.
  • IP-Allowlist — beschränke eingehenden Traffic auf die statische IP deines n8n-Servers über RunPods Firewall-Regeln.

Kostenschätzung

Ein RunPod-RTX-3090-Pod kostet on-demand ca. 0,44 USD/Stunde. Bei einem Workflow, der 500 Mal täglich läuft und durchschnittlich 2 Sekunden pro Aufruf benötigt, muss der Pod ca. 17 Minuten aktiv sein — das kostet unter 0,13 USD/Tag. Verglichen mit OpenAI-API-Gebühren für 500 äquivalente Mistral-Aufrufe sind die Einsparungen erheblich, besonders bei größeren Volumina.

Du kannst auch RunPod Serverless nutzen (automatisch skalierte Worker), sodass du nur pro Anfrage zahlst und der Pod bei Leerlauf auf null skaliert.

Häufige Probleme beheben

  • Connection refused: Prüfe, ob Port 11434 in den RunPod-Port-Mapping-Einstellungen freigegeben ist und ob der Ollama-Dienst korrekt gestartet wurde (ollama serve muss laufen).
  • Timeout in n8n: Erhöhe den Timeout im HTTP-Request-Node auf 60–120 Sekunden für große Modelle. Die Latenz beim ersten Token nach einem Kaltstart kann hoch sein.
  • Out of Memory: Wechsle zu einer quantisierten Modellvariante (z. B. mistral:7b-instruct-q4_K_M), um den VRAM-Verbrauch um ~40 % zu reduzieren.
  • Stream-Modus bricht JSON-Parsing: Setze immer "stream": false, wenn du aus n8n aufrufst, es sei denn, du verwendest einen HTTP-Node mit Chunked-Response-Handling.

Nächste Schritte: Fine-tuning und eigene Modelle

Sobald das Basis-Setup läuft, kannst du auf derselben GPU-Infrastruktur auch Fine-tuning-Jobs ausführen. Lade deinen Datensatz in ein RunPod-Network-Volume hoch, starte ein Fine-tuning-Skript (z. B. mit Axolotl oder Unsloth) und serviere den resultierenden Modell-Checkpoint direkt mit Ollama. Der n8n-Workflow bleibt exakt gleich — du zeigst ihn nur auf einen anderen Modellnamen.

Wenn du ein privates KI-Modell betreiben und aus beliebigen Workflows aufrufen möchtest, ohne pro Token zu zahlen, kannst du über Runpod GPU-Cloud-Kapazität buchen — pay-per-use ohne Vorauszahlung — und deine Daten privat sowie deine Kosten planbar halten. Sobald dein Modell läuft, baust du die Trigger-Workflows mit n8n, das 400+ Integrationen und eine kostenlose Self-Hosting-Option bietet.