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(core): discover models for configured OpenAI-compatible providers by Gr33ndev · Pull Request #57161 · anomalyco/opencode

Conversation

@Gr33ndev

@Gr33ndev Gr33ndev commented Oct 19, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Issue for this PR

Closes #48938

Type of change

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

What does this PR do?

Custom OpenAI-compatible providers (LiteLLM and other gateways) need every model listed in config by hand. This adds a plugin that reads GET {baseURL}/models for providers configured with an OpenAI-compatible package and adds the missing chat models. Configured models stay untouched, and non-chat entries (mode: "embedding" etc.) are skipped.

It authenticates the same way requests do: saved key, env variable, or settings.apiKey, plus the provider headers. It also matches configs migrated from V1 (aisdk:@ai-sdk/openai-compatible). Ollama, LM Studio and vLLM are skipped because they have their own discovery. The list refreshes every 5 minutes and after config or credential changes, and survives outages. Discovered models accept text and can call tools unless /models reports input_modalities/output_modalities or supported_parameters (top level or under architecture), so an image in the history can't break every later request to a text-only model. The plugin is guarded by the openai_compatible_discovery feature flag: on in local and dev builds, off in releases unless experimental.openai_compatible_discovery is true.

How did you verify your code works?

Tests against a local server for: config provider plus discovery in production order, stored/env/config keys, a V1 config through ConfigNormalize, outage retention, endpoint changes, and turning the flag off. Core typecheck, oxlint, and the config test suite pass.

Screenshots / recordings

No UI changes.

Checklist

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

Added by the opencode bot (AI-generated).

Related: #40524, #55354, #53235

Public API: adds the internal plugin opencode.provider.openai-compatible, which calls GET {baseURL}/models for config-defined OpenAI-compatible providers by default (no config or schema changes; backwards compatible)

Sorry, something went wrong.

Uh oh!

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

vippelina reacted with hooray emoji omeid, Mahmoud-Shereif, AyhanSetirekli, oriori1703, pvickery-ParamountCommerce, and vippelina reacted with heart emoji
All reactions
  • 🎉 1 reaction
  • ❤️ 6 reactions
@github-actions

github-actions Bot commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

All reactions

Sorry, something went wrong.

Uh oh!

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

@Gr33ndev Gr33ndev mentioned this pull request Oct 19, 2026
feat(provider): add dynamic model discovery for custom providers #42660
Closed
3 of 6 tasks
opencode-agent[bot]
opencode-agent Bot reviewed Oct 19, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works as described. I ran a fake OpenAI-compatible gateway with a litellm provider defined in config, then compared opencode models against a server started from each checkout. On the base, no litellm models are listed. With this PR, the chat and responses models appear and the mode: "embedding" entry is skipped. The /models request carried the configured key as a Bearer token and the provider headers. The new tests and the whole packages/core test/plugin suite pass (426 tests), and so does typecheck.

Public API: no new config keys, schema changes, endpoints or events. It adds an internal plugin, opencode.provider.openai-compatible, which users can turn off via plugins. The behaviour change is that every config-defined OpenAI-compatible provider (except ollama, lmstudio and vllm) now gets GET {baseURL}/models with its key and headers at startup, every 5 minutes, and after config or credential changes. This is backwards compatible: existing configs only gain models.

Things worth settling before merge:

  • Overlap with other open PRs: #53713 (opt-in gateway discovery via settings.modelDiscovery), #54398 (context limits from the same /models endpoint) and #54558 (a built-in litellm provider) all work from the same /models data. This PR turns discovery on by default for every such provider, while #53713 makes it opt-in. Maintainers will likely want one approach, so a provider isn't fetched twice and the opt-in question has one answer.
  • Entries without mode: these are treated as chat models. LiteLLM's /v1/models often leaves mode out (see the example in #48938), so embedding or image models with no mode will still show up in the model list with default capabilities.

Related: #40524, #55354, #53235

Sorry, something went wrong.

Uh oh!

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

All reactions
@Gr33ndev

Gr33ndev commented Oct 19, 2026

Copy link
Copy Markdown
Author

