Back to directory

opencode setup with ollama

A step-by-step guide and Docker Compose setup for configuring OpenCode's agentic workflow to work with local Ollama models, including the context-window fix needed to make Ollama's tool-calling actually function.

opencode setup with ollama

This repository documents how to run Ollama in Docker Compose alongside OpenCode and points out a specific problem the author ran into: Ollama defaults to a 4,096-token context window regardless of what a model's card advertises, and OpenCode's agentic tool calls silently fail to work at that size. The fix shown is to run the model interactively, set a larger num_ctx parameter such as 16384, and save it as a new named model variant, then reference that variant in OpenCode's provider configuration pointed at Ollama's OpenAI-compatible endpoint.

It also documents a common cause of OpenCode hanging against Ollama on Windows: localhost resolving to the IPv6 loopback address instead of IPv4, since Ollama on Windows binds only to the IPv4 address.

More in Tutorials

See all 478
  • BootLife

    github.com

    Conway's Game of Life implemented to run directly from a 512-byte x86 boot sector in assembly, using VGA memory itself as the simulation grid.

  • A technical blog post deriving the Y combinator as a composition of combinator birds in an array language, and examining how eager evaluation changes fixed-point recursion compared with the usual lazy telling.

  • System Design Atlas

    atlas-sysdes.vercel.app

    A free reference of worked system design problems with interactive architecture diagrams, covering ranked designs such as a feed, a chat app, a URL shortener, and a rate limiter, plus pages on the technologies behind them.