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

Closed
opened 2026-02-16 18:07:30 -05:00 by yindo · 9 comments
Owner

Originally created by @TangLaoya on GitHub (Jan 25, 2026).

Originally assigned to: @jayair on GitHub.

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

Originally created by @TangLaoya on GitHub (Jan 25, 2026). Originally assigned to: @jayair on GitHub. ### 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
yindo added the windowsdocs labels 2026-02-16 18:07:30 -05:00
yindo closed this issue 2026-02-16 18:07:31 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 25, 2026):

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

  • #1480: Local LLM Support on MAC with LM Studio - direct question about local provider setup with LM Studio
  • #1555: LM Studio Missing as Provider - custom provider configuration for LM Studio
  • #1669: How to configure a local large model - general local model configuration
  • #3407: opencode.json/config.json search path - addresses where to put configuration files
  • #1235: Config in windows? - Windows-specific configuration question
  • #1228: My configured ~/.opencode.json is immediately overwritten - opencode.json configuration persistence
  • #9071: 'Other' option missing for Custom Provider configuration - TUI provider configuration in v1.1.25
  • #6783: Running OpenCode Desktop application with local model - local model configuration
  • #4232: OpenCode displays models which aren't configured - LM Studio integration

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

@github-actions[bot] commented on GitHub (Jan 25, 2026): This issue might be a duplicate of existing issues. Please check: - #1480: Local LLM Support on MAC with LM Studio - direct question about local provider setup with LM Studio - #1555: LM Studio Missing as Provider - custom provider configuration for LM Studio - #1669: How to configure a local large model - general local model configuration - #3407: opencode.json/config.json search path - addresses where to put configuration files - #1235: Config in windows? - Windows-specific configuration question - #1228: My configured ~/.opencode.json is immediately overwritten - opencode.json configuration persistence - #9071: 'Other' option missing for Custom Provider configuration - TUI provider configuration in v1.1.25 - #6783: Running OpenCode Desktop application with local model - local model configuration - #4232: OpenCode displays models which aren't configured - LM Studio integration Feel free to ignore if none of these address your specific case.
Author
Owner

@TangLaoya commented on GitHub (Jan 25, 2026):

Thanks. I found this issue
https://github.com/anomalyco/opencode/issues/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

@TangLaoya commented on GitHub (Jan 25, 2026): Thanks. I found this issue https://github.com/anomalyco/opencode/issues/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
Author
Owner

@justfortheloveof commented on GitHub (Jan 25, 2026):

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

@justfortheloveof commented on GitHub (Jan 25, 2026): Try adding `http://` (or `https://`) to your baseURL, make sure the port is accurate as well.
Author
Owner

@R44VC0RP commented on GitHub (Jan 25, 2026):

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!

@R44VC0RP commented on GitHub (Jan 25, 2026): Thanks @justfortheloveof for the assist! @TangLaoya - the fix is to add `http://` to your baseURL: ```json "baseURL": "http://localhost:15432/v1" ``` The [LM Studio docs](https://opencode.ai/docs/providers/#lm-studio) show the correct format. Let us know if you hit any other issues!
Author
Owner

@Velkez commented on GitHub (Jan 25, 2026):

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
@Velkez commented on GitHub (Jan 25, 2026): 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. <img width="1919" height="1079" alt="Image" src="https://github.com/user-attachments/assets/e3970ac4-50df-4352-9bca-3e6c0a925453" />
Author
Owner

@TangLaoya commented on GitHub (Jan 25, 2026):

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

@TangLaoya commented on GitHub (Jan 25, 2026): Thanks. After set the correct BaseURL, the problem is solved.
Author
Owner

@TangLaoya commented on GitHub (Jan 25, 2026):

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

@TangLaoya commented on GitHub (Jan 25, 2026): 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
Author
Owner

@Velkez commented on GitHub (Jan 26, 2026):

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

@Velkez commented on GitHub (Jan 26, 2026): > 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
Author
Owner

@TangLaoya commented on GitHub (Jan 26, 2026):

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

Thanks,
Tang Laoya

@TangLaoya commented on GitHub (Jan 26, 2026): That's great, thank you very much. But how to disable the MCPs servers in opencode? Thanks, Tang Laoya
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#7547