Skip to content

fix(combo): fetch models dynamically from custom provider endpoints - #2018

Open
hamsa0x7 wants to merge 2 commits into
decolua:masterfrom
hamsa0x7:fix/custom-provider-models-clean
Open

hamsa0x7 wants to merge 2 commits into
decolua:masterfrom
hamsa0x7:fix/custom-provider-models-clean

Conversation

@hamsa0x7

Copy link
Copy Markdown
Contributor

Summary

Fix custom OpenAI/Anthropic-compatible providers not showing models in combo selectors. Instead of relying solely on aliases (which may not exist), the combo selector now fetches actual models from the provider's upstream /models endpoint.

Problem

Custom providers created via the UI were not showing their models in combo selectors because:

  1. The combo selector only showed models from aliases (modelAliases)
  2. Custom models added via /api/models/custom were not visible for compatible providers
  3. Without aliases, only a placeholder model-id entry was shown

Changes

  • Dynamic model fetching: When the combo selector opens, fetch models from /api/providers/[id]/models for each custom provider connection
  • Model merging: Merge fetched models with existing alias-based models, deduping by model ID
  • Visual indicator: Fetched models show an "auto" badge to distinguish them from aliases
  • Placeholder fallback: If no models are found (upstream down or no aliases), show a placeholder entry so users know the provider is available

Issues Fixed

Test Plan

  • Unit tests pass (7 tests covering fetch, merge, dedupe, placeholder, provider identification)

How it works

  1. When ModelSelectModal opens, it identifies all custom (OpenAI/Anthropic-compatible) providers with active connections
  2. It calls /api/providers/[connectionId]/models for each one in parallel
  3. The fetched models are merged with alias-based models (aliases take priority on ID conflict)
  4. Users see actual upstream models instead of empty placeholders or manual aliases only

Custom OpenAI/Anthropic-compatible providers now show actual models
from their upstream /models endpoint in the combo selector, instead
of relying solely on aliases which may not exist.

- Add fetchedModels state to store dynamically fetched models
- Fetch /api/providers/[id]/models when modal opens for custom providers
- Merge fetched models with alias-based models, deduping by ID
- Show auto badge for fetched models to distinguish from aliases
- Keep placeholder fallback when no models are found

Fixes decolua#1988, decolua#2013, decolua#1993, decolua#1995
@onizukashonan14-png

onizukashonan14-png commented Jun 23, 2026 •

Copy link
Copy Markdown

hello, can you please tell in when i add custom endpoint to both anthropic or openai mode i can only add one key can you please confirm this bug

image

check this only one key added rest not added

@hamsa0x7

Copy link
Copy Markdown
Contributor Author

This is tracked in #1775 — the one-connection-per-node guard for compatible providers prevents adding multiple API keys. That PR removes the restriction. This PR (#2018) addresses model visibility in combos, which is a separate issue.

@onizukashonan14-png

Copy link
Copy Markdown

can you please merge that PR feature in the next release

ozkancan-apk added a commit to ozkancan-apk/9routerFullFree that referenced this pull request Jun 24, 2026
…it), decolua#2020 (cascade delete + token limits), decolua#2018 (dynamic model fetch)

PR decolua#2046: SSE non-JSON satir + duplicate [DONE] fix. Stream kararlilik.
PR decolua#2007: 5 guvenlik yamasi (API key leak, proxy URL validation, XSS, MITM race, lock file).
PR decolua#2020: Provider silinince model alias cascade delete + custom model token limit.
PR decolua#2018: Custom provider'dan model listesi dinamik cekme.

+ onceki: betterSqliteAdapter transaction fix (createProviderConnection undefined hatasi).
diegosouzapw pushed a commit to diegosouzapw/OmniRoute that referenced this pull request Jun 24, 2026
The combo model-select modal only listed alias, fallback, and user-added
custom models for connected openai-/anthropic-compatible providers. Models
that exist upstream but were never aliased never appeared, so users could
not pick them when building a combo.

Add a `fetchedModels` state + an on-open effect that loads each connected
custom provider's catalog from its `/api/providers/[id]/models` route (keyed
by connection id) in parallel, merges the results into the existing
alias/fallback/custom list deduped by id, and tags discovered entries with a
new `auto` model-catalog source so they render an "Auto" badge.

Co-authored-by: Hamsa_M <116961508+hamsa0x7@users.noreply.github.com>
Inspired-by: decolua/9router#2018
@hamsa0x7 hamsa0x7 closed this Jun 25, 2026
@hamsa0x7
hamsa0x7 deleted the fix/custom-provider-models-clean branch June 25, 2026 14:33
@hamsa0x7
hamsa0x7 restored the fix/custom-provider-models-clean branch June 25, 2026 14:38
@hamsa0x7 hamsa0x7 reopened this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants