Skip to main content
Watch: I Built an AI App Without Leaving Databricks

Setup guide - Documented by Ollama

Use Ollama in OpenCode

OpenCode talks to Ollama through the @ai-sdk/openai-compatible provider pointed at http://localhost:11434/v1, or via ollama launch opencode, which injects an inline config for the chosen model.

Last verified 6 steps2 official sources

Steps

  1. Step 1.

    Quick start.

    Terminal
    ollama launch opencode
  2. Step 2.

    Manual setup step 1: install OpenCode (macOS / Linux).

    Terminal
    curl -fsSL https://opencode.ai/install | bash
  3. Step 3.

    Manual setup step 1 (Windows).

    Terminal
    npm install -g opencode-ai
  4. Step 4.

    Step 2: add an Ollama provider to opencode.json.

    JSON
    {
      "$schema": "https://opencode.ai/config.json",
      "provider": {
        "ollama": {
          "npm": "@ai-sdk/openai-compatible",
          "name": "Ollama",
          "options": {
            "baseURL": "http://localhost:11434/v1"
          },
          "models": {
            "qwen3.5": {
              "name": "qwen3.5"
            }
          }
        }
      }
    }
  5. Step 5.

    Step 3: run OpenCode.

    Terminal
    opencode
  6. Step 6.

    Configure OpenCode with Ollama without starting an interactive session.

    Terminal
    ollama launch opencode --config

Caveats

  • Steps come from Ollama's OpenCode integration page; OpenCode's own provider docs were not read today.
  • OpenCode requires a context length of 64k or higher per Ollama.
  • ollama launch opencode does not overwrite ~/.config/opencode/opencode.json; models defined only in opencode.json do not appear in the ollama launch model picker.

FAQ

How do I use Ollama in OpenCode?

OpenCode talks to Ollama through the @ai-sdk/openai-compatible provider pointed at http://localhost:11434/v1, or via ollama launch opencode, which injects an inline config for the chosen model.

Which Ollama model ids work in OpenCode?

The official docs read for this guide list qwen3.5. Requests go to http://localhost:11434/v1.

Is this an official Ollama and OpenCode setup?

Ollama documents this setup in its own docs. It was last checked against 2 official pages on October 17, 2026.

Sources

Last verified against 2 official pages.

Newsletter

New models, set up the day they ship

One email per week. New model releases, the coding tools that support them and how to wire them up.