Skip to content

How to set a local provider in opencode TUI? #10547

Closed

Description

@TangLaoya

Question

Dear all,

I noticed that opencode can set a local provider:
https://opencode.ai/docs/providers/#lm-studio

where should I put the file opencode.json, is the file correct?
{ "$schema": "https://opencode.ai/config.json", "provider": { "lmstudio": { "npm": "@ai-sdk/openai-compatible", "name": "LM Studio (local)", "options": { "baseURL": "http://localhost:8080/v1" }, "models": { "GLM-4.7-Flash-UD-Q5_K_XL.gguf": { "name": "GLM-4.7-Flash-UD-Q5_K_XL.gguf" } } } } }

Is there any entry to set the local provider from opencode TUI?

I use the Windows version (Windows Server 2019, latest version 1.1.35, OpenCode Desktop Installer.exe).

Thanks,
Tang Laoya

Activity

  1. github-actions commented on Jan 25, 2026

    @github-actions
    Contributor

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

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

  2. TangLaoya commented on Jan 25, 2026

    @TangLaoya
    Author

    Thanks. I found this issue
    #6783
    is useful. I tried to put config.json in %USERPROFILE%.config\opencode folder:
    { "$schema": "https://opencode.ai/config.json", "provider": { "lmstudio": { "npm": "@ai-sdk/openai-compatible", "name": "LM Studio (Local)", "options": { "baseURL": "localhost:15432/v1" }, "models": { "GLM-4.7-Flash-UD-Q5_K_XL.gguf": { "name": "GLM-4.7-Flash-UD-Q5_K_XL.gguf", } } } } }

    and start Opencode again. I found in the bottom of Opencode TUI appears 'Big Pickle', and the local models are all list here.

    But after I selected 'GLM-4.7-Flash-UD-Q5_K_XL.gguf' from the list (the llama-server also launched this one) and type a question in the window, the opencode replied:

    Error: Unable to connect. Is the computer able to access the url?

    What should I do furthermore?

    Thanks,
    Tang Laoya

  3. justfortheloveof commented on Jan 25, 2026

    @justfortheloveof
    Contributor

    Try adding http:// (or https://) to your baseURL, make sure the port is accurate as well.

  4. R44VC0RP commented on Jan 25, 2026

    @R44VC0RP
    Contributor

    Thanks @justfortheloveof for the assist!

    @TangLaoya - the fix is to add http:// to your baseURL:

    "baseURL": "http://localhost:15432/v1"

    The LM Studio docs show the correct format. Let us know if you hit any other issues!

  5. Velkez commented on Jan 25, 2026

    @Velkez

    I try this yesterday, and I had the same error. I solve this just activating the local server on developer section on LM Studio. Then I restart Opencode and this work for me. Be sure if the BaseURL is the same that LM Studio is show you.

    Image
  6. TangLaoya commented on Jan 26, 2026

    @TangLaoya
    Author

    Thanks. After set the correct BaseURL, the problem is solved.

  7. TangLaoya commented on Jan 26, 2026

    @TangLaoya
    Author

    However, currently although the opencode is connected with the llama_server, the same question, the web by llama_server can give result after several minutes, but in the opencode, I have waited for more than 1 hours, no any response...

    Is there still something wrong?

    Thanks,
    Tang Laoya

  8. Velkez commented on Jan 26, 2026

    @Velkez

    However, currently although the opencode is connected with the llama_server, the same question, the web by llama_server can give result after several minutes, but in the opencode, I have waited for more than 1 hours, no any response...

    Is there still something wrong?

    Thanks, Tang Laoya

    Hello Tang Laoya, thats because Opencode send a lot of context in tokens. If you have MCPs the number of tokens increments. A partial solution is disable the MCPs servers. In my case, in LM Studio, I send a simple greeting, and I had a response in seconds, but then I try the same thing in Opencode and I had a response in 4 minute, for a simple greeting. That's because Opencode send to the local model 18k of tokens of context approx. While in LM Studio send a few 42 tokens. The model had a lot of tokens to process in comparison

  9. TangLaoya commented on Jan 27, 2026

    @TangLaoya
    Author

    That's great, thank you very much.
    But how to disable the MCPs servers in opencode?

    Thanks,
    Tang Laoya

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions