Skip to content

LM Studio Failure to refresh models #2047

Closed as not planned
Closed as not planned

Description

@blankenshipz

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?

Activity

  1. blankenshipz commented on Aug 18, 2025

    @blankenshipz
    Author

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

  2. rekram1-node commented on Aug 18, 2025

    @rekram1-node
    Collaborator

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

  3. blankenshipz commented on Aug 18, 2025

    @blankenshipz
    Author

    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.

  4. shrwnsan commented on Sep 26, 2025

    @shrwnsan

    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

  5. perlator commented on Oct 17, 2025

    @perlator

    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))

  6. rekram1-node commented on Oct 17, 2025

    @rekram1-node
    Collaborator

    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

  7. rekram1-node commented on Oct 17, 2025

    @rekram1-node
    Collaborator

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

  8. blankenshipz commented on Oct 31, 2025

    @blankenshipz
    Author

    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"
    }
    
  9. rekram1-node commented on Oct 31, 2025

    @rekram1-node
    Collaborator

    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

  10. KarthiDreamr commented on Nov 16, 2025

    @KarthiDreamr
    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.
  11. marduk191 commented on Feb 5, 2026

    @marduk191

    or get this, use the api correctly?

  12. jecruz commented on Feb 11, 2026

    @jecruz

    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.

  13. SpencerGraffunder commented on Feb 12, 2026

    @SpencerGraffunder

    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.

  14. ggppdk commented on Apr 10, 2026

    @ggppdk

    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.

    In my case
    1, i deleted a model
    2. then restored it from backup

    and when going to its download page it was showing the model as already downloaded
    ... and i could still load it manually

    So deleting this
    USER_FOLDER/.lmstudio/.internal/model-data.json
    did the trick (to make the restored-from-backup model to reappear):

    Alternatively this worked too:
    Changing the flag
    transient: true
    to
    transient: false

    Another option was to rename the parent folder of the model, this also made the model to reappear inside the ui and in the list via the API

  15. Red-Cat-Fat commented on Jun 5, 2026

    @Red-Cat-Fat

    Hello, the problem is still present in version 1.16.2

    opencode --version
    1.16.2
    

    I had LMStudio installed on my computer with several models that I hadn't used for a long time. I decided to update the list, but in the process, I accidentally deleted them and downloaded more recent versions. As a result, they remained in the opencode memory. The command opencode models --refresh doesn't update the list.
    Could you please tell me where the model list is stored? I might try to fix this bug myself, if I can.

    PS. If I request a list of models from LM Studio using curl http://localhost:1234/v1/models it returns a correct list. Therefore, I suspect that the models are not being updated by opencode.

  16. wweeks commented on Jun 12, 2026

    @wweeks

    @Red-Cat-Fat
    Just found this project, and this problem... I think what they mean is https://models.dev/providers/lmstudio/

    It is building its models list from models.dev (website), not your local models list.

  17. kingeke commented on Jun 16, 2026

    @kingeke

    @wweeks do you know how we can get it to read the local models list instead?

  18. HyperboreanSlug commented on Jul 6, 2026

    @HyperboreanSlug

    @Red-Cat-Fat Just found this project, and this problem... I think what they mean is https://models.dev/providers/lmstudio/

    It is building its models list from models.dev (website), not your local models list.

    This appears to be exactly what's going on, and the problem still persists.

  19. GBry commented on Jul 13, 2026

    @GBry

    This is very crucial. How can we solve this? Add the model manually?

  20. PigeonCoding commented on Jul 17, 2026

    @PigeonCoding

    My current workaround is to use this project https://github.com/agustif/opencode-lmstudio

  21. aadityabhatia commented on Jul 18, 2026

    @aadityabhatia

    There is an unmerged pull request at sethjones/opencode/pull/2 that was referenced in #18011 but closed last month. Curious why it was not merged.

  22. aadityabhatia commented on Jul 18, 2026

    @aadityabhatia

    Likely duplicate: #23327

  23. github-actions commented on Sep 17, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions