Local Ollama models not included in model listing, breaking plugin model discovery #8579

Open
opened 2026-02-16 18:10:18 -05:00 by yindo · 3 comments
Owner

Originally created by @rooftop-Owl on GitHub (Feb 5, 2026).

Originally assigned to: @thdxr on GitHub.

Description

When Ollama is registered as a provider in opencode.json, the SDK's model listing does not include Ollama models. The provider appears in the "connected" list, but the models object remains empty for Ollama.

This causes plugins (e.g., oh-my-opencode) that rely on model discovery to fail when routing tasks to local Ollama models.

What works:

  • Ollama provider is recognized (appears in connected array)
  • Direct model usage works when explicitly specified by a plugin
  • Ollama's own API responds correctly (GET /v1/models returns all models)

What doesn't work:

  • Model listing never includes Ollama models
  • Plugin caches (provider-models.json) stay empty for Ollama
  • Category-based delegation in plugins can't discover Ollama models

Plugins

oh-my-opencode 3.2.3


OpenCode version

1.1.51


Steps to reproduce

  1. Install and start Ollama:

    ollama serve
    ollama pull ministral-3:14b-32k-agent
    
  2. Configure Ollama provider in ~/.config/opencode/opencode.json:

    {
      "provider": {
        "ollama": {
          "name": "Ollama",
          "npm": "@ai-sdk/openai-compatible",
          "options": { "baseURL": "http://localhost:11434/v1" },
          "models": {
            "ministral-3:14b-32k-agent": { "name": "ministral-3:14b-32k-agent" }
          }
        }
      }
    }
    
  3. Start OpenCode and check provider cache:

    cat ~/.cache/oh-my-opencode/provider-models.json
    
  4. Observe: "models": {} — Ollama models are missing despite provider being connected.

  5. Verify Ollama API works directly:

    curl http://localhost:11434/v1/models
    # Returns: { "data": [{ "id": "ministral-3:14b-32k-agent", ... }] }
    

Screenshot and/or share link

Cache file showing the issue:

{
  "models": {},
  "connected": ["openai", "google", "anthropic", "opencode", "ollama"],
  "updatedAt": "2026-02-05T05:24:52.824Z"
}

Note: ollama is in connected but models is empty.


Operating System

Linux


Terminal

SSH


Additional Notes

Current workaround: Manually query ollama list and inject models into the provider cache. This is fragile — gets overwritten on provider refresh.

Suggested approach: When a provider uses npm: "@ai-sdk/openai-compatible" and has a baseURL, query GET {baseURL}/models to discover available models. Ollama (and LM Studio, etc.) all support this OpenAI-compatible endpoint.

Impact: Any plugin relying on model discovery cannot use local models without manual workarounds. This affects the growing ecosystem of users running local models for cost savings and privacy.


Related Issues & Active Development

Awareness note: We've identified significant related work and wanted to cross-reference for visibility.

Canonical Feature Request

  • #6231 — Auto-discover models from OpenAI-compatible provider endpoints (assigned to @thdxr)

Active Development (models-endpoint feature branch)

  • #8359 [MERGED → models-endpoint, Jan 30] — Auto model detection for OpenAI-compatible providers
  • #11951 [OPEN → models-endpoint, Feb 3] — Probe loaded models from LM Studio, Ollama, and llama.cpp
    • Adds provider/local/ollama.ts, provider/local/lmstudio.ts, provider/local/llamacpp.ts
    • Feature branch not yet promoted to dev

Related PRs (direct to dev)

  • #3726 [OPEN] — Auto-detection of ollama local with baseURL variable
  • #7644 [CLOSED] — Auto-discover from local providers (earlier attempt)
  • #8748 [OPEN] — Probe loaded models from LM Studio and Ollama
  • #10758 [OPEN] — Auto-detect Ollama context limits

Related Issues (same root cause)

  • #4232 — OpenCode displays models which aren't configured & don't exist in LM Studio
  • #7873 — Ollama - Multiple Cloud Models are missing
  • #9581 — Model List differ between the CLI and Web
  • #7714 — The cache of the Provider's Models cannot be updatable

Downstream Impact (oh-my-opencode plugin)

