Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add GPT-5.4 model support (#9798)
Kevin Linae5b12d39ae4
diff --git a/letta/constants.py b/letta/constants.pyindex 2e1748e9b..778b3548b 100644--- a/letta/constants.py+++ b/letta/constants.py@@ -280,6 +280,9 @@ LLM_MAX_CONTEXT_WINDOW = {"gpt-5.2-codex": 272000,# gpt-5.3"gpt-5.3-codex": 272000,+ # gpt-5.4+ "gpt-5.4": 1050000,+ "gpt-5.4-2026-03-05": 1050000,# reasoners"o1": 200000,# "o1-pro": 200000, # responses API onlydiff --git a/letta/model_specs/model_prices_and_context_window.json b/letta/model_specs/model_prices_and_context_window.jsonindex 1ee4e4631..3049ab6cc 100644--- a/letta/model_specs/model_prices_and_context_window.json+++ b/letta/model_specs/model_prices_and_context_window.json@@ -17347,6 +17347,62 @@"supports_tool_choice": true,"supports_vision": true},+ "gpt-5.4": {+ "cache_read_input_token_cost": 2.5e-7,+ "input_cost_per_token": 2.5e-6,+ "litellm_provider": "openai",+ "max_input_tokens": 1050000,+ "max_output_tokens": 128000,+ "max_tokens": 128000,+ "mode": "chat",+ "output_cost_per_token": 1.5e-5,+ "supported_endpoints": [+ "/v1/chat/completions",+ "/v1/batch",+ "/v1/responses"+ ],+ "supported_modalities": ["text", "image"],+ "supported_output_modalities": ["text"],+ "supports_function_calling": true,+ "supports_native_streaming": true,+ "supports_parallel_function_calling": true,+ "supports_pdf_input": true,+ "supports_prompt_caching": true,+ "supports_reasoning": true,+ "supports_response_schema": true,+ "supports_system_messages": true,+ "supports_tool_choice": true,+ "supports_service_tier": true,+ "supports_vision": true+ },+ "gpt-5.4-2026-03-05": {+ "cache_read_input_token_cost": 2.5e-7,+ "input_cost_per_token": 2.5e-6,+ "litellm_provider": "openai",+ "max_input_tokens": 1050000,+ "max_output_tokens": 128000,+ "max_tokens": 128000,+ "mode": "chat",+ "output_cost_per_token": 1.5e-5,+ "supported_endpoints": [+ "/v1/chat/completions",+ "/v1/batch",+ "/v1/responses"+ ],+ "supported_modalities": ["text", "image"],+ "supported_output_modalities": ["text"],+ "supports_function_calling": true,+ "supports_native_streaming": true,+ "supports_parallel_function_calling": true,+ "supports_pdf_input": true,+ "supports_prompt_caching": true,+ "supports_reasoning": true,+ "supports_response_schema": true,+ "supports_system_messages": true,+ "supports_tool_choice": true,+ "supports_service_tier": true,+ "supports_vision": true+ },"gpt-5-mini": {"cache_read_input_token_cost": 2.5e-8,"cache_read_input_token_cost_flex": 1.25e-8,diff --git a/letta/schemas/providers/openai.py b/letta/schemas/providers/openai.pyindex 2611a2095..93e9e38f8 100644--- a/letta/schemas/providers/openai.py+++ b/letta/schemas/providers/openai.py@@ -54,12 +54,12 @@ class OpenAIProvider(Provider):def _openai_default_max_output_tokens(model_name: str) -> int:"""Return a sensible max-output-tokens default for OpenAI models.- gpt-5.2* / gpt-5.3* support 128k output tokens, except the+ gpt-5.2* / gpt-5.3* / gpt-5.4* support 128k output tokens, except the`-chat` variants which are capped at 16k."""import re- if re.match(r"^gpt-5\.[23]", model_name) and "-chat" not in model_name:+ if re.match(r"^gpt-5\.[234]", model_name) and "-chat" not in model_name:return 128000return 16384