🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
✨ feat(model-bank): add GPT Image 2.6 Flare and Sunburst with animated GIF output (#22806)
Lee Junho8b952a0cb216
diff --git a/apps/server/src/routers/lambda/image/index.test.ts b/apps/server/src/routers/lambda/image/index.test.tsindex 126a637f558..059c4b92851 100644--- a/apps/server/src/routers/lambda/image/index.test.ts+++ b/apps/server/src/routers/lambda/image/index.test.ts@@ -253,6 +253,54 @@ describe('imageRouter', () => {});describe('createImage', () => {+ it('preserves passthrough GIF size for an unrelated custom model', async () => {+ const params = { prompt: 'custom GIF fixture', outputFormat: 'gif', size: '768x768' };+ const caller = imageRouter.createCaller(createMockCtx());++ await caller.createImage(+ createDefaultInput({ model: 'custom-gif-model', provider: 'fal', params }),+ );++ expect((mockInsertValues[0] as { config: unknown }).config).toEqual(params);+ expect(mockAsyncCallerCreateImage.mock.lastCall?.[0].params).toEqual(params);+ });++ it.each(['gif', 'png'])(+ 'records only effective dimensions for %s API submissions',+ async (outputFormat) => {+ const params = {+ prompt: 'synthetic image fixture',+ outputFormat,+ size: '1536x1024',+ frameCount: 9,+ };+ mockGetAiProviderModelList.mockResolvedValue([+ {+ id: 'gpt-image-2.6-flare',+ parameters: {+ prompt: { default: '' },+ outputFormat: { default: 'png', enum: ['png', 'gif'] },+ size: { default: '1024x1024', enum: ['1024x1024', '1536x1024'] },+ frameCount: { default: 9 },+ },+ type: 'image',+ },+ ]);+ const caller = imageRouter.createCaller(createMockCtx());++ await caller.createImage(+ createDefaultInput({ model: 'gpt-image-2.6-flare', provider: 'openai', params }),+ );++ const expectedConfig =+ outputFormat === 'gif' ? { prompt: params.prompt, outputFormat, frameCount: 9 } : params;+ expect(mockInsertValues[0]).toMatchObject({ config: expectedConfig });+ expect((mockInsertValues[0] as { config: unknown }).config).toEqual(expectedConfig);+ expect(mockAsyncCallerCreateImage.mock.lastCall?.[0].params).toEqual(expectedConfig);+ expect(params.size).toBe('1536x1024');+ },+ );+describe('default model selection', () => {const imageModel = (providerId: string, id: string) => ({abilities: {},diff --git a/apps/server/src/routers/lambda/image/index.ts b/apps/server/src/routers/lambda/image/index.tsindex d8601098e2b..05daff82d52 100644--- a/apps/server/src/routers/lambda/image/index.ts+++ b/apps/server/src/routers/lambda/image/index.ts@@ -37,6 +37,7 @@ import {} from '@/types/asyncTask';import { type ProviderConfig } from '@/types/user/settings';import { resolveImageModelSelection } from '@/utils/defaultImageModel';+import { normalizeImageGenerationParams } from '@/utils/normalizeImageGenerationParams';import { generateUniqueSeeds } from '@/utils/number';import { buildEnabledImageProviderModels } from './defaultModel';@@ -117,7 +118,8 @@ export const imageRouter = router({.mutation(async ({ input, ctx }) => {const { userId, serverDB, asyncTaskModel, fileService, generationTopicModel } = ctx;const wsId = ctx.workspaceId ?? undefined;- const { generationTopicId, imageNum, params } = input;+ const { generationTopicId, imageNum } = input;+ let params = input.params;log('Starting image creation process, input: %O', input);@@ -191,6 +193,10 @@ export const imageRouter = router({}}+ // Old clients and API callers may still send a static size with GIF output. Keep the+ // stored batch and queued request consistent with the runtime's automatic GIF sizing.+ params = normalizeImageGenerationParams(params, resolvedModelId);+// Normalize reference image addresses, store S3 keys uniformly (avoid storing expiring presigned URLs in database)let configForDatabase = { ...params };// 1) Process multiple images in imageUrlsdiff --git a/locales/en-US/image.json b/locales/en-US/image.jsonindex 4846254af2a..d66bf144137 100644--- a/locales/en-US/image.json+++ b/locales/en-US/image.json@@ -33,6 +33,7 @@"config.resolution.options.512": "512px","config.seed.label": "Seed","config.seed.random": "Random Seed",+ "config.size.autoByOpenAI": "Auto (determined by OpenAI)","config.size.label": "Size","config.steps.label": "Steps","config.title": "Configuration",diff --git a/locales/en-US/models.json b/locales/en-US/models.jsonindex 6b065dffe77..f37a85932b5 100644--- a/locales/en-US/models.json+++ b/locales/en-US/models.json@@ -707,6 +707,8 @@"gpt-image-1.description": "ChatGPT native multimodal image generation model.","gpt-image-2.5-flare.description": "OpenAI's fastest model for high-quality everyday image generation and editing, with quality up to max and up to 4K output.","gpt-image-2.5-sunburst.description": "OpenAI's most capable image generation and editing model, built for workflows where editing precision matters most, with quality up to max and up to 4K output.",+ "gpt-image-2.6-flare.description": "GPT Image 2.6 Flare generates and edits images from text and image inputs for fast, interactive visual workflows.",+ "gpt-image-2.6-sunburst.description": "GPT Image 2.6 Sunburst generates and edits images from text and image inputs for detailed compositions and precise visual editing.","gpt-image-2.description": "OpenAI's next-generation multimodal image model with native reasoning, up to 4K resolution, near-perfect text rendering, and high-fidelity multilingual support.","gpt-oss-120b.description": "OpenAI GPT-OSS 120B is a top-tier open-source language model with 120 billion parameters, offering strong reasoning and coding capabilities.","gpt-oss-20b.description": "Access requires an application. GPT-OSS-20B is an open-source mid-size language model from OpenAI with efficient text generation.",diff --git a/locales/zh-CN/image.json b/locales/zh-CN/image.jsonindex 1f32e818108..105238b63fc 100644--- a/locales/zh-CN/image.json+++ b/locales/zh-CN/image.json@@ -33,6 +33,7 @@"config.resolution.options.512": "512px","config.seed.label": "种子","config.seed.random": "随机种子",+ "config.size.autoByOpenAI": "自动(由 OpenAI 决定)","config.size.label": "尺寸","config.steps.label": "步数","config.title": "配置",diff --git a/locales/zh-CN/models.json b/locales/zh-CN/models.jsonindex 2c85221ea4a..b3faa432795 100644--- a/locales/zh-CN/models.json+++ b/locales/zh-CN/models.json@@ -707,6 +707,8 @@"gpt-image-1.description": "ChatGPT 原生多模态图像生成模型。","gpt-image-2.5-flare.description": "OpenAI 最快的模型,适用于高质量的日常图像生成和编辑,质量最高为 max,输出最高可达 4K。","gpt-image-2.5-sunburst.description": "OpenAI 功能最强大的图像生成和编辑模型,专为最看重编辑精度的工作流而打造,质量最高为 max,输出最高可达 4K。",+ "gpt-image-2.6-flare.description": "GPT Image 2.6 Flare 可根据文本和图像输入生成并编辑图像,适合快速、交互式的视觉工作流。",+ "gpt-image-2.6-sunburst.description": "GPT Image 2.6 Sunburst 可根据文本和图像输入生成并编辑图像,适合细节丰富的构图和精准的视觉编辑。","gpt-image-2.description": "OpenAI 的下一代多模态图像模型,具备原生推理能力,支持最高 4K 分辨率、近乎完美的文字渲染及高保真多语言能力。","gpt-oss-120b.description": "OpenAI GPT-OSS 120B是一款顶级开源语言模型,拥有1200亿参数,提供强大的推理和编码能力。","gpt-oss-20b.description": "需申请访问。GPT-OSS-20B 是 OpenAI 开源的中型语言模型,具备高效的文本生成能力。",diff --git a/packages/locales/src/default/image.ts b/packages/locales/src/default/image.tsindex 6528ca2ed3c..14ad839a407 100644--- a/packages/locales/src/default/image.ts+++ b/packages/locales/src/default/image.ts@@ -33,6 +33,7 @@ export default {'config.resolution.options.4K': '4K','config.seed.label': 'Seed','config.seed.random': 'Random Seed',+ 'config.size.autoByOpenAI': 'Auto (determined by OpenAI)','config.size.label': 'Size','config.steps.label': 'Steps','config.title': 'Configuration',diff --git a/packages/model-bank/src/aiModels/openai/gptImage26Parameters.test.ts b/packages/model-bank/src/aiModels/openai/gptImage26Parameters.test.tsnew file mode 100644index 00000000000..297bf3d5e99--- /dev/null+++ b/packages/model-bank/src/aiModels/openai/gptImage26Parameters.test.ts@@ -0,0 +1,25 @@+import { describe, expect, it } from 'vitest';++import { gptImage2Schema } from '../../const/imageParameters';+import { ModelParamsMetaSchema } from '../../standard-parameters';++import { gptImage26Schema } from './gptImage26Parameters';++describe('gptImage26Schema', () => {+ it('declares GIF output within API bounds and six quality tiers, sharing GPT Image 2 sizes', () => {+ expect(() => ModelParamsMetaSchema.parse(gptImage26Schema)).not.toThrow();+ expect(gptImage26Schema).toMatchObject({+ frameCount: { default: 9, max: 16, min: 2, step: 1 },+ frameDurationMs: { default: 200, max: 2000, min: 20, step: 10 },+ imageUrls: gptImage2Schema.imageUrls,+ outputFormat: { default: 'png', enum: ['png', 'gif'] },+ quality: { default: 'auto', enum: ['auto', 'low', 'medium', 'high', 'xhigh', 'max'] },+ size: gptImage2Schema.size,+ });+ });++ it('keeps GIF output off GPT Image 2', () => {+ for (const key of ['outputFormat', 'frameCount', 'frameDurationMs'])+ expect(gptImage2Schema).not.toHaveProperty(key);+ });+});diff --git a/packages/model-bank/src/aiModels/openai/gptImage26Parameters.ts b/packages/model-bank/src/aiModels/openai/gptImage26Parameters.tsnew file mode 100644index 00000000000..014900afd59--- /dev/null+++ b/packages/model-bank/src/aiModels/openai/gptImage26Parameters.ts@@ -0,0 +1,23 @@+import { gptImage2Schema } from '../../const/imageParameters';+import type { ModelParamsSchema } from '../../standard-parameters';++/**+ * GPT Image 2.6 Flare / Sunburst. Animated GIF output is generation-only; the frame fields are+ * sent only with `outputFormat: 'gif'`, and a GIF leaves its frame size to the API (see+ * `applyImageOutputParams`).+ *+ * @see https://developers.openai.com/api/docs/guides/image-generation#generate-animated-gif-output+ */+export const gptImage26Schema: ModelParamsSchema = {+ // The API rejects 17 with "Use an integer from 2 to 16".+ frameCount: { default: 9, max: 16, min: 2, step: 1 },+ frameDurationMs: { default: 200, max: 2000, min: 20, step: 10 },+ imageUrls: gptImage2Schema.imageUrls,+ outputFormat: { default: 'png', enum: ['png', 'gif'] },+ prompt: { default: '' },+ quality: {+ default: 'auto',+ enum: ['auto', 'low', 'medium', 'high', 'xhigh', 'max'],+ },+ size: gptImage2Schema.size,+};diff --git a/packages/model-bank/src/aiModels/openai/nonChat.test.ts b/packages/model-bank/src/aiModels/openai/nonChat.test.tsnew file mode 100644index 00000000000..dd9e1c0f98c--- /dev/null+++ b/packages/model-bank/src/aiModels/openai/nonChat.test.ts@@ -0,0 +1,29 @@+import { describe, expect, it } from 'vitest';++import { gptImage26Schema } from './gptImage26Parameters';+import { openaiImageModels } from './nonChat';++describe('GPT Image 2.6 model cards', () => {+ it.each(['gpt-image-2.6-flare', 'gpt-image-2.6-sunburst'])(+ 'registers %s as an enabled official image model on the 2.6 schema',+ (id) => {+ const card = openaiImageModels.find((model) => model.id === id);++ expect(card).toMatchObject({+ enabled: true,+ isOfficial: true,+ releasedAt: '2026-11-04',+ type: 'image',+ });+ expect(card?.parameters).toBe(gptImage26Schema);+ /** @see https://developers.openai.com/api/docs/pricing */+ expect(card?.pricing?.units).toEqual([+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'imageInput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'imageInput_cacheRead', rate: 2, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'imageOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },+ ]);+ },+ );+});diff --git a/packages/model-bank/src/aiModels/openai/nonChat.ts b/packages/model-bank/src/aiModels/openai/nonChat.tsindex 08454f696d3..8eacdf7ed20 100644--- a/packages/model-bank/src/aiModels/openai/nonChat.ts+++ b/packages/model-bank/src/aiModels/openai/nonChat.ts@@ -14,6 +14,8 @@ import type {AIVideoModelCard,} from '../../types/aiModel';+import { gptImage26Schema } from './gptImage26Parameters';+/** OpenAI cards for endpoints other than chat and decisions; `allModels` lives in `./index`. */export const openaiEmbeddingModels: AIEmbeddingModelCard[] = [@@ -152,6 +154,50 @@ export const openaiASRModels: AIASRModelCard[] = [// Image generation modelsexport const openaiImageModels: AIImageModelCard[] = [+ {+ description:+ 'GPT Image 2.6 Sunburst generates and edits images from text and image inputs for detailed compositions and precise visual editing.',+ displayName: 'GPT Image 2.6 Sunburst',+ enabled: true,+ id: 'gpt-image-2.6-sunburst',+ isOfficial: true,+ parameters: gptImage26Schema,+ // https://developers.openai.com/api/docs/models/gpt-image-2.6-sunburst+ pricing: {+ // Token rates match GPT Image 2.5; a GIF bills its frames as image output tokens.+ units: [+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'imageInput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'imageInput_cacheRead', rate: 2, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'imageOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },+ ],+ },+ releasedAt: '2026-11-04',+ type: 'image',+ },+ {+ description:+ 'GPT Image 2.6 Flare generates and edits images from text and image inputs for fast, interactive visual workflows.',+ displayName: 'GPT Image 2.6 Flare',+ enabled: true,+ id: 'gpt-image-2.6-flare',+ isOfficial: true,+ parameters: gptImage26Schema,+ // https://developers.openai.com/api/docs/models/gpt-image-2.6-flare+ pricing: {+ // Token rates match GPT Image 2.5; a GIF bills its frames as image output tokens.+ units: [+ { name: 'textInput', rate: 5, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'textInput_cacheRead', rate: 1.25, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'imageInput', rate: 8, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'imageInput_cacheRead', rate: 2, strategy: 'fixed', unit: 'millionTokens' },+ { name: 'imageOutput', rate: 30, strategy: 'fixed', unit: 'millionTokens' },+ ],+ },+ releasedAt: '2026-11-04',+ type: 'image',+ },{description:"OpenAI's most capable image generation and editing model, built for workflows where editing precision matters most, with quality up to max and up to 4K output.",diff --git a/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.test.ts b/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.test.tsindex cb76bc95f41..593b7267302 100644--- a/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.test.ts+++ b/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.test.ts@@ -41,6 +41,17 @@ describe('applyImageOutputParams', () => {expect(input).toEqual({ prompt: 'p' });});+ it.each([+ ['gif', { frame_count: 9, output_format: 'gif' }],+ ['png', { output_format: 'png', size: '1024x1024' }],+ ])('leaves the frame size to the API only for a GIF (%s)', (format, expected) => {+ const input: Record<string, any> = { frameCount: 9, outputFormat: format, size: '1024x1024' };++ applyImageOutputParams(input, { isImageEdit: false });++ expect(input).toEqual(expected);+ });+it('rejects GIF output on the edit endpoint', () => {expect(() =>applyImageOutputParams({ outputFormat: 'gif' }, { isImageEdit: true }),diff --git a/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.ts b/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.tsindex fc1642acdd2..9a56dde1486 100644--- a/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.ts+++ b/packages/model-runtime/src/core/openaiCompatible/imageOutputParams.ts@@ -27,7 +27,8 @@ export const GIF_EDIT_UNSUPPORTED_MESSAGE =/*** Rename output controls to Images API fields in place and drop frame fields unless the- * request asks for a GIF. Throws when a GIF is requested on the edit endpoint.+ * request asks for a GIF. A GIF leaves its frame size to the API. Throws when a GIF is+ * requested on the edit endpoint.*/export const applyImageOutputParams = (userInput: Record<string, any>,@@ -41,6 +42,9 @@ export const applyImageOutputParams = (if (userInput.output_format === 'gif') {if (isImageEdit) throw new Error(GIF_EDIT_UNSUPPORTED_MESSAGE);+ // Frames share one sheet within the pixel budget, so every listed size (1024px and up) is+ // rejected for a GIF ("No supported sheet fits 2 GIF frames"); the API picks one that fits.+ delete userInput.size;return;}diff --git a/src/routes/(main)/(create)/image/features/ConfigPanel/components/SizeSelect.tsx b/src/routes/(main)/(create)/image/features/ConfigPanel/components/SizeSelect.tsxindex d16cda18c46..ace07b50235 100644--- a/src/routes/(main)/(create)/image/features/ConfigPanel/components/SizeSelect.tsx+++ b/src/routes/(main)/(create)/image/features/ConfigPanel/components/SizeSelect.tsx@@ -1,11 +1,20 @@+import { Text } from '@lobehub/ui';import { memo } from 'react';+import { useTranslation } from 'react-i18next';+import { useImageStore } from '@/store/image';import { useGenerationConfigParam } from '@/store/image/slices/generationConfig/hooks';+import { imageGenerationConfigSelectors } from '@/store/image/slices/generationConfig/selectors';import Select from './Select';const SizeSelect = memo(() => {+ const { t } = useTranslation('image');+ const isAutomaticSize = useImageStore(imageGenerationConfigSelectors.isAutomaticSize);const { value, setValue, enumValues } = useGenerationConfigParam('size');++ if (isAutomaticSize) return <Text type="secondary">{t('config.size.autoByOpenAI')}</Text>;+const options = enumValues!.map((size) => ({label: size,value: size,diff --git a/src/store/image/slices/createImage/action.test.ts b/src/store/image/slices/createImage/action.test.tsindex 7ee29942244..b516f0150e5 100644--- a/src/store/image/slices/createImage/action.test.ts+++ b/src/store/image/slices/createImage/action.test.ts@@ -83,6 +83,33 @@ describe('CreateImageAction', () => {});describe('createImage', () => {+ it('submits GIF without manual dimensions and restores the static size on PNG output', async () => {+ useImageStore.setState({+ model: 'gpt-image-2.6-flare',+ parameters: { prompt: 'animated fixture', outputFormat: 'png', size: '1536x1024' },+ refreshGenerationBatches: vi.fn().mockResolvedValue(undefined),+ });++ useImageStore.getState().setParamOnInput('outputFormat', 'gif');+ await useImageStore.getState().createImage();++ expect(mockImageService.createImage.mock.lastCall?.[0].params).toEqual({+ prompt: 'animated fixture',+ outputFormat: 'gif',+ });+ expect(useImageStore.getState().parameters.size).toBe('1536x1024');++ useImageStore.getState().setParamOnInput('outputFormat', 'png');+ useImageStore.getState().setParamOnInput('prompt', 'static fixture');+ await useImageStore.getState().createImage();++ expect(mockImageService.createImage.mock.lastCall?.[0].params).toEqual({+ prompt: 'static fixture',+ outputFormat: 'png',+ size: '1536x1024',+ });+ });+it('should create image with existing topic', async () => {const { result } = renderHook(() => useImageStore());const mockRefreshGenerationBatches = vi.fn().mockResolvedValue(undefined);@@ -344,6 +371,56 @@ describe('CreateImageAction', () => {});describe('recreateImage', () => {+ it('keeps a batch with missing configuration without queuing a replacement', async () => {+ const batch = useImageStore.getState().generationBatchesMap['active-topic-id'][0];+ const removeGenerationBatch = vi.fn();+ useImageStore.setState({+ generationBatchesMap: { 'active-topic-id': [{ ...batch, config: undefined }] },+ removeGenerationBatch,+ });++ await expect(useImageStore.getState().recreateImage('batch-id')).rejects.toThrow(+ 'Generation batch configuration is missing',+ );++ expect(mockImageService.createImage).not.toHaveBeenCalled();+ expect(removeGenerationBatch).not.toHaveBeenCalled();+ expect(useImageStore.getState().generationBatchesMap['active-topic-id'][0].id).toBe(+ 'batch-id',+ );+ expect(useImageStore.getState().isCreating).toBe(false);+ });++ it.each(['gif', 'png'])(+ 'preserves the effective size when recreating a saved %s batch',+ async (outputFormat) => {+ const batch = useImageStore.getState().generationBatchesMap['active-topic-id'][0];+ const historicalConfig = {+ prompt: 'historical image fixture',+ outputFormat,+ size: '1024x1024',+ };+ useImageStore.setState({+ generationBatchesMap: {+ 'active-topic-id': [+ { ...batch, model: 'gpt-image-2.6-sunburst', config: historicalConfig },+ ],+ },+ removeGenerationBatch: vi.fn().mockResolvedValue(undefined),+ refreshGenerationBatches: vi.fn().mockResolvedValue(undefined),+ });++ await useImageStore.getState().recreateImage('batch-id');++ expect(mockImageService.createImage.mock.lastCall?.[0].params).toEqual(+ outputFormat === 'gif'+ ? { prompt: historicalConfig.prompt, outputFormat }+ : historicalConfig,+ );+ expect(historicalConfig.size).toBe('1024x1024');+ },+ );+it('should recreate image successfully', async () => {const mockRefreshGenerationBatches = vi.fn().mockResolvedValue(undefined);const mockRemoveGenerationBatch = vi.fn().mockResolvedValue(undefined);diff --git a/src/store/image/slices/createImage/action.ts b/src/store/image/slices/createImage/action.tsindex f2705ac99cd..1f9c86ebaaa 100644--- a/src/store/image/slices/createImage/action.ts+++ b/src/store/image/slices/createImage/action.ts@@ -5,6 +5,7 @@ import { handleLobeHubModelDeprecatedError } from '@/business/client/handleLobeHimport { isGenerationPromptModerationError } from '@/business/client/isGenerationPromptModerationError';import { imageService } from '@/services/image';import { type StoreSetter } from '@/store/types';+import { normalizeImageGenerationParams } from '@/utils/normalizeImageGenerationParams';import { type ImageStore } from '../../store';import { generationBatchSelectors } from '../generationBatch/selectors';@@ -85,7 +86,7 @@ export class CreateImageActionImpl {provider,model,imageNum,- params: parameters as any,+ params: normalizeImageGenerationParams(parameters, model),});// 6. Only refresh generation batches if it's not a new topic@@ -142,6 +143,8 @@ export class CreateImageActionImpl {const imageNum = batch.generations.length;try {+ if (!batch.config) throw new TypeError('Generation batch configuration is missing');+// 1. Create the replacement first: the server can reject the stored config (e.g. a param// the model no longer declares), and the original batch must survive that rejection.await imageService.createImage({@@ -149,7 +152,7 @@ export class CreateImageActionImpl {provider: batch.provider,model: batch.model,imageNum,- params: batch.config as any,+ params: normalizeImageGenerationParams({ ...batch.config }, batch.model),});// 2. Delete the batch being replaced. The replacement is already queued, so a faileddiff --git a/src/store/image/slices/generationConfig/action.test.ts b/src/store/image/slices/generationConfig/action.test.tsindex 6e1da9d2d00..d0883910e89 100644--- a/src/store/image/slices/generationConfig/action.test.ts+++ b/src/store/image/slices/generationConfig/action.test.ts@@ -95,6 +95,19 @@ const testImageModels: AIImageModelCard[] = [];const mockProviders = [+ {+ id: 'openai',+ name: 'OpenAI',+ children: ['gpt-image-2.6-flare', 'gpt-image-2.6-sunburst'].map((id) => ({+ id,+ type: 'image',+ parameters: {+ prompt: { default: '' },+ outputFormat: { default: 'png', enum: ['png', 'gif'] },+ size: { default: '1024x1024', enum: ['1024x1024', '1536x1024'] },+ },+ })),+ },{id: 'fal',name: 'Fal',@@ -363,6 +376,40 @@ describe('GenerationConfigAction', () => {});describe('Settings Reuse', () => {+ it.each(['gpt-image-2.6-flare', 'gpt-image-2.6-sunburst'])(+ 'preserves the static size when reusing an automatic-size GIF batch for %s',+ (model) => {+ useImageStore.setState({+ model,+ provider: 'openai',+ parameters: { prompt: '', outputFormat: 'gif', size: '1536x1024' },+ });++ useImageStore.getState().reuseSettings(model, 'openai', {+ prompt: 'reuse GIF fixture',+ outputFormat: 'gif',+ });+ useImageStore.getState().setParamOnInput('outputFormat', 'png');++ expect(useImageStore.getState().parameters).toEqual({+ prompt: 'reuse GIF fixture',+ outputFormat: 'png',+ size: '1536x1024',+ });+ },+ );++ it('uses target defaults when reusing a GIF batch from a different model', () => {+ useImageStore.setState({ parameters: { prompt: '', size: '1536x1024' } });++ useImageStore.getState().reuseSettings('gpt-image-2.6-flare', 'openai', {+ prompt: 'reuse GIF fixture',+ outputFormat: 'gif',+ });++ expect(useImageStore.getState().parameters.size).toBe('1024x1024');+ });+it('should merge custom settings with model defaults', () => {const { result } = renderHook(() => useImageStore());const customSettings: Partial<RuntimeImageGenParams> = {diff --git a/src/store/image/slices/generationConfig/action.ts b/src/store/image/slices/generationConfig/action.tsindex e9d96164f66..941b8463f4e 100644--- a/src/store/image/slices/generationConfig/action.ts+++ b/src/store/image/slices/generationConfig/action.ts@@ -13,6 +13,7 @@ import { type StoreSetter } from '@/store/types';import { useUserStore } from '@/store/user';import { authSelectors } from '@/store/user/selectors';import { settingsSelectors } from '@/store/user/slices/settings/selectors';+import { isAutomaticGifSize } from '@/utils/normalizeImageGenerationParams';import {normalizeImageInputOnSchemaSwitch,@@ -348,7 +349,17 @@ export class GenerationConfigActionImpl {settings: Partial<RuntimeImageGenParams>,): void => {const { defaultValues, parametersSchema } = getModelAndDefaults(model, provider);- const parameters = preserveReusableSettings(settings, defaultValues, parametersSchema);+ const current = this.#get();+ // A GIF batch has no manual size to reuse. Keep the current static size when staying on+ // the same model, so switching back to PNG restores the user's choice.+ const reusableSettings =+ current.model === model &&+ current.provider === provider &&+ settings.size === undefined &&+ isAutomaticGifSize(model, settings.outputFormat)+ ? { ...settings, size: current.parameters.size }+ : settings;+ const parameters = preserveReusableSettings(reusableSettings, defaultValues, parametersSchema);this.#set(() => ({diff --git a/src/store/image/slices/generationConfig/selectors.test.ts b/src/store/image/slices/generationConfig/selectors.test.tsindex f5831cc9dee..66f78faea42 100644--- a/src/store/image/slices/generationConfig/selectors.test.ts+++ b/src/store/image/slices/generationConfig/selectors.test.ts@@ -228,4 +228,22 @@ describe('imageGenerationConfigSelectors', () => {expect(imageGenerationConfigSelectors.isAnimatedOutput(state)).toBe(false);});});++ it.each([+ ['gpt-image-2.6-flare', 'gif', true],+ ['gpt-image-2.6-sunburst', 'gif', true],+ ['gpt-image-2.6-flare', 'png', false],+ ['custom-gif-model', 'gif', false],+ ])(+ 'uses automatic size only for the supported GPT Image GIF cards (%s, %s)',+ (model, outputFormat, expected) => {+ const state = merge(initialStore, {+ model,+ parameters: { prompt: '', outputFormat },+ parametersSchema: { outputFormat: { default: 'png', enum: ['png', 'gif'] } },+ });++ expect(imageGenerationConfigSelectors.isAutomaticSize(state)).toBe(expected);+ },+ );});diff --git a/src/store/image/slices/generationConfig/selectors.ts b/src/store/image/slices/generationConfig/selectors.tsindex 311a9237178..3382978f513 100644--- a/src/store/image/slices/generationConfig/selectors.ts+++ b/src/store/image/slices/generationConfig/selectors.ts@@ -1,5 +1,7 @@import { type RuntimeImageGenParamsKeys } from 'model-bank';+import { isAutomaticGifSize } from '@/utils/normalizeImageGenerationParams';+import { type GenerationConfigState } from './initialState';export const model = (s: GenerationConfigState) => s.model;@@ -23,11 +25,15 @@ const isSupportedParam = (paramName: RuntimeImageGenParamsKeys) => {const isAnimatedOutput = (s: GenerationConfigState) =>isSupportedParam('outputFormat')(s) && s.parameters?.outputFormat === 'gif';+const isAutomaticSize = (s: GenerationConfigState) =>+ isAnimatedOutput(s) && isAutomaticGifSize(s.model, s.parameters.outputFormat);+export const imageGenerationConfigSelectors = {model,provider,imageNum,isAnimatedOutput,+ isAutomaticSize,isSupportedParam,parameters,parametersSchema,diff --git a/src/utils/normalizeImageGenerationParams.test.ts b/src/utils/normalizeImageGenerationParams.test.tsnew file mode 100644index 00000000000..185669e01b0--- /dev/null+++ b/src/utils/normalizeImageGenerationParams.test.ts@@ -0,0 +1,40 @@+import { describe, expect, it } from 'vitest';++import { normalizeImageGenerationParams } from './normalizeImageGenerationParams';++describe('normalizeImageGenerationParams', () => {+ it('omits the manual size for GIF without mutating the input', () => {+ const params = { outputFormat: 'gif', size: '1024x1024' };++ expect(normalizeImageGenerationParams(params, 'gpt-image-2.6-flare')).toEqual({+ outputFormat: 'gif',+ });+ expect(params).toEqual({ outputFormat: 'gif', size: '1024x1024' });+ });++ it('preserves passthrough GIF sizes for other models', () => {+ const params = { outputFormat: 'gif', size: '768x768' };+ expect(normalizeImageGenerationParams(params, 'custom-gif-model')).toBe(params);+ });++ it('matches the runtime output-format alias precedence for passthrough callers', () => {+ expect(+ normalizeImageGenerationParams(+ { output_format: 'gif', size: '1024x1024' },+ 'gpt-image-2.6-flare',+ ),+ ).toEqual({+ output_format: 'gif',+ });+ const params = { outputFormat: 'png', output_format: 'gif', size: '1536x1024' };+ expect(normalizeImageGenerationParams(params, 'gpt-image-2.6-flare')).toBe(params);+ });++ it.each(['png', 'jpeg', 'webp', undefined])(+ 'preserves static image dimensions for %s',+ (outputFormat) => {+ const params = { outputFormat, size: '1536x1024', width: 1536, height: 1024 };+ expect(normalizeImageGenerationParams(params, 'gpt-image-2.6-flare')).toBe(params);+ },+ );+});diff --git a/src/utils/normalizeImageGenerationParams.ts b/src/utils/normalizeImageGenerationParams.tsnew file mode 100644index 00000000000..5329792cb2c--- /dev/null+++ b/src/utils/normalizeImageGenerationParams.ts@@ -0,0 +1,15 @@+export const isAutomaticGifSize = (model: string, outputFormat: unknown) =>+ outputFormat === 'gif' && (model === 'gpt-image-2.6-flare' || model === 'gpt-image-2.6-sunburst');++/** Leave GIF dimensions to the API without changing the user's static-image preferences. */+export const normalizeImageGenerationParams = <T extends Record<string, unknown>>(+ params: T,+ model: string,+): T => {+ const outputFormat = 'outputFormat' in params ? params.outputFormat : params.output_format;+ if (!isAutomaticGifSize(model, outputFormat)) return params;++ const normalized = { ...params };+ delete normalized.size;+ return normalized;+};