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 servemust 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": falsewhen 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.