How to Connect a Local LLM to Your Automation Workflows

Diagram showing local LLM connected to automation workflow tools

You have installed Ollama, downloaded a model, and tested it in the terminal. It works great. But now what? A language model sitting in a terminal is like a sports car in a garage — impressive but useless until you take it somewhere. The real value comes from connecting your local LLM to workflows that process real data: emails, documents, form submissions, support tickets, and more.

The Local LLM API Landscape

The most popular tools for running local LLMs all expose an HTTP API that is compatible with the OpenAI format. Ollama runs at localhost:11434. LM Studio runs at localhost:1234. LocalAI runs at any port you choose. This compatibility is the key feature because it means any tool that works with OpenAI also works with your local model — you just change the base URL.

Connecting to n8n

In n8n, go to Credentials and create a new Ollama API credential. Set the base URL to http://localhost:11434 (or your server IP if n8n runs on a different machine). Now you can use the AI Agent node, Chat Model node, or any LLM-related node and select Ollama as the provider. Your workflow will use the local model for all AI operations with zero API costs.

Network Setup for Remote Access

  • Same machine — use localhost with the default port, no extra configuration needed
  • Same network — use the local IP address of the machine running the model (e.g., 192.168.1.100:11434)
  • Different network — use a reverse proxy like Nginx or Cloudflare Tunnel to securely expose the local API
  • Docker setup — if both n8n and Ollama run in Docker, put them on the same Docker network
Network diagram showing local LLM connected to automation platform

Using the OpenAI Library with Local Models

If you prefer code over visual tools, the official OpenAI Python and JavaScript libraries work perfectly with local models. Just set the base_url parameter to your local endpoint. All the same methods — chat completions, streaming, function calling — work exactly the same way. This means you can develop against OpenAI and switch to a local model for production without changing any code except the URL and model name.

Practical Workflow Examples

  • Email classification — incoming emails are sent to the local LLM for intent detection and routing
  • Document summarization — uploaded PDFs are extracted and summarized for quick review
  • Data extraction — invoices and receipts are parsed into structured JSON for accounting software
  • Content generation — product descriptions, social posts, or email drafts created on demand

The beauty of connecting a local LLM to your workflows is flexibility. You can swap models in seconds, run multiple models for different tasks, and scale by adding more hardware instead of paying higher API bills. Start by replacing one cloud API call with a local model, measure the quality difference, and expand from there.