Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: correct ChatGPT OAuth GPT-5 max output token defaults (#9592)

jnjpng9c8589a68727
diff --git a/letta/schemas/providers/chatgpt_oauth.py b/letta/schemas/providers/chatgpt_oauth.py
index deb20c7c3..43a9b2f43 100644
--- a/letta/schemas/providers/chatgpt_oauth.py
+++ b/letta/schemas/providers/chatgpt_oauth.py
@@ -310,15 +310,21 @@ class ChatGPTOAuthProvider(Provider):
)
def get_default_max_output_tokens(self, model_name: str) -> int:
- """Get the default max output tokens for ChatGPT models."""
+ """Get the default max output tokens for ChatGPT models.
+
+ References:
+ - https://developers.openai.com/api/docs/models/gpt-5
+ - https://developers.openai.com/api/docs/models/gpt-5-codex
+ - https://developers.openai.com/api/docs/models/gpt-5.1-codex-max
+ """
+ # GPT-5 family (gpt-5, gpt-5.x, codex variants): 128k max output tokens
+ if "gpt-5" in model_name:
+ return 128000
# Reasoning models (o-series) have higher limits
if model_name.startswith("o1") or model_name.startswith("o3") or model_name.startswith("o4"):
return 100000
- # GPT-5.x models
- elif "gpt-5" in model_name:
- return 16384
# GPT-4 models
- elif "gpt-4" in model_name:
+ if "gpt-4" in model_name:
return 16384
return 4096