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): auto-discover models from OpenAI-compatible providers by sethjones · Pull Request #2 · sethjones/opencode

Conversation

@sethjones

@sethjones sethjones commented Jun 15, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Owner

Issue for this PR

Type of change

  • New feature

What does this PR do?

Auto-discovers available models from OpenAI-compatible providers that have a baseURL configured in opencode.json. Instead of requiring users to list every model manually, opencode now calls GET /v1/models at startup and populates the model list.

Models come from three sources: Models.dev (metadata), config file (overrides), and the provider API (actual availability). A model is visible only if the provider API returns it or it is declared in config. Metadata is merged with API > config > Models.dev precedence.

This means providers like LM Studio, Ollama, and self-hosted OpenAI-compatible servers automatically show their loaded models without any per-model configuration.

How did you verify your code works?

  • Built a standalone binary and ran it with an LM Studio server configured via baseURL
  • Confirmed models appear in the TUI /models list without manual per-model config
  • Confirmed models not returned by the provider API are hidden, even if listed in Models.dev
  • Confirmed startup completes without hanging or displaying discovery output to the terminal
  • Ran bun typecheck from packages/opencode — passes
  • Ran provider tests — pass

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.

zbndev and mimi1vx reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
sethjones added 2 commits June 14, 2026 15:17
@sethjones
feat(provider): auto-discover models from custom OpenAI-compatible pr…
1d7ceba
…oviders
@sethjones
feat(opencode): add custom provider model discovery
f765cdd
- Fetch models from OpenAI-compatible providers with baseURL in config
- Support plugin-registered discovery loaders (e.g., GitLab)
- Discovery runs synchronously during bootstrap init
- Remove providers with no models after successful discovery
- Add tests for discovery and model registration
@sethjones sethjones changed the title Custom model discovery feat(opencode): auto-discover models from OpenAI-compatible providers Jun 15, 2026
sethjones and others added 9 commits June 17, 2026 15:52
@sethjones
fix(opencode): resolve code review issues in provider model discovery
552be5c
- Extract discoverProviderModels() helper from inline 110-line Effect.gen
- Replace globalThis.fetch with HttpClient layer (FetchHttpClient)
- Add Effect.timeout(10s) to HTTP discovery requests
- Replace Exit._tag with Exit.isSuccess/IsFailure
- Remove redundant config.get() in init() (use captured s.cfg)
- Remove unnecessary 'as any' casts
- Fix indentation to consistent 2-space
- Set family: 'discovered' on discovered models
- Update discovery tests to use HttpClient layer mocks
@sethjones
refactor: format fixes
63738c0
@sethjones
Merge branch 'dev' into custom-model-discovery
51dc086
opencode
sync release versions for v1.17.8
8716c43
@sethjones
feat(opencode): add discoverModels opt-out for provider model discovery
f257e88
@sethjones
feat(opencode): parse context_length and max_output_tokens from disco…
d9add28
…vered models
@sethjones
feat(opencode): log warnings for discovery failures and config limits…
52b7184
… exceeding discovered
@sethjones
Merge branch 'dev' into custom-model-discovery
7d28dac
@sethjones
fix(opencode): handle TOCTOU race in discovery apply and sanitize ope…
082b2c7
…nai-compatible schemas

- Log warning and continue when provider disappears between discovery snapshot and apply
- Add @ai-sdk/openai-compatible to schema sanitization check
- Add test case for openai-compatible schema sanitization
@sethjones sethjones closed this Jun 19, 2026
@aadityabhatia aadityabhatia mentioned this pull request Jul 18, 2026
LM Studio Failure to refresh models anomalyco/opencode#2047
Closed
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.

1 participant

@sethjones
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.