Entries without mode are kept on purpose: LiteLLM also omits it for real chat models (see the claude-fable-5-1 example in #48938), so dropping them would hide chat models. A stray embedding entry can be hidden by listing it under models with "disabled": true. I clarified this in the docs.

All reactions

Sorry, something went wrong.

Uh oh!

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

@opencode-agent opencode-agent Bot mentioned this pull request Oct 20, 2026
providers: vLLM discovery silently drops every model whose owned_by is not "vllm" #57460
Open
fwiesel added a commit to fwiesel/opencode that referenced this pull request Oct 21, 2026
@fwiesel @Gr33ndev
@tudstudent @woodsonl
fix(core): respect model availability at configured endpoints
63cf6d3
Extend the discovery lifecycle from anomalyco#57161 so native proxy endpoints do not inherit unsupported models from the shared catalog. Preserve catalog metadata and explicit configuration, without coupling availability to routing or request-budget changes.

Based on anomalyco#57161; availability and effective-connection handling informed by anomalyco#53713 and anomalyco#54398.

Co-authored-by: Gr33nbl00d <[email protected]>
Co-authored-by: J.H.S. Schlepers <[email protected]>
Co-authored-by: Lance Woodson <[email protected]>
This was referenced Oct 22, 2026
[FEATURE]: Add opencode-custom-provider to ecosystem documentation #58119
Closed
[FEATURE]: Query models of custom provider automatically #58122
Closed
fwiesel added a commit to fwiesel/opencode that referenced this pull request Oct 22, 2026
@fwiesel @Gr33ndev
@tudstudent @woodsonl
fix(core): respect model availability at configured endpoints
0048f3e
Extend the discovery lifecycle from anomalyco#57161 so native proxy endpoints do not inherit unsupported models from the shared catalog. Preserve catalog metadata and explicit configuration, without coupling availability to routing or request-budget changes.

Based on anomalyco#57161; availability and effective-connection handling informed by anomalyco#53713 and anomalyco#54398.

Co-authored-by: Gr33nbl00d <[email protected]>
Co-authored-by: J.H.S. Schlepers <[email protected]>
Co-authored-by: Lance Woodson <[email protected]>
fwiesel added a commit to fwiesel/opencode that referenced this pull request Oct 22, 2026
@fwiesel @Gr33ndev
@tudstudent @woodsonl
fix(core): respect model availability at configured endpoints
b8912fd
Extend the discovery lifecycle from anomalyco#57161 so native proxy endpoints do not inherit unsupported models from the shared catalog. Preserve catalog metadata and explicit configuration, without coupling availability to routing or request-budget changes.

Based on anomalyco#57161; availability and effective-connection handling informed by anomalyco#53713 and anomalyco#54398.

Co-authored-by: Gr33nbl00d <[email protected]>
Co-authored-by: J.H.S. Schlepers <[email protected]>
Co-authored-by: Lance Woodson <[email protected]>
@KarataevDmitry

KarataevDmitry commented Oct 22, 2026

Copy link
Copy Markdown

Thanks for this PR — exactly what custom OpenAI-compatible setups need.

One gap worth considering while this is in review: discovered models get the default capabilities fallback (input: ["text", "image"], as confirmed in the #55309 triage), which silently breaks text-only models. If a session's history contains image parts (e.g. screenshots inside tool results), they are sent on purpose, the endpoint rejects every request, and the session wedges permanently (#55309 / #52042 family).

Some OpenAI-compatible endpoints already expose richer metadata in GET /models — input/output modalities, tool-support flags, context length (vLLM's max_model_len is already read by its own discovery). If this discovery could pick those up when present, falling back to current defaults only for endpoints that expose nothing, text-only models would degrade gracefully instead of wedging sessions.

Repro from a hosted OpenAI-compatible endpoint that exposes modalities in GET /models: a model reporting text-only input + one image part in session history → every request fails with 400 … message[N].content[M] has invalid field(s): text, type until the image part is removed from history.

Gr33ndev and omeid reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

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

fwiesel added a commit to fwiesel/opencode that referenced this pull request Oct 22, 2026
@fwiesel @Gr33ndev
@tudstudent @woodsonl
fix(core): respect model availability at configured endpoints
ebc3f6e
Extend the discovery lifecycle from anomalyco#57161 so native proxy endpoints do not inherit unsupported models from the shared catalog. Preserve catalog metadata and explicit configuration, without coupling availability to routing or request-budget changes.

Based on anomalyco#57161; availability and effective-connection handling informed by anomalyco#53713 and anomalyco#54398.

Co-authored-by: Gr33nbl00d <[email protected]>
Co-authored-by: J.H.S. Schlepers <[email protected]>
Co-authored-by: Lance Woodson <[email protected]>
@neriousy neriousy mentioned this pull request Oct 23, 2026
V2: Reconcile provider catalogs with /models endpoints #40524
Open
@opencode-agent opencode-agent Bot mentioned this pull request Oct 24, 2026
provider discovery: hard-coded 1s timeout fails remote endpoints #58558
Closed
@pskraemer11 pskraemer11 mentioned this pull request Oct 26, 2026
providers: models from local provider definitions are never listed (v2.1.4) #59218
Closed
@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch from 6003faa to 92e5d7c Compare October 26, 2026 10:38
@Gr33ndev

Gr33ndev commented Oct 26, 2026

Copy link
Copy Markdown
Author

@KarataevDmitry Good catch, thanks! Discovered models are now text-only unless the endpoint says otherwise, so an image in the history is turned into a "this model does not support image input" note instead of breaking the session. If /models reports input_modalities/output_modalities (top level or under architecture, OpenRouter-style) and supported_parameters, those are used instead, with file mapped to PDF input. I left context limits out to keep this PR focused. Which field names does your endpoint use? If it's a different shape, I'm happy to add it.

Mahmoud-Shereif 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.

opencode-agent[bot]
opencode-agent Bot reviewed Oct 26, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new commits work as described. I served a fake /models endpoint and listed models from a server built from this PR, via the CLI and the SDK client. An entry with no metadata comes back as text-only with tools. An entry with architecture.input_modalities including image gets image input. An entry whose supported_parameters lacks tools has tools off. The embedding entry is skipped. The new tests and the whole packages/core test/plugin suite pass. typecheck:tsc passes; the typecheck script calls bun check, which the installed Bun doesn't have, so I couldn't run it.

My earlier point about LiteLLM entries with no mode is addressed: the docs now say they count as chat models and can be hidden with "disabled": true under models, and a test covers that. The public API impact is unchanged since the last review. The overlap with #53713, #54398 and #54558 is still a decision for maintainers. Nothing new to raise.

Sorry, something went wrong.

Uh oh!

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

All reactions
This was referenced Oct 27, 2026
feat(core): discover context limits for custom OpenAI-compatible providers #59520
Closed
feat(core): discover Unsloth Studio models (local runtime — like Ollama, LM Studio, vLLM) #59557
Closed
@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch 2 times, most recently from 589e396 to 0acd9f0 Compare October 29, 2026 08:53
@opencodejr opencodejr Bot mentioned this pull request Oct 30, 2026
[FEATURE]: Load GMI Cloud models from its /v1/models endpoint #60671
Closed
1 task done
@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch 5 times, most recently from 727c389 to 368c67a Compare November 6, 2026 15:16
@Gr33ndev

Gr33ndev commented Nov 6, 2026

Copy link
Copy Markdown
Author

@rekram1-node would you have a moment to look at this, or let me know whether this direction fits V2? The CI workflows also need a maintainer's approval to run. It's behind the openai_compatible_discovery flag, and I'm happy to adjust the approach if you prefer a different one.

Mahmoud-Shereif 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.

@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch from 368c67a to 91eb9c1 Compare November 6, 2026 18:57
@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch from 91eb9c1 to 55a46f9 Compare November 7, 2026 12:11
@foxcpp

foxcpp commented Nov 8, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Is it possible to also parse per-token costs from pricing object to show approximate consumption for custom providers? I use companys AI proxy that has daily cost limits, it would be nice to be able to see how much I used up without needing to go to a separate page for this.

All reactions

Sorry, something went wrong.

Uh oh!

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

@KarataevDmitry

KarataevDmitry commented Nov 8, 2026

Copy link
Copy Markdown

Is it possible to also parse per-token costs from pricing object to show approximate consumption for custom providers? I use companys AI proxy that has daily cost limits, it would be nice to be able to see how much I used up without needing to go to a separate page for this.

Custom providers can use currency different from USD, there's a problem how manage this, OpenCode display all cost value as USD

All reactions

Sorry, something went wrong.

Uh oh!

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

@foxcpp

foxcpp commented Nov 8, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

Custom providers can use currency different from USD, there's a problem how manage this, OpenCode display all cost value as USD

Fair enough. Though AI proxy I use seems to convert prices back to USD in API response. Perhaps it can be optional configuration option per provider?

All reactions

Sorry, something went wrong.

Uh oh!

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

@KarataevDmitry

KarataevDmitry commented Nov 8, 2026

Copy link
Copy Markdown

Custom providers can use currency different from USD, there's a problem how manage this, OpenCode display all cost value as USD

Fair enough. Though AI proxy I use seems to convert prices back to USD in API response. Perhaps it can be optional configuration option pee provider?

Haha, look at source)) There's no AI on this way)))
Conceptually we can get exchange rate from smth platform and convert it to USD, but what we should do in case like Russia, where official exchange rate is different?
Get info for cental bank of provider's jurisdiction country?

All reactions

Sorry, something went wrong.

Uh oh!

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

@Gr33ndev

Gr33ndev commented Nov 9, 2026

Copy link
Copy Markdown
Author

@foxcpp good idea, but I'd like to keep this PR focused until the approach is accepted; pricing (and the currency question @KarataevDmitry raised) would fit a follow-up. Until then you can set it per model in config: models.<id>.cost with input/output in USD per million tokens. Note that listing a model there makes it a configured model, so also set capabilities (e.g. "input": ["text"]) if it's text-only.

foxcpp, KarataevDmitry, and Mahmoud-Shereif reacted with thumbs up emoji
All reactions
  • 👍 3 reactions

Sorry, something went wrong.

Uh oh!

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

@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch 2 times, most recently from b55cda5 to 756f8e2 Compare November 10, 2026 18:44
This was referenced Nov 11, 2026
[FEATURE]: Keep provider model inventory in sync with upstream /v1/models (V2) #63330
Closed
feat: generic OpenAI-compatible GET /models discovery plugin #63490
Closed
@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch from 756f8e2 to aa71865 Compare November 12, 2026 20:02
@joe-ieta joe-ieta mentioned this pull request Nov 14, 2026
[FEATURE]: Feature Request: Add GUI Options to Edit Custom Providers and Manage Model Lists #33704
Open
1 task done
@joe-ieta

joe-ieta commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Thanks for working on this. We merged this PR into OpenCode My’s dev-my alongside our existing Custom providers editor. A loopback gateway regression confirmed that discovered models enter the runtime catalog while manually saved model IDs and limits are preserved. The existing Fetch models and manual entry flows also passed Chromium regression tests. If you have a chance to try it, we’d appreciate feedback on how these flows work together. We’ll keep following this PR and maintaining the integration as upstream evolves.

All reactions

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 Nov 15, 2026
📊 AI CLI 工具社区动态日报 2026-11-15 96loveslife/big_model_radar#794
Open
@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch from aa71865 to f42ea84 Compare November 15, 2026 10:54
@Gr33ndev

Gr33ndev commented Nov 15, 2026

Copy link
Copy Markdown
Author

@joe-ieta thanks for trying it and for the regression results, good to hear discovered models and manually saved IDs and limits work together. I'll keep this PR in sync with upstream.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Gr33ndev

Gr33ndev commented Nov 15, 2026

Copy link
Copy Markdown
Author

@Tarquinen since you reviewed config-defined providers in #57007, would you have a moment for this one? It's behind the openai_compatible_discovery flag, up to date with dev, and already in use downstream. The CI workflows also still need a maintainer's approval to run.

All reactions

Sorry, something went wrong.

Uh oh!

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

@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch 2 times, most recently from 965b303 to ee0244b Compare November 16, 2026 20:52
@opencodejr opencodejr Bot mentioned this pull request Nov 16, 2026
[FEATURE]: Support decision models from local OpenAI-compatible providers (LM Studio /v1/systemone) #64306
Closed
@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch from ee0244b to 20161e1 Compare November 17, 2026 17:14
@opencodejr opencodejr Bot mentioned this pull request Nov 18, 2026
The model list id seems to have been deduplicated based on the prefix #64610
Closed
@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch 2 times, most recently from 3656446 to 6f56072 Compare November 23, 2026 19:29
This was referenced Nov 24, 2026
feat(plugin): add Hostman AI Gateway provider #66095
Open
[FEATURE]: Why not built-in LLM proxy gateway? #66236
Closed
@Gr33ndev
feat(core): discover models for configured OpenAI-compatible providers
e4569b4
Custom OpenAI-compatible providers such as LiteLLM need every model listed
by hand. Read GET {baseURL}/models and add the missing chat models, keeping
configured models untouched. Ollama, LM Studio, and vLLM keep their own
discovery.

Discovered models accept text and can call tools unless the endpoint
reports modalities or supported parameters, so an image in the history
cannot break every later request to a text-only model.

Guarded by the openai_compatible_discovery feature flag.
@Gr33ndev
Gr33ndev force-pushed the compatible-model-discovery branch from 6f56072 to e4569b4 Compare November 26, 2026 09:16

This branch has not been deployed

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

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

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.

[FEATURE]: Add LiteLLM as a provider

Uh oh!

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

4 participants

@Gr33ndev @KarataevDmitry @foxcpp @joe-ieta
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.