Missing Models
- Dominant language
- Python
- Stars
- 69
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
When adding models from the OpenRouter provider, I noticed that many models available in OpenRouter are missing from the model list in Flow.
After looking into it, I realized this happens because Flow currently uses LiteLLM’s internal `models_by_provider` list.
As far as I understand, this is a static list maintained by LiteLLM, so it may not always be up to date with the models currently available in OpenRouter.
I tested a possible solution by using OpenRouter's public models endpoint:
```text
https://openrouter.ai/api/v1/models
```
I updated `flow_mode.py` like this:
```python
@frappe.whitelist()
def get_provider_models(provider: str | None = None) -> list[str]:
if not provider:
return []
provider_name = provider.strip().lower()
if provider_name == "openrouter":
return get_openrouter_models()
import litellm
return sorted(litellm.models_by_provider.get(provider_name, set()))
def get_openrouter_models() -> list[str]:
response = requests.get("https://openrouter.ai/api/v1/models")
response.raise_for_status()
data = response.json()
return sorted(
model["id"]
for model in data.get("data", [])
if model.get("id")
)
```
This works in my local tests and returns the models currently available through OpenRouter.
One possible concern is that this approach depends on calling the OpenRouter API every time the model list is requested. Maybe this could be cached, or refreshed only occasionally.
Another possible approach could be to add a DocType for manually defining additional provider models that are not included in LiteLLM's internal list. This could also help with other providers where LiteLLM's model list may be incomplete or outdated.
Thanks for the great project!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in flow_mode.py at get_provider_models and compare the existing LiteLLM models_by_provider lookup with the OpenRouter models endpoint described in the issue. Check how model lists are requested and determine whether caching or periodic refresh is needed; done means OpenRouter’s currently available models appear without changing other providers’ behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100