Lokale AI-modellen draaien
zonder cloud
dependency
Ollama en local LLMs als upstream voor de OpenClaw Gateway: VRAM, quantization, inference latency en routing — met dezelfde approvals en logging als cloud.
Immediate answer
Wat zijn local models
within OpenClaw?
Short answer: LLM-inference op jouw eigen hardware (typisch Ollama op GPU of CPU) die de OpenClaw Gateway als upstream provider gebruikt — tokens worden lokaal gegenereerd, niet via Anthropic/OpenAI cloud.
Nuance: lokaal betekent controle over data-egress, latency en modelversie — niet minder approvals op tools. VRAM, quantization en routing bepalen of het productie-haalbaar is.
Docker · Monitoring · Hub
Afweging
Wanneer local models zinvol zijn
Geen dogma “altijd lokaal” — operationele trade-offs expliciet.
Privacy & data-residency
Prompts en context blijven op jouw netwerk — geen upstream tenant bij cloud provider. Compliance ≠ automatisch; logging en backups blijven jouw verantwoordelijkheid.
Offline / air-gapped
Inference zonder internet na model pull — handig voor geïsoleerde VLANs; updates en patches worden zelf beheerd.
Lagere netwerk-latency
LAN-call naar Ollama op :11434 kan sneller zijn dan round-trip cloud — als GPU/CPU het aankan; anders trager dan API.
Gevoelige data in agents
Governance & audit
Je controleert welk model, welke versie, welke quant — audit trail op Gateway + monitoring.
Tegenkant: onderhoud
Model lifecycle, GPU drivers, VRAM tuning, rollback — operationeel zwaarder dan “API key in .env”.
Tegenkant: hardware
GPU-kosten, RAM/VRAM ceilings, koeling — geen gratis schaal zoals pay-per-token cloud.
Infrastructuur
Ollama & local LLM stack
Geen install-tutorial — hoe het in productie naast de Gateway hangt.
Ollama als inference endpoint
OpenClaw Gateway wijst upstream naar OLLAMA_HOST (sidecar of host). Geen vervanging van Gateway — routing en tools blijven centraal.
Model pulling & lifecycle
Tags pinnen (llama3.2:3b niet “latest” op prod); test nieuwe weights op staging vóór Gateway switch.
Quantization (Q4, Q8, …)
Trade-off: minder VRAM vs kwaliteit/hallucinaties. Te agressieve quant → instabiel gedrag in workflows.
CPU vs GPU inference
CPU-only kan voor kleine modellen/demo; productie-agents met browser tools willen vaak GPU of cloud fallback.
Model switching
Meerdere modellen = meerdere VRAM-footprints; unload policy nodig om OOM te voorkomen.
Local routing
Gateway kiest provider per agent/channel — zelfde governance als cloud upstream.
Hardware
VRAM, RAM & performance
Waarom VRAM telt
Weights + KV-cache voor context window zitten in GPU RAM. Te klein model voor VRAM → load fail; te groot context → OOM mid-request.
Example: 7B Q4 op 8 GB GPU kan, 13B + lange context vaak niet zonder offload.
Context window
Langere context = meer geheugen en latency. Browser/mail dumps in één prompt zijn VRAM-killers.
Example: Truncate/summarize vóór inference; apart klein model voor triage.
OOM & Exit 137
Docker Ollama sidecar zonder memory limit kan hele VPS slopen — zie Docker RAM-sectie.
Example: docker stats + cgroup limit op ollama service.
Swap & memory pressure
CPU swap bij GPU OOM → inference in seconden per token — lijkt op “hangende agent”.
Example: Disable swap voor inference nodes of monitor vmstat.
Inference latency
Tokens/s afhankelijk van GPU, quant, batch size. Browser automation wacht op LLM — trage local = trage workflow.
Example: Meet p95 latency vóór prod; stel timeouts op tool-calls.
Comparison
Cloud vs local models
Neutraal — hybrid stacks zijn normaal in MKB automation.
Privacy / egress
Local: Data blijft LAN/VPC
Cloud: Upstream tenant & DPA
Latency (typisch)
Local: Laag op LAN als GPU OK
Cloud: Internet + queue
Kosten (MKB)
Local: CapEx GPU + stroom + beheer
Cloud: Op gebruik / abonnement
Governance
Local: Jij beheert model + logs
Cloud: Provider policies + jouw Gateway
Monitoring
Local: VRAM, GPU temp, Ollama health
Cloud: API errors, rate limits
Compliance
Local: Residency mogelijk
Cloud: Certificaten provider
Betrouwbaarheid
Local: Jouw hardware/SPOF
Cloud: Provider SLA
Scalability
Local: VRAM/GPU bound
Cloud: Elastic (met kosten)
Routing
Multi-model
routing
Short answer: niet één model voor alles — Gateway policies per agent/channel met fallback en latency-bewustzijn.
- → Klein vs groot model: Triage met 3B/7B lokaal; zware redenering naar groter model of cloud — scheiding in routing policy.
- → Browser agents + local: DOM-stappen wachten op LLM — trage local inference = trage automation; overweeg cloud voor interactieve paden.
- → Fallback naar cloud: Bij OOM, timeout of overload: gecontroleerde fallback naar Anthropic/OpenAI-compatible — geen stille dual-write.
- → Workload splitting: Readonly summarization lokaal; mutating tool planning met cloud — zie agent tools.
- → Routing policies: Per channel/agent in Gateway config; documenteer welk model waarom — audit bij incident.
Documenteer: bij OOM/timeout → welk cloud model, max tokens, welke data mag egress. Geen stille fallback zonder RBAC-review.
Failures
Wanneer local models misgaan
GPU memory exhaustion
Twee modellen geladen of context spike → CUDA OOM; Gateway ziet upstream 500/timeout.
Trage inference
CPU-only of thermal throttle — approval queue lijkt op “kapotte AI”.
Instability & corruption
Incomplete pull, disk full op model store — herstart lost niet op zonder integriteitscheck.
Slechte quantization
Te lage kwaliteit → meer hallucinaties in tool-plannen — geen “model is dom”, wel verkeerde trade-off.
Browser agent vertraging
Elke DOM-beslissing wacht op tokens — timeouts op browser tool chain.
Upstream errors: problems · check OLLAMA_HOST en VRAM vóór Gateway herinstall.
Production
Local inference
checklist
Zelfde governance als cloud: agent tools en approvals blijven actief.
Short answer: LLM-inference op jouw hardware (Ollama, llama.cpp, GPU stack) als upstream voor de OpenClaw Gateway — geen cloud API voor elke token.
Nuance: lokaal = jij beheert weights, VRAM, updates; Gateway blijft orchestrator voor agents en tools.
Follow-up: Docker sidecar setup
Short answer: Ja met pinnen, monitoring, memory limits, staging tests en fallback — nee als “latest pull op kleine VPS zonder observability”.
Cause: OOM en silent slowdown zijn productie-incidenten.
Follow-up: logs & monitoring
Short answer: Niet strikt — kleine modellen op CPU kunnen voor triage; interactieve agents + browser workflows willen meestal GPU of cloud.
Cause: tokens/s op CPU vs CUDA.
Advice: meet latency vóór prod-commit.
Short answer: GPU-geheugen voor model weights en inference cache — bottleneck naast RAM voor Ollama process.
Nuance: context window groei eet VRAM; quantization verlaagt footprint met kwaliteits-trade-off.
Follow-up: sectie VRAM op deze pagina.
Short answer: Hardware-limiet (GPU/CPU), quant, context-lengte, concurrent agents — geen “lokaal = altijd sneller”.
Cause: swap, thermal throttle, twee modellen tegelijk geladen.
Fix: routing, kleiner model, cloud fallback voor hot path.
Short answer: Bij VRAM-tekort, hoge kwaliteitseis, elastic piekbelasting, of als beheer van GPU niet past bij team.
Nuance: hybrid is gangbaar: lokaal voor privacy-triage, cloud voor zware redenering.
Follow-up: multi-model routing hierboven.
Self-hosted AI
Lokale AI infrastructuur
& architectuur
We helpen met Ollama sidecars, VRAM sizing, model routing, fallback policies en Gateway/Docker hardening — deployment begeleiding voor teams die cloud én lokaal bewust combineren.