Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🧮 feat: Add GPT-5.5 Token Definitions (#12973)

Danny Avila56b87f70bd36
diff --git a/api/utils/tokens.spec.js b/api/utils/tokens.spec.js
index b890611886..143d3bb246 100644
--- a/api/utils/tokens.spec.js
+++ b/api/utils/tokens.spec.js
@@ -233,6 +233,31 @@ describe('getModelMaxTokens', () => {
);
});
+ test('should return correct tokens for gpt-5.5 matches', () => {
+ expect(maxTokensMap[EModelEndpoint.openAI]['gpt-5.5']).toBe(
+ maxTokensMap[EModelEndpoint.openAI]['gpt-5.5-pro'],
+ );
+ expect(getModelMaxTokens('gpt-5.5')).toBe(maxTokensMap[EModelEndpoint.openAI]['gpt-5.5']);
+ expect(getModelMaxTokens('gpt-5.5-thinking')).toBe(
+ maxTokensMap[EModelEndpoint.openAI]['gpt-5.5'],
+ );
+ expect(getModelMaxTokens('openai/gpt-5.5')).toBe(
+ maxTokensMap[EModelEndpoint.openAI]['gpt-5.5'],
+ );
+ expect(getModelMaxTokens('gpt-5.5-2026-04-23')).toBe(
+ maxTokensMap[EModelEndpoint.openAI]['gpt-5.5'],
+ );
+ });
+
+ test('should return correct tokens for gpt-5.5-pro matches', () => {
+ expect(getModelMaxTokens('gpt-5.5-pro')).toBe(
+ maxTokensMap[EModelEndpoint.openAI]['gpt-5.5-pro'],
+ );
+ expect(getModelMaxTokens('openai/gpt-5.5-pro')).toBe(
+ maxTokensMap[EModelEndpoint.openAI]['gpt-5.5-pro'],
+ );
+ });
+
test('should return correct tokens for Anthropic models', () => {
const models = [
'claude-2.1',
@@ -516,6 +541,8 @@ describe('getModelMaxTokens', () => {
'gpt-5.3',
'gpt-5.4',
'gpt-5.4-pro',
+ 'gpt-5.5',
+ 'gpt-5.5-pro',
'gpt-5-mini',
'gpt-5-nano',
'gpt-5-pro',
@@ -567,6 +594,12 @@ describe('findMatchingPattern - longest match wins', () => {
);
});
+ test('should match gpt-5.5-pro over shorter patterns', () => {
+ expect(getModelMaxTokens('gpt-5.5-pro-2026-04-23')).toBe(
+ maxTokensMap[EModelEndpoint.openAI]['gpt-5.5-pro'],
+ );
+ });
+
test('should match gpt-5-mini over gpt-5 for mini variants', () => {
expect(getModelMaxTokens('gpt-5-mini-chat-2025-01-01')).toBe(
maxTokensMap[EModelEndpoint.openAI]['gpt-5-mini'],
@@ -831,6 +864,12 @@ describe('matchModelName', () => {
expect(matchModelName('gpt-5.4-pro')).toBe('gpt-5.4-pro');
});
+ it('should return the closest matching key for gpt-5.5 matches', () => {
+ expect(matchModelName('openai/gpt-5.5')).toBe('gpt-5.5');
+ expect(matchModelName('gpt-5.5-thinking')).toBe('gpt-5.5');
+ expect(matchModelName('gpt-5.5-pro')).toBe('gpt-5.5-pro');
+ });
+
it('should return the input model name if no match is found - Google models', () => {
expect(matchModelName('unknown-google-model', EModelEndpoint.google)).toBe(
'unknown-google-model',
diff --git a/packages/api/src/utils/tokens.ts b/packages/api/src/utils/tokens.ts
index 3ff12bd183..75a579eb40 100644
--- a/packages/api/src/utils/tokens.ts
+++ b/packages/api/src/utils/tokens.ts
@@ -57,6 +57,8 @@ const openAIModels = {
'gpt-5.3': 400000,
'gpt-5.4': 272000, // standard context; 1M experimental available via API opt-in (2x rate)
'gpt-5.4-pro': 272000, // same window as gpt-5.4
+ 'gpt-5.5': 1050000,
+ 'gpt-5.5-pro': 1050000,
'gpt-5-mini': 400000,
'gpt-5-nano': 400000,
'gpt-5-pro': 400000,
@@ -368,6 +370,8 @@ export const modelMaxOutputs = {
'gpt-5.3': 128000,
'gpt-5.4': 128000,
'gpt-5.4-pro': 128000,
+ 'gpt-5.5': 128000,
+ 'gpt-5.5-pro': 128000,
'gpt-5-mini': 128000,
'gpt-5-nano': 128000,
'gpt-5-pro': 128000,