Originally created by @rooftop-Owl on GitHub (Feb 5, 2026). Originally assigned to: @thdxr on GitHub. ## Description When Ollama is registered as a provider in `opencode.json`, the SDK's model listing does not include Ollama models. The provider appears in the "connected" list, but the `models` object remains empty for Ollama. This causes plugins (e.g., oh-my-opencode) that rely on model discovery to fail when routing tasks to local Ollama models. **What works:** - Ollama provider is recognized (appears in `connected` array) - Direct model usage works when explicitly specified by a plugin - Ollama's own API responds correctly (`GET /v1/models` returns all models) **What doesn't work:** - Model listing never includes Ollama models - Plugin caches (`provider-models.json`) stay empty for Ollama - Category-based delegation in plugins can't discover Ollama models --- ## Plugins oh-my-opencode 3.2.3 --- ## OpenCode version 1.1.51 --- ## Steps to reproduce 1. Install and start Ollama: ```bash ollama serve ollama pull ministral-3:14b-32k-agent ``` 2. Configure Ollama provider in `~/.config/opencode/opencode.json`: ```json { "provider": { "ollama": { "name": "Ollama", "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://localhost:11434/v1" }, "models": { "ministral-3:14b-32k-agent": { "name": "ministral-3:14b-32k-agent" } } } } } ``` 3. Start OpenCode and check provider cache: ```bash cat ~/.cache/oh-my-opencode/provider-models.json ``` 4. Observe: `"models": {}` — Ollama models are missing despite provider being connected. 5. Verify Ollama API works directly: ```bash curl http://localhost:11434/v1/models # Returns: { "data": [{ "id": "ministral-3:14b-32k-agent", ... }] } ``` --- ## Screenshot and/or share link Cache file showing the issue: ```json { "models": {}, "connected": ["openai", "google", "anthropic", "opencode", "ollama"], "updatedAt": "2026-02-05T05:24:52.824Z" } ``` Note: `ollama` is in `connected` but `models` is empty. --- ## Operating System Linux --- ## Terminal SSH --- ## Additional Notes **Current workaround**: Manually query `ollama list` and inject models into the provider cache. This is fragile — gets overwritten on provider refresh. **Suggested approach**: When a provider uses `npm: "@ai-sdk/openai-compatible"` and has a `baseURL`, query `GET {baseURL}/models` to discover available models. Ollama (and LM Studio, etc.) all support this OpenAI-compatible endpoint. **Impact**: Any plugin relying on model discovery cannot use local models without manual workarounds. This affects the growing ecosystem of users running local models for cost savings and privacy. --- ## Related Issues & Active Development **Awareness note**: We've identified significant related work and wanted to cross-reference for visibility. ### Canonical Feature Request - **#6231** — Auto-discover models from OpenAI-compatible provider endpoints (assigned to @thdxr) ### Active Development (`models-endpoint` feature branch) - **#8359** [MERGED → `models-endpoint`, Jan 30] — Auto model detection for OpenAI-compatible providers - **#11951** [OPEN → `models-endpoint`, Feb 3] — Probe loaded models from LM Studio, Ollama, and llama.cpp - Adds `provider/local/ollama.ts`, `provider/local/lmstudio.ts`, `provider/local/llamacpp.ts` - Feature branch not yet promoted to `dev` ### Related PRs (direct to `dev`) - **#3726** [OPEN] — Auto-detection of ollama local with baseURL variable - **#7644** [CLOSED] — Auto-discover from local providers (earlier attempt) - **#8748** [OPEN] — Probe loaded models from LM Studio and Ollama - **#10758** [OPEN] — Auto-detect Ollama context limits ### Related Issues (same root cause) - **#4232** — OpenCode displays models which aren't configured & don't exist in LM Studio - **#7873** — Ollama - Multiple Cloud Models are missing - **#9581** — Model List differ between the CLI and Web - **#7714** — The cache of the Provider's Models cannot be updatable ### Downstream Impact (oh-my-opencode plugin) - **code-yeongyu/oh-my-opencode#1508** — Category delegation fails due to empty model cache - **code-yeongyu/oh-my-opencode#1509** — Bridge fix: handle both string[] and object[] cache formats (covers the gap until auto-discovery ships)
Author
Owner

