anomalyco / anomalyco/opencode

Ollama local model becomes ~7x slower through OpenCode than direct Ollama API

Open
#46,506 1 comment 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Sep 1, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

OpenCode is extremely slow when using a local Ollama Qwen3.8 27B model, even though Ollama itself is not under significant CPU load.

The important issue is not a percentage slowdown, but the additional ~4 minutes of wall-clock time added by OpenCode.

Measured comparison
Setup | Time -- | -- Qwen3.8 direct via Ollama API | ~38 sec Qwen3.8 via OpenCode | ~4 min 41 sec Qwen3.8 direct via Ollama API | ~36 sec Qwen3.8 via OpenCode | ~4 min 39 sec

So OpenCode adds approximately 4 minutes per request compared with calling the same Ollama model directly.

Additional observations
  • The same Ollama model responds quickly when called directly through the Ollama OpenAI-compatible API.

  • With OpenCode, the OpenCode process can reach approximately 35% CPU.

  • During this time, Ollama is often at almost 0% CPU, suggesting that the delay is not caused by model inference itself.

  • The problem therefore appears to be somewhere in OpenCode / its AI SDK integration / request processing rather than Ollama model performance.

  • I am not looking for a different model. The goal is to make the existing Qwen3.8 27B + Ollama setup perform normally through OpenCode.

  • I am also not looking for a workaround that fundamentally changes the setup. I would prefer a simple configuration or software fix.

  • If OpenCode cannot use the local Ollama model without adding several minutes of latency, I will likely return to AIStudio.

Important terminal observation

The same OpenCode/Ollama setup behaves differently depending on how OpenCode is accessed:

  • Through iTerm2/SSH, the behaviour is noticeably different from

  • Through macOS Screen Sharing.

This may be relevant because the OpenCode process appears to consume significant CPU while Ollama is idle.

Direct Ollama test

Calling Ollama directly is fast:

time curl -s http://localhost:11434/v1/chat/completions \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "qwen3.8:latest",
    "messages": [
      {"role": "user", "content": "Reply with exactly: READY"}
    ],
    "stream": false,
    "reasoning_effort": "none"
  }' | python3 -m json.tool

Result: approximately 0.8 seconds.

Without reasoning_effort: "none", the same request took several seconds and returned ~37–38 reasoning tokens. With reasoning_effort: "none", it returned only 2 completion tokens and completed in ~0.8 seconds.

Environment
  • macOS

  • Mac Studio M1

  • OpenCode 1.18.25

  • Ollama 0.32.14

  • Model: qwen3.8:latest

  • Qwen parameters: 27.3B

  • Quantization: Q4_K_M

  • Ollama reports the model running at 100% GPU

  • Ollama context shown by ollama ps: 32768

  • OLLAMA_MAX_LOADED_MODELS=2

OpenCode configuration
{
  "$schema": "https://opencode.ai/config.json",
  "model": "ollama/qwen3.8:latest",
  "small_model": "ollama/gemma4:26b",
  "formatter": true,
  "permission": {
    "external_directory": {
      "~/My Drive/Development/**": "allow"
    },
    "edit": {
      "~/My Drive/Development/AIStudio/**": "allow"
    }
  },
  "provider": {
    "ollama": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Ollama (local)",
      "options": {
        "baseURL": "http://localhost:11434/v1"
      },
      "models": {
        "qwen3.8:latest": {
          "name": "Qwen3.8 27B (local)",
          "tool_call": true,
          "reasoning": false,
          "attachment": true,
          "limit": {
            "context": 262144,
            "output": 65536
          }
        },
        "gemma4:26b": {
          "name": "Gemma 4 26B (local)",
          "tool_call": true,
          "reasoning": true
        },
        "gpt-oss:20b-cloud": {
          "name": "GPT-OSS 20B (cloud)",
          "tool_call": true,
          "reasoning": true
        }
      }
    }
  }
}

The key point is that the model is explicitly configured in OpenCode with:

"reasoning": false

yet the direct Ollama API test showed that omitting reasoning_effort: "none" causes Qwen3.8 to generate ~37–38 reasoning tokens and adds several seconds of latency.

I would like to know whether OpenCode 1.18.25 / the @ai-sdk/openai-compatible integration is correctly disabling reasoning for Ollama/Qwen3.8, and whether there is a known issue causing OpenCode itself to spend several minutes processing a request while Ollama is essentially idle.

Plugins

No response

OpenCode version

No response

Steps to reproduce

No response

Screenshot and/or share link

No response

Operating System

Apple M1 Ultra, 26.5.1 (25F80)

Terminal

iterm2 and screen both give same issue

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.