DocsGuidesLocal LLM extraction

Local LLM extraction

Extract structured data from any webpage using a local Ollama model — no API keys, no cloud, zero cost.

What is Ollama?

Ollama runs open-source LLMs (Llama 3, Mistral, Gemma, Phi-4, and more) locally on your CPU or GPU. Netleaf calls Ollama directly for /v1/extract when you pass "provider": "ollama".

Setup

Install from ollama.com, then pull a model:

bash
ollama serve
ollama pull llama3

Set the Ollama URL in your Netleaf env:

bash
# apps/api/.env
OLLAMA_URL=http://host.docker.internal:11434

Warning: When Netleaf runs inside Docker and Ollama runs on the host, use host.docker.internal — not localhost.

Extract data

bash
curl -X POST http://localhost:3000/v1/extract \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example.com/product",
    "provider": "ollama",
    "schema": {
      "type": "object",
      "properties": {
        "name":    { "type": "string"  },
        "price":   { "type": "number"  },
        "inStock": { "type": "boolean" }
      },
      "required": ["name", "price"]
    }
  }'

Netleaf scrapes the page, sends the Markdown content and your schema to Ollama, validates the JSON output with AJV, and returns it in the standard response envelope.