Skip to content

LiteLLM settings: configured model ID silently reverts to default and cannot be changed #1367

Description

@easonLiangWorldedtech

Description

With the LiteLLM provider, the model ID on the settings screen cannot be changed: after picking a model (e.g. via "Use custom model..."), the picker silently reverts to the hardcoded default (claude-3-7-sonnet-20250219). The user's selection is not displayed afterwards, so the setting appears broken.

Steps to reproduce

  1. Open Settings → Providers → LiteLLM.
  2. Set the base URL and API key, then refresh the model list.
  3. Pick a model ID that is not present in the fetched /models list (e.g. a custom alias) via "Use custom model...".
  4. The picker immediately reverts to the default model ID.
  5. Save, close and reopen Settings — the configured model ID is not shown; the default is shown instead.

Root cause

The LiteLLM case in webview-ui/src/components/ui/hooks/useSelectedModel.ts validates the configured litellmModelId against the fetched router-model list and, when it is absent, substitutes the hardcoded default via getValidatedModelId(). LiteLLM is a proxy that fronts arbitrary models and aliases, so a configured ID is the user's explicit selection even when it is absent from the fetched list (custom aliases, incomplete or stale listings, renamed deployments).

Expected behavior

  • A configured litellmModelId is displayed and preserved, regardless of whether it appears in the fetched list.
  • The hardcoded default is only used when nothing is configured and a populated list exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions