{"product_id":"ollama-gpu-idle-cleanup-n8n-workflow-http-logs-unload","title":"Ollama GPU Idle Cleanup n8n Workflow: HTTP Logs \u0026 Unload","description":"\u003ch3\u003eKeep your Ollama GPUs free: automatically log idle model states and unload when safe\u003c\/h3\u003e\n\u003cp\u003eThis Ollama GPU Idle Cleanup n8n workflow checks which Ollama models are currently loaded, writes state changes to a log file, and can optionally unload models that have been idle too long—helping you free GPU memory without manual monitoring.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cb\u003eRuns manually or on a 10-minute schedule\u003c\/b\u003e to continuously monitor model activity.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eLoads configuration\u003c\/b\u003e such as your Ollama base URL, \u003ci\u003eidleMinutes\u003c\/i\u003e, \u003ci\u003eassumedKeepAliveMinutes\u003c\/i\u003e, \u003ci\u003edryRun\u003c\/i\u003e, and \u003ci\u003elogPath\u003c\/i\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eCalls Ollama’s \u003ccode\u003e\/api\/ps\u003c\/code\u003e\u003c\/b\u003e to list loaded models and read each model’s \u003ccode\u003eexpires_at\u003c\/code\u003e timestamp.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eDetermines model state\u003c\/b\u003e (keep, pinned-skip, would-unload, or unload) based on idle thresholds and “pinned” logic using a far-future \u003ccode\u003eexpires_at\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eAppends a log line only when a model’s state changes\u003c\/b\u003e since the last run, reducing noisy logs.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eWhen \u003ci\u003edryRun\u003c\/i\u003e is disabled\u003c\/b\u003e, sends a \u003cb\u003ePOST to \u003ccode\u003e\/api\/generate\u003c\/code\u003e\u003c\/b\u003e with \u003ccode\u003ekeep_alive: 0\u003c\/code\u003e for each model marked for unload.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cb\u003eGPU cost control for SaaS\u003c\/b\u003e environments running Ollama via HTTP, where idle models accumulate.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eHands-off model lifecycle management\u003c\/b\u003e for n8n users who want automated cleanup every 10 minutes.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eSafe rollout with dry-run\u003c\/b\u003e: verify expected unload behavior by inspecting the log output before enabling live unloading.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details (n8n + integrations)\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cb\u003eOllama integration over HTTP\u003c\/b\u003e: \u003ccode\u003eGET \/api\/ps\u003c\/code\u003e and \u003ccode\u003ePOST \/api\/generate\u003c\/code\u003e (with \u003ccode\u003ekeep_alive: 0\u003c\/code\u003e).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eNodes used\u003c\/b\u003e: Manual Trigger, Schedule (10-minute), \u003ccode\u003ehttp request\u003c\/code\u003e, \u003ccode\u003ecode\u003c\/code\u003e, \u003ccode\u003eif\u003c\/code\u003e, \u003ccode\u003eset\u003c\/code\u003e, \u003ccode\u003esticky note\u003c\/code\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cb\u003eConfig checklist\u003c\/b\u003e: ensure n8n can reach Ollama (e.g., \u003ccode\u003ehttp:\/\/host.docker.internal:11434\u003c\/code\u003e for Docker), create a writable \u003ci\u003elogPath\u003c\/i\u003e, and tune \u003ci\u003eidleMinutes\u003c\/i\u003e \/ \u003ci\u003eassumedKeepAliveMinutes\u003c\/i\u003e to match your Ollama behavior.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46159503098035,"sku":"N8N-20393","price":41.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/ZAQ_Qit2skb0K0gM27tos_arvlYhtR.png?v=1791104653","url":"https:\/\/buyflowscripts.com\/products\/ollama-gpu-idle-cleanup-n8n-workflow-http-logs-unload","provider":"N8N Commerce","version":"1.0","type":"link"}