xtekky/gpt4free · error · ValueError

Model "{model}" not found / not yet implemented

Error message

Model "{model}" not found / not yet implemented

What it means

Thrown by g4f's LocalProvider.create_completion() when the requested model name is not a key in MODEL_LIST (the models.yaml catalog loaded once via get_models()). Before touching disk it validates the name against the catalog, so this is purely 'unknown model identifier', not 'file missing'.

Source

Thrown at g4f/locals/provider.py:43

    working_dir = "./"
    for root, dirs, files in os.walk(working_dir):
        if model_file in files:
            return root

    return new_model_dir


class LocalProvider:
    @staticmethod
    def create_completion(
        model: str, messages: Messages, stream: bool = False, **kwargs
    ):
        global MODEL_LIST
        if MODEL_LIST is None:
            MODEL_LIST = get_models()
        if model not in MODEL_LIST:
            raise ValueError(f'Model "{model}" not found / not yet implemented')

        model = MODEL_LIST[model]
        model_file = model["path"]
        model_dir = find_model_dir(model_file)
        if not os.path.isfile(os.path.join(model_dir, model_file)):
            print(f'Model file "models/{model_file}" not found.')
            download = input(f"Do you want to download {model_file}? [y/n]: ")
            if download in ["y", "Y"]:
                GPT4All.download_model(model_file, model_dir)
            else:
                raise ValueError(f'Model "{model_file}" not found.')

        model = GPT4All(
            model_name=model_file,
            # n_threads=8,
            verbose=False,
            allow_download=False,
            model_path=model_dir,

View on GitHub (pinned to 973504e177)

Solutions

  1. List valid names at runtime: from g4f.locals.provider import get_models; print(get_models().keys()) and use one of them.
  2. Update g4f so models.yaml is current for your version.
  3. If you maintain a custom models.yaml, add an entry whose key is the name you pass and whose 'path' points to a GGUF file under the models dir.

Example fix

// before
response = LocalProvider.create_completion(model="gpt-4", messages=msgs)

// after
from g4f.locals.provider import get_models
name = next(iter(get_models()))  # pick a cataloged model
response = LocalProvider.create_completion(model=name, messages=msgs)
Defensive patterns

Strategy: validation

Validate before calling

from g4f.locals.provider import get_models

def valid_local_model(model: str) -> bool:
    return model in get_models()

Try / catch

try:
    LocalProvider.create_completion(model=model, messages=msgs)
except ValueError as e:
    if "not found / not yet implemented" in str(e):
        model = next(iter(get_models()))  # or surface a model list to the user
    raise

Prevention

When it happens

Trigger: Calling the local provider with a typo'd or non-catalog name, e.g. 'gpt-3.5-turbo' or 'llama-3-70b' when the catalog lists e.g. 'Meta-Llama-3-8B-Instruct'. Also when a stale/edited models.yaml lacks the entry, or get_models() failed to find the file and produced an empty list.

Common situations: Pointing client code at the local backend with a cloud provider's model name; version changes renaming catalog entries; models.yaml not shipped or overridden by an env var pointing elsewhere.

Related errors


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