@github-actions[bot] commented on GitHub (Feb 5, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6231: Auto-discover models from OpenAI-compatible provider endpoints (feature request that would resolve this)
  • #7873: Ollama - Multiple Ollama Cloud Models are missing (same root cause)
  • #8950: Ollama custom provider error: agent configured model is not valid (same symptom - plugins failing with Ollama)
  • #9581: Model List differ between the CLI and Web (model discovery gaps for Ollama)
  • #7714: The cache of the Provider's Models cannot be updatable (caching issues affecting LM Studio/Ollama)
  • #5694: Local Ollama models are not agentic (plugin/tool calling issues with Ollama)
  • #7083: Using local Ollama models doesn't return any results (Ollama response handling)

The most likely candidate for closure is #6231, which is the original feature request for auto-discovery of models from OpenAI-compatible endpoints like Ollama's /v1/models endpoint.

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Feb 5, 2026): This issue might be a duplicate of existing issues. Please check: - #6231: Auto-discover models from OpenAI-compatible provider endpoints (feature request that would resolve this) - #7873: Ollama - Multiple Ollama Cloud Models are missing (same root cause) - #8950: Ollama custom provider error: agent configured model is not valid (same symptom - plugins failing with Ollama) - #9581: Model List differ between the CLI and Web (model discovery gaps for Ollama) - #7714: The cache of the Provider's Models cannot be updatable (caching issues affecting LM Studio/Ollama) - #5694: Local Ollama models are not agentic (plugin/tool calling issues with Ollama) - #7083: Using local Ollama models doesn't return any results (Ollama response handling) The most likely candidate for closure is **#6231**, which is the original feature request for auto-discovery of models from OpenAI-compatible endpoints like Ollama's `/v1/models` endpoint. Feel free to ignore if none of these address your specific case.
Author
Owner

@t1anchen commented on GitHub (Feb 5, 2026):

I'm having same issue on 1.1.51. When I use ollama with qwen2.5-coder:7b-instruct, the model can generate code correctly but cannot be recognized by opencode. When I input prompt like

Check if main.py exists, then create a file named test_bash.sh that prints 'OpenCode is active', and finally run it.

it only returns JSON response like below but nothing changes/updates in the workspace

{
  "name": "Edit",
  "arguments": {
    "file_path": "test_bash.sh",
    "content": "#!/bin/bash\n\necho 'OpenCode is active'"
  }
}

The opencode.json looks like

{
  "$schema": "https://opencode.ai/config.json",
  "permission": {
    "*": "ask",
    "read": "allow",
    "edit": "allow",
    "write": "allow",
    "bash": "allow"
  },
  "provider": {
    "ollama": {
      "models": {
        "qwen2.5-coder:7b-instruct": {
          "_launch": true,
          "name": "qwen2.5-coder:7b-instruct"
        }
      },
      "name": "Ollama (local)",
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "http://127.0.0.1:11434/v1",
        "num_ctx": 8192
      }
    }
  }
}
@t1anchen commented on GitHub (Feb 5, 2026): I'm having same issue on `1.1.51`. When I use ollama with `qwen2.5-coder:7b-instruct`, the model can generate code correctly but cannot be recognized by opencode. When I input prompt like ``` Check if main.py exists, then create a file named test_bash.sh that prints 'OpenCode is active', and finally run it. ``` it only returns JSON response like below but nothing changes/updates in the workspace ```json { "name": "Edit", "arguments": { "file_path": "test_bash.sh", "content": "#!/bin/bash\n\necho 'OpenCode is active'" } } ``` The opencode.json looks like ```json { "$schema": "https://opencode.ai/config.json", "permission": { "*": "ask", "read": "allow", "edit": "allow", "write": "allow", "bash": "allow" }, "provider": { "ollama": { "models": { "qwen2.5-coder:7b-instruct": { "_launch": true, "name": "qwen2.5-coder:7b-instruct" } }, "name": "Ollama (local)", "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "http://127.0.0.1:11434/v1", "num_ctx": 8192 } } } } ```
Author
Owner

@manascb1344 commented on GitHub (Feb 15, 2026):

I have the same issue with a custom provider instead of Ollama. I have 100+ models that change daily, and the model listing never includes them. The provider appears in "connected" but the models object remains empty.
This breaks any functionality that relies on model discovery. The current workaround of manually querying the provider's API and injecting models into the cache is fragile and doesn't scale with 100+ models.

@manascb1344 commented on GitHub (Feb 15, 2026): I have the same issue with a custom provider instead of Ollama. I have 100+ models that change daily, and the model listing never includes them. The provider appears in "connected" but the `models` object remains empty. This breaks any functionality that relies on model discovery. The current workaround of manually querying the provider's API and injecting models into the cache is fragile and doesn't scale with 100+ models.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8579