Skip to content

Feat #6231 - automatic discovery of models from providers - #39176

Open
jakubsuchy wants to merge 4 commits into
anomalyco:devfrom
jakubsuchy:dev
Open

Feat #6231 - automatic discovery of models from providers#39176
jakubsuchy wants to merge 4 commits into
anomalyco:devfrom
jakubsuchy:dev

Conversation

@jakubsuchy

Copy link
Copy Markdown

Issue for this PR

Closes #6231

Type of change

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

What does this PR do?

Fixes issue #6231 to provide a generic way that providers can pull /v1/models, and therefore automatically update their model list at any time.

Updates documentation with information how providers can use this functionality

How did you verify your code works?

Testing + Automated testing

Screenshots / recordings

none

Checklist

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

Jakub Suchy and others added 2 commits July 22, 2026 21:15
…ay to enable model discovery on a provider. Model discovery is opt-in by provider, to provide backwards compatibility
@github-actions

Copy link
Copy Markdown
Contributor

Hey! Your PR title Fixes #6231 - automatic discovery of models from providers doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

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

Based on my search results, I found several potentially related PRs that address similar model discovery functionality:

Most Relevant:

Related Features:

These PRs are not exact duplicates of PR #39176, but they address overlapping concerns around automatic model discovery from various provider types. You may want to review these to ensure consistency in implementation approach and avoid duplicate logic.

@jakubsuchy jakubsuchy changed the title Fixes #6231 - automatic discovery of models from providers Feat #6231 - automatic discovery of models from providers Jul 27, 2026
@Hotragn

Hotragn commented Jul 28, 2026

Copy link
Copy Markdown

I implemented this same feature independently before I found your PR — yours is further along (docs, config schema, SDK types), so I'm standing down and would rather help this one land. Four things from digging through the earlier attempt in #8359 that I think are the actual blockers worth pre-empting:

  1. The new config options. @rekram1-node's notes there start with "ideally no extra config option" (comment), and that author dropped theirs in response — "1. No extra config option" (comment). This PR adds enable_model_discovery and disable_model_discovery, so it will probably hit the same objection. Your code comment has a fair rationale (it's an outbound request to a user-supplied URL) — might be worth making that argument up front, or keying off "provider is config-declared/authed" rather than a new flag.

  2. Union vs. filter. The same note asks discovery to remove models too: if models.dev lists N and the endpoint returns N-2, the missing 2 should be dropped as unsupported. Right now discovery only adds ids that aren't already known, so stale models.dev entries stick around. (My version had this same gap.)

  3. Timeout. AbortSignal.timeout(5_000) vs. the "1-3 sec tops" ask in that review. This runs on the provider-load path, so an unreachable endpoint adds the full delay to startup.

  4. Minor: discovered models that models.dev doesn't know get limit.context: 0 / limit.output: 0 via buildConfigModel(..., {}, ...). That's fine for config-declared models where the user omitted limits, but with discovery it becomes the common case — probably worth confirming nothing downstream (compaction/context math) depends on a real context limit.

Reusing buildConfigModel for discovered models is nicer than what I did (I hand-rolled a minimal Model) — this way anything models.dev already knows keeps its real metadata and variants.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-discover models from OpenAI-compatible provider endpoints

2 participants