Skip to content
FrontierDot

Use Ollama local models with OpenCode

OpenCode and Ollama each publish an opencode.json example. The local base URL matches. The display name and the example model id do not. Both are quoted here.

OpenCode’s example

File opencode.json. The provider id in the example is ollama, and OpenCode says that id can be any string you want. npm is @ai-sdk/openai-compatible. name is “Ollama (local)”. options.baseURL is http://localhost:11434/v1. The example model id is llama2 with name “Llama 2”. OpenCode says the model name is what shows in the model list.

If tool calls are not working, OpenCode says to raise num_ctx in Ollama, starting around 16k–32k. OpenCode also says Ollama can configure itself and links Ollama’s integration page.

Ollama’s example

The Ollama docs homepage fetched the same day did not contain port 11434. The URL above is from the two integration pages.

Other notes

Sources

Last checked 2026-10-22.