LM Studio Failure to refresh models #1363

Open
opened 2026-02-16 17:30:37 -05:00 by yindo · 13 comments
Owner

Originally created by @blankenshipz on GitHub (Aug 18, 2025).

Originally assigned to: @thdxr on GitHub.

I'm running LM Studio locally and I've found that if I add/remove models in LM Studio the list of models in opencode isn't getting refreshed even if I do an auth logout auth login cycle, is there a quick way to fix this?

Originally created by @blankenshipz on GitHub (Aug 18, 2025). Originally assigned to: @thdxr on GitHub. I'm running LM Studio locally and I've found that if I add/remove models in LM Studio the list of models in opencode isn't getting refreshed even if I do an `auth logout` `auth login` cycle, is there a quick way to fix this?
Author
Owner

@blankenshipz commented on GitHub (Aug 18, 2025):

Removing the model cache file in ~/.cache/opencode/models.json also did not help this issue

@blankenshipz commented on GitHub (Aug 18, 2025): Removing the model cache file in `~/.cache/opencode/models.json` also did not help this issue
Author
Owner

@rekram1-node commented on GitHub (Aug 18, 2025):

I think I am gonna have to install LM Studio to see what you mean (never used it)

@rekram1-node commented on GitHub (Aug 18, 2025): I think I am gonna have to install LM Studio to see what you mean (never used it)
Author
Owner

@blankenshipz commented on GitHub (Aug 18, 2025):

I'm not sure it's an issue with the LM Studio exactly it's more an issue with how refreshing the models cache works - it seems like there's not a way to easily force a refresh or break the cache

When I run models in LM Studio the list of models available has a much higher rate of change then it does for a commercial vendor you can "eject" models and "load" models somewhat arbitrarily.

@blankenshipz commented on GitHub (Aug 18, 2025): I'm not sure it's an issue with the LM Studio exactly it's more an issue with how refreshing the models cache works - it seems like there's not a way to easily force a refresh or break the cache When I run models in LM Studio the list of models available has a much higher rate of change then it does for a commercial vendor you can "eject" models and "load" models somewhat arbitrarily.
Author
Owner

@shrwnsan commented on GitHub (Sep 26, 2025):

Ran into this too

I've removed certain models from the OC config file, as well as LM Studio models dir

Removed OC cache dir as well

But I still see ghost models when I do /models too

@shrwnsan commented on GitHub (Sep 26, 2025): Ran into this too I've removed certain models from the OC config file, as well as LM Studio models dir Removed OC cache dir as well But I still see ghost models when I do `/models` too
Author
Owner

@perlator commented on GitHub (Oct 17, 2025):

I believe I have encountered a similar issue. Although GitHub made Claude Sonnet General available, I see it as a preview. (GitHub Copilot Claude Sonnet 4.5 (Preview))

@perlator commented on GitHub (Oct 17, 2025): I believe I have encountered a similar issue. Although GitHub made Claude Sonnet General available, I see it as a preview. (`GitHub Copilot Claude Sonnet 4.5 (Preview)`)
Author
Owner

@rekram1-node commented on GitHub (Oct 17, 2025):

thats because the list of models comes from a models api that hasnt been updated with that change quite yet

models.dev

ill update that tho

@rekram1-node commented on GitHub (Oct 17, 2025): thats because the list of models comes from a models api that hasnt been updated with that change quite yet models.dev ill update that tho
Author
Owner

@rekram1-node commented on GitHub (Oct 17, 2025):

@perlator fixed, may require u to restart opencode but model list should refresh

@rekram1-node commented on GitHub (Oct 17, 2025): @perlator fixed, may require u to restart opencode but model list should refresh
Author
Owner

@blankenshipz commented on GitHub (Oct 31, 2025):

I'm still having this issue despite running the latest version of opencode

opencode --version
0.15.30
 opencode models | grep lmstudio
