@danhachuel/thunderbolt 0.5.29 → 0.5.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/app/main.py +20 -0
- package/hermes_ui/api_key_tests.py +5 -3
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -7089,6 +7089,26 @@ def _fetch_media_models(card: dict[str, Any]) -> list[str]:
|
|
|
7089
7089
|
provider = str(card.get("provider") or "").strip().lower()
|
|
7090
7090
|
if provider == "kie_ai":
|
|
7091
7091
|
return list(KIE_MEDIA_MODEL_CATALOG)
|
|
7092
|
+
if provider == "fal_ai":
|
|
7093
|
+
api_key = str(card.get("api_key") or "").strip()
|
|
7094
|
+
if not api_key:
|
|
7095
|
+
raise ValueError("Introduza a API key FAL AI antes de consultar os modelos.")
|
|
7096
|
+
response = requests.get(
|
|
7097
|
+
"https://api.fal.ai/v1/models",
|
|
7098
|
+
headers={"Accept": "application/json", "Authorization": f"Key {api_key}"},
|
|
7099
|
+
timeout=12,
|
|
7100
|
+
)
|
|
7101
|
+
response.raise_for_status()
|
|
7102
|
+
payload = response.json()
|
|
7103
|
+
entries = payload.get("models") if isinstance(payload, dict) else []
|
|
7104
|
+
models = {
|
|
7105
|
+
str(item.get("endpoint_id") or "").strip()
|
|
7106
|
+
for item in entries
|
|
7107
|
+
if isinstance(item, dict) and str(item.get("endpoint_id") or "").strip()
|
|
7108
|
+
}
|
|
7109
|
+
if not models:
|
|
7110
|
+
raise ValueError("A FAL AI não devolveu modelos disponíveis.")
|
|
7111
|
+
return sorted(models, key=str.casefold)
|
|
7092
7112
|
if provider == "openrouter":
|
|
7093
7113
|
base_url = str(card.get("base_url") or "https://openrouter.ai/api/v1").rstrip("/")
|
|
7094
7114
|
headers = {"Accept": "application/json", "Authorization": f"Bearer {str(card.get('api_key') or '').strip()}"}
|
|
@@ -175,6 +175,10 @@ def test_media_provider_card(card: Mapping[str, Any]) -> dict[str, Any]:
|
|
|
175
175
|
return _missing("Introduza a API key/token antes de testar este provider.")
|
|
176
176
|
if provider == "heygen":
|
|
177
177
|
return _get(f"{base_url}/v3/users/me", headers={"X-Api-Key": api_key})
|
|
178
|
+
if provider == "kie_ai":
|
|
179
|
+
return _get(f"{base_url}/chat/credit", headers={"Authorization": f"Bearer {api_key}"})
|
|
180
|
+
if provider == "fal_ai":
|
|
181
|
+
return _get("https://api.fal.ai/v1/models", headers={"Authorization": f"Key {api_key}"})
|
|
178
182
|
if not model and provider not in {"inferenceport", "cloudflare_workers_ai", "heygen"}:
|
|
179
183
|
return _result("missing", "Complete o modelo antes de testar.")
|
|
180
184
|
if provider == "openrouter":
|
|
@@ -190,10 +194,8 @@ def test_media_provider_card(card: Mapping[str, Any]) -> dict[str, Any]:
|
|
|
190
194
|
return _result("missing", "Complete o Account ID do Cloudflare antes de testar.")
|
|
191
195
|
endpoint = f"{base_url}/accounts/{quote(account_id, safe='')}/ai/models/search"
|
|
192
196
|
return _get(endpoint, headers=headers, params={"search": model or "stable-diffusion"})
|
|
193
|
-
if api_style in {"openai_compatible", "huggingface", "agnes", "kie"} or provider in {"pollinations", "huggingface", "agnes", "
|
|
197
|
+
if api_style in {"openai_compatible", "huggingface", "agnes", "kie"} or provider in {"pollinations", "huggingface", "agnes", "inferenceport"}:
|
|
194
198
|
endpoint = _models_endpoint(base_url)
|
|
195
|
-
elif provider == "fal_ai":
|
|
196
|
-
endpoint = f"{base_url}/models" if base_url.endswith("/v1") else base_url
|
|
197
199
|
else:
|
|
198
200
|
endpoint = base_url
|
|
199
201
|
return _get(endpoint, headers=headers)
|
package/package.json
CHANGED