fix(model_metadata): prefer hardcoded 1M for MiniMax M3 over stale models.dev probe

This commit is contained in:
达令小新 2026-06-09 03:25:05 +08:00 committed by Teknium
parent aea0b7397b
commit 5a4297a11a

View file

@ -1838,6 +1838,17 @@ def get_model_context_length(
from agent.models_dev import lookup_models_dev_context
ctx = lookup_models_dev_context(effective_provider, model)
if ctx:
# MiniMax M3: models.dev reports 512K but actual context is 1M.
# Prefer hardcoded catalog over stale probe value.
if _model_name_suggests_minimax_m3(model):
catalog = DEFAULT_CONTEXT_LENGTHS.get("minimax-m3")
if catalog and ctx < catalog:
logger.info(
"Rejecting models.dev context=%s for %r "
"(MiniMax-M3 underreport); using hardcoded default %s",
ctx, model, f"{catalog:,}",
)
ctx = catalog
return ctx
# 6. OpenRouter live API metadata — provider-unaware fallback.