@danhachuel/thunderbolt 0.5.30 → 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 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()}"}
@@ -177,6 +177,8 @@ def test_media_provider_card(card: Mapping[str, Any]) -> dict[str, Any]:
177
177
  return _get(f"{base_url}/v3/users/me", headers={"X-Api-Key": api_key})
178
178
  if provider == "kie_ai":
179
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}"})
180
182
  if not model and provider not in {"inferenceport", "cloudflare_workers_ai", "heygen"}:
181
183
  return _result("missing", "Complete o modelo antes de testar.")
182
184
  if provider == "openrouter":
@@ -194,8 +196,6 @@ def test_media_provider_card(card: Mapping[str, Any]) -> dict[str, Any]:
194
196
  return _get(endpoint, headers=headers, params={"search": model or "stable-diffusion"})
195
197
  if api_style in {"openai_compatible", "huggingface", "agnes", "kie"} or provider in {"pollinations", "huggingface", "agnes", "inferenceport"}:
196
198
  endpoint = _models_endpoint(base_url)
197
- elif provider == "fal_ai":
198
- endpoint = f"{base_url}/models" if base_url.endswith("/v1") else base_url
199
199
  else:
200
200
  endpoint = base_url
201
201
  return _get(endpoint, headers=headers)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.5.30",
3
+ "version": "0.5.32",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",