Skip to content

Support remotely refreshed model profiles for dcode model selection #4502

Description

@mdrxy

Submission checklist

  • This is a feature request, not a bug report.
  • I searched existing issues and didn't find this feature.
  • I checked the docs and README for existing functionality.
  • This request applies to this repo (deepagents) and not an external package.

Area (Required)

  • code

Feature description

dcode should support remotely refreshed model profile data for /model so the model switcher can surface new and updated models without requiring users to upgrade provider packages first.

Today, /model is populated from local/static sources:

  • installed LangChain provider package _profiles.py data via get_available_models() / get_model_profiles()
  • user-configured config.toml provider model lists and profile overrides
  • local Ollama daemon discovery
  • the hard-coded _RECOMMENDED_MODELS map in ModelSelectorScreen
  • cached module-level discovery state, refreshed by /reload

This means the switcher can lag behind real provider availability. In many cases, a provider package bump is not actually required to use a newly released model; the stale local profile list is the only reason the model is not shown or recommended.

The desired behavior is for dcode to fetch current model/profile data from models.dev in the background, cache it locally, and use it to populate both the full model catalog and the curated/recommended subset.

Proposed solution (optional)

Add runtime remote model-profile support, likely by extending langchain-model-profiles before or alongside the dcode changes.

langchain-model-profiles already has maintainer tooling that fetches https://models.dev/api.json, converts models.dev entries into LangChain profile fields, and writes generated _profiles.py files for provider packages. We should expand that package with a runtime API that can:

  • fetch models.dev directly
  • normalize the response into LangChain model profile shape
  • apply any LangChain-specific augmentations where available
  • expose provider/model data in a form dcode can consume without duplicating conversion logic

dcode should then consume that runtime API for /model discovery.

Expected merge policy:

  • Remote models.dev-backed profiles are the fresh source when available.
  • Installed provider package profiles remain a fallback when the remote fetch/cache is unavailable or incomplete.
  • User config.toml model entries and profile overrides continue to win over both remote and installed package data.
  • The existing Ollama/local discovery path should continue to work for local models.
  • The existing openai_codex mirror behavior should continue to work.
  • Disabled providers in config should remain hidden.

Fetch/cache behavior:

  • Remote fetching should be default-on.
  • Fetching should happen in the background after startup and should never block the initial TUI.
  • Cache remote results persistently with a daily TTL.
  • If the network fails, the app should use stale cached data.
  • If no cache exists, fall back to installed provider profiles and config-defined models.
  • Fetch one global manifest rather than provider-scoped requests, so dcode does not send local provider/auth state.
  • /reload should clear or refresh the relevant cache. It is an open question whether we also want an explicit /model --refresh or similar affordance.

Acceptance criteria:

  • /model can show models that are present in models.dev but absent from the installed provider package profiles.
  • The curated/recommended model list can be updated from remote data instead of requiring a dcode release for every model-list change.
  • Remote fetching does not block startup or opening the initial UI.
  • Offline users still get a usable /model list from stale cache, installed profiles, local config, and local discovery.
  • Manual config overrides remain highest precedence.
  • Provider enable/disable settings are respected.
  • Provider ID mapping edge cases are handled explicitly, including models.dev IDs that differ from dcode/LangChain provider IDs such as google vs google_genai.
  • OpenAI-compatible/provider-specific cases are considered, including OpenRouter, Baseten, Codex mirroring, and Ollama/local models.
  • The implementation has tests for remote success, stale-cache fallback, network failure, config override precedence, disabled providers, provider ID mapping, and /reload cache behavior.

Additional context (optional)

Relevant current dcode code paths:

  • deepagents_code/widgets/model_selector.py
    • _RECOMMENDED_MODELS is currently hard-coded.
    • ModelSelectorScreen._load_model_data() calls get_available_models(), merges hard-coded recommended models, loads profiles, and recent models.
  • deepagents_code/model_config.py
    • get_available_models() loads installed provider package _profiles.py, merges config-defined models, probes Ollama, and mirrors supported OpenAI models under openai_codex.
    • get_model_profiles() loads profile metadata from installed packages and config overrides.
    • clear_caches() is used by /reload.
  • langchain-model-profiles
    • langchain-model-profiles currently provides a CLI for fetching models.dev and generating provider-package _profiles.py.
    • This seems like the right place to add shared runtime fetch/normalize/cache primitives so dcode does not own a separate models.dev conversion layer.

Metadata

Metadata

Labels

featureNew feature/enhancement or request for oneinternalUser is a member of the `langchain-ai` GitHub organizationmodelModel provider or model config

Fields

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions