Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
fix: allow explicit null for max_tokens on GPT-5 models (#9562)
jnjpngeb4a0daabd9e
diff --git a/letta/schemas/llm_config.py b/letta/schemas/llm_config.pyindex 114cd99ed..94f294b5b 100644--- a/letta/schemas/llm_config.py+++ b/letta/schemas/llm_config.py@@ -137,13 +137,12 @@ class LLMConfig(BaseModel):if model is None:return values- # Set max_tokens defaults based on model- if values.get("max_tokens") is None:+ # Set max_tokens defaults based on model (only if not explicitly provided)+ if "max_tokens" not in values:if model.startswith("gpt-5"): # Covers both gpt-5 and gpt-5.1values["max_tokens"] = 16384elif model == "gpt-4.1":values["max_tokens"] = 8192- # For other models, the field default of 4096 will be used# Set context_window defaults if not providedif values.get("context_window") is None: