[Bug]: OpenRouter model discovery never lists embedding models (separate /embeddings/models endpoint not queried)
Problem
In the Discover Models dialog for an OpenRouter credential, switching Model Type to Embedding still shows only chat models, so no embedding model can be registered from the UI. Reported in the original issue against v1.14.0 (original report preserved below).
Root cause
- OpenRouter serves chat models at
/api/v1/models(431 today, no embeddings) and embedding models at a separate/api/v1/embeddings/models(33 today). Our discovery only queries the first. Esperanto's OpenRouter embedding provider already uses the second. - The Model Type dropdown in
DiscoverModelsDialogis not a filter; it is the type stamped on the selected models at registration. That is fine for providers whose single/modelscatalogue mixes types (OpenAI), but for OpenRouter there is nothing to stamp as embedding. POST /credentials/{id}/discoverdropsmodel_typefrom the response for every provider (api/routers/credentials.pybuildsDiscoveredModelResponsewithout it), so the dialog could not filter even if the backend classified.
Workaround today: type the embedding model id in the search box and use "Add " with type Embedding.
Fix
Backend (api/credentials_service.py, discover_with_config openrouter branch):
- Fetch
/api/v1/modelsand tag aslanguage, and/api/v1/embeddings/modelsand tag asembedding. - Attach
OPENROUTER_AUDIO_MODELSwith the type from their seed entry instead of untyped.
Backend (api/routers/credentials.py):
- Pass
model_typethrough inDiscoveredModelResponse(this also unbreaks Ollama, which already classifies).
Frontend (frontend/src/components/settings/DiscoverModelsDialog.tsx):
- When an item has
model_type, show it only under that type; items without a type stay visible under every type. - Base
showCustomOptionon the filtered list, and pruneselectedModelswhen the type changes.
Tests:
tests/test_credentials_api.py:discover_with_config("openrouter")with both endpoints mocked returns typed entries.- New
DiscoverModelsDialog.test.tsx: switching to Embedding hides chat models and keeps the custom option.
Acceptance criteria
- With an OpenRouter credential, selecting Embedding in Discover Models lists the models from
/embeddings/modelsand registering one works. - Language, TTS and STT lists are unchanged for OpenRouter.
- Ollama discovery now returns
model_typein the API response. - Other providers' discovery behaviour is unchanged (items without type still appear under every type).
Related
PR #1305 attempted this on the legacy GET /models/discover/{provider} path, which the UI does not call.
Original report
What did you do when it broke?
- Create Open Notebook Server via docker compose
- Go to Models -> Add Openrouter API Config
- Test -> OK
- Models -> Default Selection: Language Model Type -> 417 models available -> GOOD
- Clicking Model Type Dropdown -> Selecting anything other than Language -> Model list still only shows Lanague models -> No embedding model possible to select -> Cant use Open Notebook
See screenshot: Type switched to Embedding, options below are still language models
Hint: registering the models directly via POST /api/credentials/{credential_id}/register-models worked and they became visible in the UI. Just the dropdown didn't work.
Environment
Open Notebook 1.14.0 (v1-latest Docker), Fedora Server
Source: lfnovo/open-notebook