lmstudio/openai/gpt-oss-20b
lmstudio/qwen/qwen3-30b-a3b-2507
curl localhost:1234/v1/models
{
  "data": [
    {
      "id": "qwen/qwen3-vl-30b",
      "object": "model",
      "owned_by": "organization_owner"
    },
    {
      "id": "text-embedding-nomic-embed-text-v1.5",
      "object": "model",
      "owned_by": "organization_owner"
    },
    {
      "id": "openai/gpt-oss-20b",
      "object": "model",
      "owned_by": "organization_owner"
    }
  ],
  "object": "list"
}
@blankenshipz commented on GitHub (Oct 31, 2025): I'm still having this issue despite running the latest version of opencode ``` opencode --version 0.15.30 ``` ``` opencode models | grep lmstudio lmstudio/openai/gpt-oss-20b lmstudio/qwen/qwen3-30b-a3b-2507 ``` ``` curl localhost:1234/v1/models { "data": [ { "id": "qwen/qwen3-vl-30b", "object": "model", "owned_by": "organization_owner" }, { "id": "text-embedding-nomic-embed-text-v1.5", "object": "model", "owned_by": "organization_owner" }, { "id": "openai/gpt-oss-20b", "object": "model", "owned_by": "organization_owner" } ], "object": "list" } ```
Author
Owner

@rekram1-node commented on GitHub (Oct 31, 2025):

currently opencode isnt hitting the models endpoint of your provider, we should add something like that but currently everything comes from models.dev and your opencode config

@rekram1-node commented on GitHub (Oct 31, 2025): currently opencode isnt hitting the models endpoint of your provider, we should add something like that but currently everything comes from models.dev and your opencode config
Author
Owner

@KarthiDreamr commented on GitHub (Nov 16, 2025):

Image I think removing the ghost endpoint when its found no longer alive is the best way to implement this. This way, we don't need to refresh model list everytime launch etc.
@KarthiDreamr commented on GitHub (Nov 16, 2025): <img width="1920" height="1080" alt="Image" src="https://github.com/user-attachments/assets/20536bb0-e037-47cd-adc0-cac8d56b0148" /> I think removing the ghost endpoint when its found no longer alive is the best way to implement this. This way, we don't need to refresh model list everytime launch etc.
Author
Owner

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

or get this, use the api correctly?

@marduk191 commented on GitHub (Feb 5, 2026): or get this, use the api correctly?
Author
Owner

@jecruz commented on GitHub (Feb 11, 2026):

It seems when you delete models via the interface, some may not be getting cleaned up properly in the .internal/model-data.json when the names or aliases are close or the same. I think in my case, the alias was the same qwen3-coder-next. When I modified the .internal/model-data.json to remove two deleted model entries, once saved, the list of models refreshed on its own. Initially, it listed the models with their full name and the alias, and double entries for all models. I tried the refresh list, and it listed everything as expected. My issue involved similarly named models qwen3-coder-next (lingering entry) and the newly added Qwen3-Coder-Next-MLX-6bit.

@jecruz commented on GitHub (Feb 11, 2026): It seems when you delete models via the interface, some may not be getting cleaned up properly in the .internal/model-data.json when the names or aliases are close or the same. I think in my case, the alias was the same qwen3-coder-next. When I modified the .internal/model-data.json to remove two deleted model entries, once saved, the list of models refreshed on its own. Initially, it listed the models with their full name and the alias, and double entries for all models. I tried the refresh list, and it listed everything as expected. My issue involved similarly named models qwen3-coder-next (lingering entry) and the newly added Qwen3-Coder-Next-MLX-6bit.
Author
Owner

@SpencerGraffunder commented on GitHub (Feb 12, 2026):

I'm running into this problem too. I downloaded a new model in LM Studio and want to use it in OpenCode. When I do opencode models --refresh, it just gets the old list of models. Going to http://localhost:1234/v1/models shows the updated list so I think LM Studio is working fine. I reinstalled OpenCode and LM Studio, cleared cache files, and it's still the same.

@SpencerGraffunder commented on GitHub (Feb 12, 2026): I'm running into this problem too. I downloaded a new model in LM Studio and want to use it in OpenCode. When I do opencode models --refresh, it just gets the old list of models. Going to http://localhost:1234/v1/models shows the updated list so I think LM Studio is working fine. I reinstalled OpenCode and LM Studio, cleared cache files, and it's still the same.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1363