This commit is contained in:
Haoyan 2026-04-24 19:26:51 -05:00 committed by GitHub
commit d4fb053eff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1287,13 +1287,8 @@ def get_model_context_length(
if local_ctx and local_ctx > 0:
save_context_length(model, base_url, local_ctx)
return local_ctx
logger.info(
"Could not detect context length for model %r at %s"
"defaulting to %s tokens (probe-down). Set model.context_length "
"in config.yaml to override.",
model, base_url, f"{DEFAULT_FALLBACK_CONTEXT:,}",
)
return DEFAULT_FALLBACK_CONTEXT
# Don't early-return the fallback here — continue to steps 4-8
# so hardcoded defaults and models.dev can still match.
# 4. Anthropic /v1/models API (only for regular API keys, not OAuth)
if provider == "anthropic" or (