Running Open-source Models projects locally
Use this page to run either extracted Open-source Models project. One loads a Transformers.js model in your browser; the other runs an Express server that calls Ollama on your computer. Identify which project you have, then follow only that setup.
What you need first
Install a supported LTS version of Node.js. Node 24 is recommended and includes npm. If Node and npm are new to you, Running the code locally walks through installing and checking both.
The Transformers.js project needs a current browser, an internet connection for its first library and model download, and enough browser storage and memory for the model. It does not need an API key.
The Ollama project also needs Ollama, enough disk space and memory for the mistral model, and its local Ollama service running. It does not need a provider account or API key.
Identify the project you extracted
Open a terminal in the extracted folder containing package.json:
$ cd path-to-your-downloaded-projectIf the folder name does not tell you which lesson you extracted, open index.js. An express import means the Ollama lesson, which needs the package repair below; a Transformers.js import means the browser app, which runs without any changes.
package.json, the way you would stand in the kitchen before you start cooking. A browser-model project follows the Transformers.js section; the Express server follows the Ollama section. I once ran an entire setup from one directory above the project folder, so check where you are first. Run the Transformers.js project
Use these instructions for AI Models In The Browser With Transformers.js. This project needs Node and npm for Vite.
Install and start it:
$ npm install
$ npm startOpen the Local URL Vite prints, usually http://localhost:5173/. The page first imports Transformers.js from jsDelivr and then downloads the Xenova/yolos-tiny object-detection model. Wait until its status changes from Loading model... to Ready before selecting Detect Objects.
The first load needs an internet connection and can take longer than an ordinary frontend page; later loads come from the browser cache. If the status never reaches Ready, open the DevTools Network tab: a blocked jsDelivr request points to a CDN or content-blocker problem, while a slowly growing model file means the weights download is still in progress. Stop Vite with Ctrl+C.
No provider credential is needed
The model executes in your browser rather than through a hosted inference API. There is no .env file or API key to configure for this lesson.
npm install, then npm start, open the Local URL, and wait for the status to reach Ready before selecting anything. The first model download is slow one time only, and after that the browser keeps its own copy. I used to click early and assume I had broken something, so give it a moment. Repair and run the Ollama project
Use these instructions for Download and Run AI Models on Your Computer with Ollama. The exported ZIP contains the lesson's Node code, but its generated package.json still describes a Vite project. It cannot run locally without a small package repair.
After installing Ollama, make sure its local service is running. Download the model named by the lesson code:
$ ollama pull mistral
$ ollama lsThe second command should list mistral. Depending on your operating system, opening the Ollama application starts the service automatically. If it does not, run ollama serve in a separate terminal and leave it running.
In the extracted project, add "type": "module" as a top-level property of package.json, a sibling of "scripts":
{
"type": "module",
"scripts": {
"start": "vite"
}
}Then change the start script from:
"start": "vite"to:
"start": "node index.js"Install the two dependencies imported by index.js:
$ npm install express ollama
$ npm startThe server prints:
Server is running on port 3000Test the route without invoking a model:
http://localhost:3000/It should ask you to supply a question parameter. Then try a real local model request:
http://localhost:3000/?question=Why%20is%20the%20sky%20blue%3FThe Express server waits while Ollama loads the model and generates its reply. The first response can be noticeably slower. Stop Express with Ctrl+C. Stop a separately launched ollama serve process with Ctrl+C when you no longer need it.
You need no provider API key or .env file for either project; the model weights and inference stay on the machine running Ollama. The course's hosted-model projects work differently: Running Agents locally shows the key and .env setup they need.
mistral model, keep Ollama running, then fix package.json: add the module type and point the start script at node index.js. Install express and ollama, start the server, and ask it a question on port 3000. A slow first answer means the model is loading, not that anything broke, which I wish someone had told me the first time. Troubleshooting
The Transformers.js page stays on Loading model...: Check the browser console and network connection. Content blockers or a restricted network may block jsDelivr or the model download. Try a current browser with enough free storage and memory.
The Ollama project says Cannot find package 'express' or 'ollama': Run npm install express ollama in the folder containing package.json.
Node says Cannot use import statement outside a module: Add "type": "module" to package.json.
npm start launches Vite or complains about a missing index.html: Change the start script to node index.js. The Ollama lesson is a Node server, not a Vite page.
The route cannot connect to Ollama: Confirm the Ollama application or ollama serve is running, then use ollama ls to confirm the mistral model is installed.
Port 3000 is already in use: Stop the other process or change the port constant in index.js, restart Express, and open the matching URL.

