GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — feat(core): discover models for configured OpenAI-compatible providers by Gr33ndev · Pull Request #57161 · anomalyco/opencode Conversation
|
|
The following comment was made by an LLM, it may be inaccurate: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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:
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.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.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Entries without |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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]>
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]>
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]>
|
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 ( Some OpenAI-compatible endpoints already expose richer metadata in Repro from a hosted OpenAI-compatible endpoint that exposes modalities in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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]>
6003faa to
92e5d7c
Compare
|
@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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem 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.
There was an error while loading. Please reload this page.
589e396 to
0acd9f0
Compare
727c389 to
368c67a
Compare
|
@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 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
368c67a to
91eb9c1
Compare
91eb9c1 to
55a46f9
Compare
There was an error while loading. Please reload this page.
|
Is it possible to also parse per-token costs from |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Custom providers can use currency different from USD, there's a problem how manage this, OpenCode display all cost value as USD |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
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? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Haha, look at source)) There's no AI on this way))) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@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: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
b55cda5 to
756f8e2
Compare
756f8e2 to
aa71865
Compare
|
Thanks for working on this. We merged this PR into OpenCode My’s |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
aa71865 to
f42ea84
Compare
|
@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. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@Tarquinen since you reviewed config-defined providers in #57007, would you have a moment for this one? It's behind the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
965b303 to
ee0244b
Compare
ee0244b to
20161e1
Compare
3656446 to
6f56072
Compare
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.
6f56072 to
e4569b4
Compare
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
[FEATURE]: Add LiteLLM as a provider
There was an error while loading. Please reload this page.