GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(opencode): add dynamic configuration and context discovery for LM Studio by TrentPierce · Pull Request #15732 · anomalyco/opencode

Conversation

@TrentPierce

@TrentPierce TrentPierce commented Mar 2, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #
#6231
#2456
#11141
#4232
Possibly many others related to LMStudio.

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR improves the LM Studio provider integration by allowing users to specify a custom server address and automatically discover their loaded model and context limits.

  • Configurable Base URL: Added a prompt during auth login to override the default LM Studio server address (e.g., for users running on different ports or remote machines).

  • Dynamic Context Discovery: The LMStudio loader now queries /v1/models to fetch the max_context_length and automatically configures model limits.

  • Improved Stability: Added an 8k token floor for context and a warning if a model is configured with less than 32k tokens (which can cause issues with OpenCode's system prompt).

How did you verify your code works?

  • Discovery: Ran opencode models --provider lmstudio --verbose and confirmed that max_context_length from LM Studio correctly populated the model's limit.context.

  • Connectivity: Verified that auth login correctly saves and uses a custom baseURL in auth.json.

  • Inference: Ran a test prompt using opencode run --model lmstudio/ to ensure the combined system prompt and user query fit within the dynamically discovered context window.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

WesCook, TrentPierce, Scalamando, olihou, Packsolite, fschaupp, crsqq, Skyedra, and sleepless reacted with thumbs up emoji nilswx, kevincali, olihou, and Skyedra reacted with hooray emoji rh-y0n1 and Skyedra reacted with rocket emoji
All reactions
  • 👍 9 reactions
  • 🎉 4 reactions
  • 🚀 2 reactions
TrentPierce added 4 commits March 2, 2026 08:51
@TrentPierce
feat(lmstudio): add dynamic model discovery and configurable server a…
0144926
…ddress
@TrentPierce
feat(lmstudio): dynamically fetch context limits from LM Studio
dc4c539
@TrentPierce
Merge branch 'anomalyco:dev' into dev
d27a999
@TrentPierce
fix(opencode): remove unsupported placeholder from password prompt
c87eedf
@nilswx

nilswx commented Mar 3, 2026

Copy link
Copy Markdown

Great, thank you! This feature is long overdue. Manually configuring local models and their capabilities, variants, etc is nuts. Automatic discovery is far better for most use cases.

TrentPierce, danielcherubini, Skyedra, and sleepless reacted with thumbs up emoji
All reactions
  • 👍 4 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Mar 3, 2026
📊 AI CLI 工具社区动态日报 2026-03-03 duanyytop/agents-radar#50
Closed
📊 AI CLI 工具社区动态日报 2026-03-03 duanyytop/agents-radar#55
Closed
@TrentPierce

TrentPierce commented Mar 3, 2026

Copy link
Copy Markdown
Author

Great, thank you! This feature is long overdue. Manually configuring local models and their capabilities, variants, etc is nuts. Automatic discovery is far better for most use cases.

Thank you! I have developed a few tools for LMStudio, so I was surprised to see it not working well with OpenCode. This pull request was tested with the latest version of LMStudio. There are many more metrics we can discover automatically if needed in the future as well.

nilswx reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dylancvdean dylancvdean mentioned this pull request Mar 3, 2026
Identify local providers that support discovery anomalyco/models.dev#1080
Open
@danielcherubini

danielcherubini commented Mar 15, 2026

Copy link
Copy Markdown

Oh wow this is amazing

TrentPierce reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@TrentPierce

TrentPierce commented Mar 15, 2026

Copy link
Copy Markdown
Author

Oh wow this is amazing

Thank you! I'm looking forward to trying some of the new Qwen models in OpenCode.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dmitryryabkov dmitryryabkov mentioned this pull request Mar 15, 2026
feat(opencode): dynamic model discovery for local providers (LM Studio, llama.cpp, etc.) #17670
Closed
3 of 6 tasks
This was referenced Mar 29, 2026
feat(provider): native LM Studio support with dynamic model discovery #19578
Closed
feat(provider): native lm studio auto-discovery #20524
Closed
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
@github-actions github-actions Bot mentioned this pull request Apr 27, 2026
feat: added ability to load dynamically the model list from LM Studio #24612
Closed
3 of 6 tasks
This was referenced May 10, 2026
fix(provider): stabilize LM Studio Qwen requests #26744
Closed
fix(provider): discover LM Studio models from /v1/models #26756
Closed
@gin419

gin419 commented Jun 7, 2026

Copy link
Copy Markdown

Good things you already make it. Hoping this PR can be merge asap.

fschaupp reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot mentioned this pull request Aug 7, 2026
feat(provider): discover local model context limits #41104
Closed
3 of 6 tasks
@JLor08 JLor08 mentioned this pull request Sep 30, 2026
No current opencode discovers a gateway model's context size, though the docs say it reads /api/v0/models: opencode v2 asks for /api/v1/models, which 404s here, and /v1/models has no context_length JLor08/op-ai-gateway#171
Closed
@thdxr

thdxr commented Oct 10, 2026

Copy link
Copy Markdown
Member

This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2.

— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@thdxr thdxr closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@TrentPierce @nilswx @danielcherubini @gin419 @thdxr
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.