From 88edc39df394e10c615b4f2c40111ac05b6d0385 Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Wed, 18 Mar 2026 02:26:12 +0800 Subject: [PATCH] Add OpenAI GPT-5.4 mini and nano models Register gpt-5.4-mini and gpt-5.4-nano in the OpenAI native provider and add gpt-5.4-mini to the OpenAI Codex catalog to match current OpenAI availability. Update provider tests to cover model metadata and Responses API request bodies, and add a changeset instead of editing the generated changelog directly. --- .changeset/add-openai-gpt-5-4-mini-nano.md | 6 +++ packages/types/src/providers/openai-codex.ts | 15 +++++++ packages/types/src/providers/openai.ts | 37 ++++++++++++++++++ .../providers/__tests__/openai-codex.spec.ts | 8 ++++ .../providers/__tests__/openai-native.spec.ts | 39 +++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 .changeset/add-openai-gpt-5-4-mini-nano.md diff --git a/.changeset/add-openai-gpt-5-4-mini-nano.md b/.changeset/add-openai-gpt-5-4-mini-nano.md new file mode 100644 index 00000000000..4c47f6c202c --- /dev/null +++ b/.changeset/add-openai-gpt-5-4-mini-nano.md @@ -0,0 +1,6 @@ +--- +"roo-cline": patch +"@roo-code/types": patch +--- + +Add support for OpenAI `gpt-5.4-mini` and `gpt-5.4-nano` models. diff --git a/packages/types/src/providers/openai-codex.ts b/packages/types/src/providers/openai-codex.ts index 3d1bcae4faf..47809723761 100644 --- a/packages/types/src/providers/openai-codex.ts +++ b/packages/types/src/providers/openai-codex.ts @@ -187,6 +187,21 @@ export const openAiCodexModels = { supportsTemperature: false, description: "GPT-5.4: Most capable model via ChatGPT subscription", }, + "gpt-5.4-mini": { + maxTokens: 128000, + contextWindow: 400000, + includedTools: ["apply_patch"], + excludedTools: ["apply_diff", "write_to_file"], + supportsImages: true, + supportsPromptCache: true, + supportsReasoningEffort: ["none", "low", "medium", "high", "xhigh"], + reasoningEffort: "none", + inputPrice: 0, + outputPrice: 0, + supportsVerbosity: true, + supportsTemperature: false, + description: "GPT-5.4 Mini: Lower-cost GPT-5.4 model via ChatGPT subscription", + }, "gpt-5.2": { maxTokens: 128000, contextWindow: 400000, diff --git a/packages/types/src/providers/openai.ts b/packages/types/src/providers/openai.ts index cdbc82fd520..81a022c663a 100644 --- a/packages/types/src/providers/openai.ts +++ b/packages/types/src/providers/openai.ts @@ -50,6 +50,43 @@ export const openAiNativeModels = { ], description: "GPT-5.4: Our most capable model for professional work", }, + "gpt-5.4-mini": { + maxTokens: 128000, + contextWindow: 400000, + includedTools: ["apply_patch"], + excludedTools: ["apply_diff", "write_to_file"], + supportsImages: true, + supportsPromptCache: true, + supportsReasoningEffort: ["none", "low", "medium", "high", "xhigh"], + reasoningEffort: "none", + inputPrice: 0.75, + outputPrice: 4.5, + cacheReadsPrice: 0.075, + supportsVerbosity: true, + supportsTemperature: false, + tiers: [ + { name: "flex", contextWindow: 400000, inputPrice: 0.375, outputPrice: 2.25, cacheReadsPrice: 0.0375 }, + { name: "priority", contextWindow: 400000, inputPrice: 1.5, outputPrice: 9.0, cacheReadsPrice: 0.15 }, + ], + description: "GPT-5.4 Mini: A faster, lower-cost GPT-5.4 model for coding and agentic workflows", + }, + "gpt-5.4-nano": { + maxTokens: 128000, + contextWindow: 400000, + includedTools: ["apply_patch"], + excludedTools: ["apply_diff", "write_to_file"], + supportsImages: true, + supportsPromptCache: true, + supportsReasoningEffort: ["none", "low", "medium", "high", "xhigh"], + reasoningEffort: "none", + inputPrice: 0.2, + outputPrice: 1.25, + cacheReadsPrice: 0.02, + supportsVerbosity: true, + supportsTemperature: false, + tiers: [{ name: "flex", contextWindow: 400000, inputPrice: 0.1, outputPrice: 0.625, cacheReadsPrice: 0.01 }], + description: "GPT-5.4 Nano: The smallest GPT-5.4 model for high-volume, low-latency tasks", + }, "gpt-5.2": { maxTokens: 128000, contextWindow: 400000, diff --git a/src/api/providers/__tests__/openai-codex.spec.ts b/src/api/providers/__tests__/openai-codex.spec.ts index 2e164fe469f..dcc0c4d0357 100644 --- a/src/api/providers/__tests__/openai-codex.spec.ts +++ b/src/api/providers/__tests__/openai-codex.spec.ts @@ -33,4 +33,12 @@ describe("OpenAiCodexHandler.getModel", () => { expect(model.info.maxTokens).toBe(8192) expect(model.info.supportsImages).toBe(false) }) + + it("should use GPT-5.4 Mini capabilities when selected", () => { + const handler = new OpenAiCodexHandler({ apiModelId: "gpt-5.4-mini" }) + const model = handler.getModel() + + expect(model.id).toBe("gpt-5.4-mini") + expect(model.info).toBeDefined() + }) }) diff --git a/src/api/providers/__tests__/openai-native.spec.ts b/src/api/providers/__tests__/openai-native.spec.ts index 682fece5706..6887da4d20f 100644 --- a/src/api/providers/__tests__/openai-native.spec.ts +++ b/src/api/providers/__tests__/openai-native.spec.ts @@ -264,6 +264,45 @@ describe("OpenAiNativeHandler", () => { expect(modelInfo.info.reasoningEffort).toBe("none") }) + it("should return GPT-5.4 Mini model info when selected", () => { + const gpt54MiniHandler = new OpenAiNativeHandler({ + ...mockOptions, + apiModelId: "gpt-5.4-mini", + }) + + const modelInfo = gpt54MiniHandler.getModel() + expect(modelInfo.id).toBe("gpt-5.4-mini") + expect(modelInfo.info.maxTokens).toBe(128000) + expect(modelInfo.info.contextWindow).toBe(400000) + expect(modelInfo.info.supportsVerbosity).toBe(true) + expect(modelInfo.info.supportsReasoningEffort).toEqual(["none", "low", "medium", "high", "xhigh"]) + expect(modelInfo.info.reasoningEffort).toBe("none") + expect(modelInfo.info.longContextPricing).toBeUndefined() + }) + + it("should return GPT-5.4 Nano model info when selected", () => { + const gpt54NanoHandler = new OpenAiNativeHandler({ + ...mockOptions, + apiModelId: "gpt-5.4-nano", + }) + + const modelInfo = gpt54NanoHandler.getModel() + expect(modelInfo.id).toBe("gpt-5.4-nano") + expect(modelInfo.info.maxTokens).toBe(128000) + expect(modelInfo.info.contextWindow).toBe(400000) + expect(modelInfo.info.supportsVerbosity).toBe(true) + expect(modelInfo.info.supportsReasoningEffort).toEqual(["none", "low", "medium", "high", "xhigh"]) + expect(modelInfo.info.reasoningEffort).toBe("none") + expect(modelInfo.info.outputPrice).toBe(1.25) + expect(modelInfo.info.longContextPricing).toBeUndefined() + expect(modelInfo.info.tiers).toEqual([ + expect.objectContaining({ + name: "flex", + outputPrice: 0.625, + }), + ]) + }) + it("should return GPT-5.3 Chat model info when selected", () => { const chatHandler = new OpenAiNativeHandler({ ...mockOptions,