diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-11-20 02:42:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 02:42:15 +0100 |
commit | 419264f9665ed50ac0dcbf86327da8bf221ac3e8 (patch) | |
tree | 027ebe8efcb413b648101ac6fd4fe744803e8a8a /g4f/gui/server/api.py | |
parent | Merge pull request #2387 from hlohaus/info (diff) | |
parent | Fix missing provider_handler in client (diff) | |
download | gpt4free-419264f9665ed50ac0dcbf86327da8bf221ac3e8.tar gpt4free-419264f9665ed50ac0dcbf86327da8bf221ac3e8.tar.gz gpt4free-419264f9665ed50ac0dcbf86327da8bf221ac3e8.tar.bz2 gpt4free-419264f9665ed50ac0dcbf86327da8bf221ac3e8.tar.lz gpt4free-419264f9665ed50ac0dcbf86327da8bf221ac3e8.tar.xz gpt4free-419264f9665ed50ac0dcbf86327da8bf221ac3e8.tar.zst gpt4free-419264f9665ed50ac0dcbf86327da8bf221ac3e8.zip |
Diffstat (limited to 'g4f/gui/server/api.py')
-rw-r--r-- | g4f/gui/server/api.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/g4f/gui/server/api.py b/g4f/gui/server/api.py index 6be77d09..2d871ff3 100644 --- a/g4f/gui/server/api.py +++ b/g4f/gui/server/api.py @@ -38,10 +38,11 @@ class Api: return models._all_models @staticmethod - def get_provider_models(provider: str) -> list[dict]: + def get_provider_models(provider: str, api_key: str = None) -> list[dict]: if provider in __map__: provider: ProviderType = __map__[provider] if issubclass(provider, ProviderModelMixin): + models = provider.get_models() if api_key is None else provider.get_models(api_key=api_key) return [ { "model": model, @@ -49,7 +50,7 @@ class Api: "vision": getattr(provider, "default_vision_model", None) == model or model in getattr(provider, "vision_models", []), "image": model in getattr(provider, "image_models", []), } - for model in provider.get_models() + for model in models ] return [] |