OpenCode + Ollama: set up a local coding agent

Connect Ollama to OpenCode on Windows, test file creation in the CLI, and configure the desktop app to build an Express server on port 3000.

Player not loading? Watch on YouTube

This tutorial connects Ollama to OpenCode for a self-hosted coding assistant on Windows. It assumes OpenCode is already installed and covers both the CLI and desktop app. The walkthrough starts with downloading Ollama's Windows installer and checking the installation in a terminal.

The CLI example uses a lightweight 0.8B model in build mode to create index.js with a Node.js hello world function. The speaker recommends an explicit request to save the file because the small model may otherwise print code in the terminal. Running node index.js then produces the expected message.

For the desktop example, the speaker downloads a larger 9B model and adds a custom provider. The connection uses the loopback address 127.0.0.1, port 11434 and the /v1 path, with the API key left blank. OpenCode then receives a request for an Express server on port 3000. The demonstration checks server.js and package.json before opening localhost:3000 to show the response.

The speaker says generation runs locally without external API calls. The transcript renders the model names inconsistently, so it does not establish reliable model identifiers or copyable pull commands. It also gives no RAM or GPU requirements for either model size.