microsoft/autogen · error · KeyError
Model '{model}' not found in model info
Error message
Model '{model}' not found in model info What it means
Raised by autogen_ext.models.anthropic._model_info.get_info()/get_token_limit() as a KeyError when the model name passed to the Anthropic client is neither an exact key in the module-level _MODEL_INFO/_MODEL_TOKEN_LIMITS dicts nor a prefix match of any known base model id (matching is done on model_id.split("-2")[0]). It means AutoGen has no capability/token-limit metadata for that model. This happens when the client is constructed without an explicit model_info and the bundled registry is stale relative to the model you use.
Source
Thrown at python/packages/autogen-ext/src/autogen_ext/models/anthropic/_model_info.py:152
"claude-3-7-sonnet-20250219": 200000,
"claude-instant-1.2": 100000,
"claude-2.0": 100000,
"claude-2.1": 200000,
}
def get_info(model: str) -> ModelInfo:
"""Get the model information for a specific model."""
# Check for exact match first
if model in _MODEL_INFO:
return _MODEL_INFO[model]
# Check for partial match (for handling model variants)
for model_id in _MODEL_INFO:
if model.startswith(model_id.split("-2")[0]): # Match base name
return _MODEL_INFO[model_id]
raise KeyError(f"Model '{model}' not found in model info")
def get_token_limit(model: str) -> int:
"""Get the token limit for a specific model."""
# Check for exact match first
if model in _MODEL_TOKEN_LIMITS:
return _MODEL_TOKEN_LIMITS[model]
# Check for partial match (for handling model variants)
for model_id in _MODEL_TOKEN_LIMITS:
if model.startswith(model_id.split("-2")[0]): # Match base name
return _MODEL_TOKEN_LIMITS[model_id]
# Default to a reasonable limit if model not found
return 100000
View on GitHub (pinned to 027ecf0a37)
Solutions
- Pass explicit model_info to the client constructor (e.g. model_info={"family": ModelFamily.CLAUDE, "vision": ..., "function_calling": True, "json_output": True, "structured_output": False}) so the registry is never consulted
- Upgrade autogen-ext to a version whose _MODEL_INFO table includes your model
- Check the exact spelling against the keys in python/packages/autogen-ext/src/autogen_ext/models/anthropic/_model_info.py and use one of those ids (or a string starting with a registered base id before '-2')
Example fix
# before
client = AnthropicChatCompletionClient(model="claude-4-5-sonnet-2065")
# after
from autogen_core.models import ModelInfo
client = AnthropicChatCompletionClient(
model="claude-4-5-sonnet-2065",
model_info=ModelInfo(
family="claude", vision=True, function_calling=True,
json_output=True, structured_output=False,
),
) Defensive patterns
Strategy: validation
Validate before calling
from autogen_ext.models.anthropic._model_info import _MODEL_INFO
def model_supported(model: str) -> bool:
if model in _MODEL_INFO:
return True
return any(model.startswith(mid.split("-2")[0]) for mid in _MODEL_INFO)
if not model_supported(MODEL):
# supply explicit model_info instead of relying on the registry
... Prevention
- Always pass explicit model_info for newly released or non-standard Anthropic model ids
- Upgrade autogen-ext when adopting new Claude models
- Wrap model-name configuration in a startup check against _MODEL_INFO keys
When it happens
Trigger: Constructing AnthropicChatCompletionClient(model="claude-<new-or-typo'd-name>") without supplying model_info, or calling get_info()/get_token_limit() directly with an unlisted id. Also triggered by variant suffixes that do not share the base-id prefix before "-2" (e.g. a dated snapshot name whose prefix differs from the registry keys).
Common situations: Anthropic releases a new Claude model before autogen-ext's _MODEL_INFO table is updated; user typos the model id; user pins an old autogen-ext version but targets a newer model.
Related errors
- Required create args are missing: {required_create_args - cr
- Disallowed create args are present: {disallowed_create_args.
- model is required for AnthropicChatCompletionClient
- Failed to get login URL
- Authentication failed
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/5515c7b41ffbea83.
Report an issue: GitHub.