xtekky/gpt4free · warning · ValueError

Model '{model}' is not supported by {cls.__name__}. Supporte

Error message

Model '{model}' is not supported by {cls.__name__}. Supported models: {cls.models}

What it means

Raised as ValueError by the Video provider when the requested model is not in cls.video_models. The provider only serves a fixed list of video/search models; any other string is rejected before any network call, and the message lists the supported set.

Source

Thrown at g4f/Provider/needs_auth/Video.py:146

        "search": "https://app.flim.ai/?ft={0}",
    }

    active_by_default = True
    default_model = "search"
    models = list(urls.keys())
    video_models = models

    needs_auth = False
    working = True

    @classmethod
    async def create_async_generator(
        cls, model: str, messages: Messages, prompt: str = None, **kwargs
    ) -> AsyncResult:
        if not model:
            model = cls.default_model
        if model not in cls.video_models:
            raise ValueError(
                f"Model '{model}' is not supported by {cls.__name__}. Supported models: {cls.models}"
            )
        yield ProviderInfo(**cls.get_dict(), model=model)
        prompt = (
            format_media_prompt(messages, prompt)
            .encode()[:100]
            .decode("utf-8", "ignore")
            .strip()
        )
        if not prompt:
            raise ValueError("Prompt cannot be empty.")
        prompt = await RequestConfig.translate_prompt(prompt)
        response = await RequestConfig.get_response(prompt, model == "search")
        if response:
            yield Reasoning(label=f"Found {len(response.urls)} Video(s)", status="")
            yield response
            return
        raise RuntimeError("Failed to find any videos for the prompt.")

View on GitHub (pinned to 973504e177)

Solutions

  1. Use one of the models listed in the error message (cls.models for the provider class)
  2. Check g4f.Provider.Video.supported_models or the provider's get_models() at runtime
  3. Update g4f if a newer video model should be supported

Example fix

# before
response = client.chat.completions.create(model='gpt-4o', messages=msgs, provider=g4f.Provider.Video)

# after
response = client.chat.completions.create(model='search', messages=msgs, provider=g4f.Provider.Video)  # or another listed model
Defensive patterns

Strategy: type-guard

Validate before calling

supported = g4f.Provider.Video.video_models  # or cls.get_models()
if model not in supported:
    model = next(iter(supported))  # pick a valid default

Type guard

def is_supported_video_model(model: str) -> bool:
    return isinstance(model, str) and model in g4f.Provider.Video.video_models

Try / catch

try:
    result = ...create(model=model, provider=g4f.Provider.Video)
except ValueError as e:
    if 'not supported' in str(e):
        model = 'search'
        result = ...create(model=model, provider=g4f.Provider.Video)
    else:
        raise

Prevention

When it happens

Trigger: Passing a text model name or a typo (e.g. 'gpt-4o' or 'veo-typo') to the Video provider's create_async_generator.

Common situations: Routing automation picks a generic default model for every provider, model list changed between g4f versions so a previously valid name is gone.

Related errors


AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14). Data as JSON: /api/errors/7a8bebcc0456b037. Report an issue: GitHub.