xtekky/gpt4free · error · ModelNotFoundError
Model '{_model}' is not supported by LMArena provider.
Error message
Model '{_model}' is not supported by LMArena provider. What it means
Raised by the get_mode_id() closure in LMArena.create_async_generator. After applying model_aliases, the requested model name was not found in text_models, image_models, or video_models, so it cannot be mapped to an LMArena model ID. ModelNotFoundError tells the caller the model string is invalid for this provider.
Source
Thrown at g4f/Provider/needs_auth/LMArena.py:594
if not cls._models_loaded:
# change to async
await cls.get_models_async()
def get_mode_id(_model):
model_id = None
# if not model:
# model = cls.default_model
if _model in cls.model_aliases:
_model = cls.model_aliases[_model]
if _model in cls.text_models:
model_id = cls.text_models[_model]
elif _model in cls.image_models:
model_id = cls.image_models[_model]
elif _model in cls.video_models:
model_id = cls.video_models[_model]
elif _model:
raise ModelNotFoundError(
f"Model '{_model}' is not supported by LMArena provider."
)
return model_id
modelA: str = model
modelB: str = kwargs.get("modelB", "")
modelAId = get_mode_id(modelA)
modelBId = get_mode_id(modelB) if modelB else None
if modelAId and modelBId:
mode = "side-by-side"
elif modelAId:
mode = "direct-battle"
else:
mode = "battle"
if conversation and getattr(conversation, "evaluationSessionId", None):
url = cls.post_to_evaluation.format(id=conversation.evaluationSessionId)
evaluationSessionId = conversation.evaluationSessionId
else:View on GitHub (pinned to 973504e177)
Solutions
- List supported models first and pick from them: models = await LMArena.get_models_async(); use a key from that result
- Update g4f — model aliases and ID maps for LMArena change frequently
- If the model list is empty, ensure auth worked (models load only after a valid session) and retry
- Check model_aliases for the provider to use the accepted alias spelling
Example fix
# before resp = await client.chat.completions.create(model='gpt-4-turbo', messages=msgs) # not an LMArena model # after models = await LMArena.get_models_async() # or check g4f model listing resp = await client.chat.completions.create(model=list(models)[0], messages=msgs)
Defensive patterns
Strategy: validation
Validate before calling
models = await LMArena.get_models_async()
if model not in models and model not in LMArena.model_aliases:
model = next(iter(models)) # or raise a clear config error Type guard
def model_supported(name: str, models: dict, aliases: dict) -> bool:
return name in aliases or name in models Try / catch
from g4f.errors import ModelNotFoundError
try:
resp = await client.chat.completions.create(model=model, messages=msgs)
except ModelNotFoundError:
models = await LMArena.get_models_async()
resp = await client.chat.completions.create(model=list(models)[0], messages=msgs) Prevention
- Resolve models dynamically from get_models_async() instead of hardcoding names
- Validate both model and modelB before side-by-side battles
- Refresh model lists after g4f updates
When it happens
Trigger: Passing a model string that is not in LMArena.get_models() output, e.g. a model name belonging to another provider, a renamed/removed arena model, or a typo; also modelB resolution when kwargs['modelB'] names an unknown model.
Common situations: Copying model names from other providers ('gpt-4o' style names that LMArena does not expose), using a stale hardcoded model list after LMArena rotated its arena models, or the models list failing to load (so dicts are empty and every name misses).
Related errors
- Model {model} not found
- Model is not supported: {model} in: {cls.__name__}
- Provider '{item}' not found
- Label must be provided
- Provider with label '{label}' not found
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/28b40d65c18b34f0.
Report an issue: GitHub.