{"slug": "how-to-use-ai-running-on-your-own-computer-from-node-js-in-2026", "title": "How to Use AI Running on Your Own Computer From Node.js in 2026", "summary": "A developer has published a Node.js walkthrough for calling locally hosted AI models through OGAD (Off Grid AI Desktop), an app that serves downloaded models over an HTTP gateway on port 7878. The example script uses built-in fetch to query /v1/models, pick a local chat-capable model, and POST to /v1/chat/completions with stream disabled, avoiding external API calls. The writeup warns that the gateway's inference endpoints require no API key and should stay bound to 127.0.0.1 on a trusted network.", "body_md": "Your Node.js tool can use AI without making every prompt an external API request.\n\nOGAD (Off Grid AI Desktop) serves downloaded local models through an HTTP gateway. A Node.js script can use `fetch` to send a request, read the generated answer and add it to a workflow you already control. The model runs on your computer when you select the local route.\n\n[Download OGAD for Mac or Windows](https://getoffgridai.co/desktop/)\n\nA good first integration turns a few source notes into a draft you can inspect. For example, your build tool could prepare a short human-readable update from completed checks and known failures.\n\nInstall OGAD, download and select a local text model in **Models**, then try it in **Chat**. Open **Gateway** and check its local address. The normal port is `7878`, but use the displayed port if it differs.\n\nUse a Node.js installation with built-in `fetch`. The example needs no external package. Local chat and the gateway are core features and do not require Pro.\n\nSave this as `local-update.mjs`:\n\n``` js\nconst base = \"http://127.0.0.1:7878\";\n\nasync function request(path, payload) {\n  const response = await fetch(base + path, {\n    method: payload === undefined ? \"GET\" : \"POST\",\n    headers: { \"Content-Type\": \"application/json\" },\n    body: payload === undefined ? undefined : JSON.stringify(payload),\n    signal: AbortSignal.timeout(180_000),\n  });\n  if (!response.ok) {\n    throw new Error(`HTTP ${response.status}: ${await response.text()}`);\n  }\n  return response.json();\n}\n\nconst { data: models } = await request(\"/v1/models\");\nconst model = models.find((item) =>\n  [\"chat\", \"vision\"].includes(item.kind) && !item.remote\n);\nif (!model) throw new Error(\"Select a downloaded local text model in OGAD.\");\n\nconst result = await request(\"/v1/chat/completions\", {\n  model: model.id,\n  messages: [{\n    role: \"user\",\n    content: \"Write a short build update from these facts: unit checks passed; \" +\n      \"deployment has not run; one accessibility check is still pending. \" +\n      \"Keep completed work separate from pending work.\",\n  }],\n  max_tokens: 160,\n  stream: false,\n});\nconsole.log(result.choices[0].message.content);\n```\n\nRun it with:\n\n```\nnode local-update.mjs\n```\n\nThe model should return a draft update. Review whether it keeps deployment and the accessibility check pending. A useful test checks the facts in the answer, not whether it matches one exact sentence.\n\nThe script first reads `/v1/models`, then chooses a local chat-capable entry. That avoids hard-coding the display name of a model you might replace later.\n\n`stream: false` asks for one complete response. This suits a small command-line step. A UI can use streaming later, but it must parse streamed events rather than treating them as one JSON document.\n\nGive the model the input it needs, with a clear output request. Do not pass an entire repository into a prompt just because your script can read it. Context capacity and working memory still apply.\n\nThe example checks the HTTP status before reading the generated response. A failed model load should become an error, not an empty update that looks successful.\n\nIf the request times out, inspect the running app and selected model. A first load can take longer than a later request. Reduce an oversized input before adding repeated retries.\n\nFor machine-readable output, validate the generated content against your expected structure. Prompting for JSON alone does not replace validation.\n\nThe gateway listens on network interfaces and its inference endpoints do not require an API key. These examples use `127.0.0.1` on the same computer. Keep the host on a trusted network and do not expose this port to the public internet.\n\nDownload the required local model files before offline use. A remote provider selected in the app changes where inference runs.\n\nThese API routes are present in [OGAD 0.0.51](https://github.com/off-grid-ai/OGAD/releases/tag/v0.0.51). The running gateway also serves its API reference at `/docs`.\n\n[Download OGAD](https://getoffgridai.co/desktop/), run one request and connect it to a small draft-producing step. Keep the result visible and easy to review before automating more of the workflow.", "url": "https://wpnews.pro/news/how-to-use-ai-running-on-your-own-computer-from-node-js-in-2026", "canonical_source": "https://dev.to/alichherawalla/how-to-use-ai-running-on-your-own-computer-from-nodejs-in-2026-2pi2", "published_at": "2026-09-29 10:39:18+00:00", "updated_at": "2026-09-29 10:46:56.256833+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "large-language-models", "ai-infrastructure"], "entities": ["OGAD", "Node.js", "Off Grid AI"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/how-to-use-ai-running-on-your-own-computer-from-node-js-in-2026", "markdown": "https://wpnews.pro/news/how-to-use-ai-running-on-your-own-computer-from-node-js-in-2026.md", "text": "https://wpnews.pro/news/how-to-use-ai-running-on-your-own-computer-from-node-js-in-2026.txt", "jsonld": "https://wpnews.pro/news/how-to-use-ai-running-on-your-own-computer-from-node-js-in-2026.jsonld"}}