Skip to content

Formerly KrillinAI, VideoTranslation and Dubbing Tool for 120+ Languages. Open-source AI workspace for creators, powered by Codex. Video downloader, video translation, create videos, images, audios, and edits with Agents in one place. For your Social Media like YouTube, TikTok, Instagram, etc.

Merge origin/master into master

Leggett54417a82c97b
diff --cc apps/daemon/src/gateway/model-access.ts
index a4dd9e84,0f887b1c..b0ea5722
--- a/apps/daemon/src/gateway/model-access.ts
+++ b/apps/daemon/src/gateway/model-access.ts
@@@ -44,9 -43,10 +44,10 @@@ export function modelAccessGroup(model
export function officialModelPolicy(models: GatewayModel[]) {
// Account catalog availability does not override OpenCreator's adapter compatibility.
- return models.filter(model => model.catalogSchema === 2 || (model.vendor?.toLowerCase() !== 'anthropic' && !/^claude-/i.test(model.id) && modelAccessGroup(model) !== 'anthropic'
- return models.filter(model => model.vendor?.toLowerCase() !== 'anthropic' && !/^claude-/i.test(model.id) && modelAccessGroup(model) !== 'anthropic'
++ return models.filter(model => !(model.modality === 'image' && isRetiredOpenAiImageModel(model.id))
++ && (model.catalogSchema === 2 || (model.vendor?.toLowerCase() !== 'anthropic' && !/^claude-/i.test(model.id) && modelAccessGroup(model) !== 'anthropic'
&& !model.id.endsWith(':batch')
- && !(model.modality === 'text' && modelAccessGroup(model) === 'openrouter')));
- && !(model.modality === 'image' && isRetiredOpenAiImageModel(model.id))
- && !(model.modality === 'text' && modelAccessGroup(model) === 'openrouter'));
++ && !(model.modality === 'text' && modelAccessGroup(model) === 'openrouter'))));
}
export function withModelCatalog(bootstrap: GatewayBootstrap, models: GatewayModel[]): GatewayBootstrap {
diff --cc apps/daemon/src/gateway/model-preferences.ts
index 889fcba0,73cb90b1..618e1ff8
--- a/apps/daemon/src/gateway/model-preferences.ts
+++ b/apps/daemon/src/gateway/model-preferences.ts
@@@ -1,5 -1,4 +1,5 @@@
+import { gatewayModelIdMatches } from '@opencreator/protocol';
- import { gatewayModelCompatible, gatewayModelReady, gatewayModelSupports, type GatewayModel, type GatewayModelPurpose } from '@opencreator/protocol';
+ import { gatewayModelCompatible, gatewayModelReady, gatewayModelSupports, migrateOpenAiImageModel, type GatewayModel, type GatewayModelPurpose } from '@opencreator/protocol';
export const modelModalities: GatewayModelPurpose[] = ['text', 'image', 'video', 'speech', 'transcription'];
const historicalDefaults: Record<string, string[]> = {
@@@ -28,9 -27,10 +28,10 @@@ export function resolveModelPreferences
let changed = false;
for (const modality of modelModalities) {
const candidates = compatible.filter(model => gatewayModelSupports(model, modality) && gatewayModelReady(model));
- const automatic = candidates.find(model => model.id === defaults[modality]) ?? candidates.find(model => model.recommended);
+ const defaultId = modality === 'image' ? migrateOpenAiImageModel(defaults[modality] ?? '') : defaults[modality];
+ const automatic = candidates.find(model => model.id === defaultId) ?? candidates.find(model => model.recommended);
if (automatic) recommended[modality] = automatic.id;
- const chosen = compatible.find(model => model.modality === modality && model.id === manual[modality] && model.status !== 'retired');
+ const chosen = compatible.find(model => model.modality === modality && gatewayModelIdMatches(model.id, manual[modality]) && model.status !== 'retired');
if (chosen) {
retained[modality] = chosen.id; selected[modality] = chosen.id; modes[modality] = 'manual';
} else {
diff --cc apps/daemon/src/image-generation/provider.ts
index dc7a8d09,e4929a67..f6c54a85
--- a/apps/daemon/src/image-generation/provider.ts
+++ b/apps/daemon/src/image-generation/provider.ts
@@@ -222,12 -222,10 +222,13 @@@ async function generateOpenAiImages
const provider = providerOverride
?? (request.provider === 'jimeng' ? config.image.jimeng : config.image.openai);
if (!provider.apiKey.trim()) missingConfig(request.provider);
- const model = provider.model.trim()
- || (request.provider === 'jimeng' ? 'doubao-seedream-4-0-250828' : 'gpt-image-1');
+ const configuredModel = provider.model.trim()
+ || (request.provider === 'jimeng' ? 'doubao-seedream-4-0-250828' : 'gpt-image-2');
+ const model = !official && request.provider !== 'jimeng' ? migrateOpenAiImageModel(configuredModel) : configuredModel;
+ const binding = gatewayCreatorBinding(config);
+ const canonical = official && binding?.catalog?.some(item => item.id === model && item.catalogSchema === 2);
const parameters = official ? undefined : manualImageParameters(request, request.provider === 'codex-native' ? 'openai' : request.provider, model);
+ const size = canonical ? undefined : parameters?.size ?? request.size;
const endpoint = openAiImageEndpoint(
provider.baseUrl,
referenceImages.length === 0 ? 'generations' : 'edits'
diff --cc apps/daemon/test/unit/gateway-model-access.test.ts
index 834c2d8f,ea971c00..acad6f34
--- a/apps/daemon/test/unit/gateway-model-access.test.ts
+++ b/apps/daemon/test/unit/gateway-model-access.test.ts
@@@ -44,6 -44,11 +44,11 @@@ async function fixture(models: GatewayM
setCatalogIDs(ids: string[]) { catalogIDs = ids; }, setCatalogReply(reply: typeof catalogReply) { catalogReply = reply; } };
}
-it('excludes retired image models even when the supplier advertises them', () => {
- const models: GatewayModel[] = ['gpt-image-1', 'openai/gpt-image-1', 'gpt-image-2'].map(id => ({ id, modality: 'image', capabilities: ['generate'] }));
++it.each([undefined, 2])('excludes retired image models even when catalog schema %s advertises them', catalogSchema => {
++ const models: GatewayModel[] = ['gpt-image-1', 'openai/gpt-image-1', 'gpt-image-2'].map(id => ({ id, catalogSchema, modality: 'image', capabilities: ['generate'] }));
+ expect(officialModelPolicy(models).map(model => model.id)).toEqual(['gpt-image-2']);
+ });
+
it('retains unsupported Anthropic, router and batch filtering', () => {
expect(modelAccessGroup(text('~openai/gpt-6-sol'))).toBe('openai');
expect(modelAccessGroup(text('openai/gpt-oss-20b'))).toBe('openai-oss');
diff --cc packages/protocol/src/gateway-account.ts
index 4055abff,6a81a4b8..3cff0089
--- a/packages/protocol/src/gateway-account.ts
+++ b/packages/protocol/src/gateway-account.ts
@@@ -80,22 -49,15 +82,25 @@@ export function gatewayModelSupports(mo
return model.modality === purpose && (purpose !== 'text' || model.capabilities.includes('responses'));
}
export function gatewayModelCompatible(model: GatewayModel): boolean {
+ if (model.modality === 'image' && isRetiredOpenAiImageModel(model.id)) return false;
+ if (model.catalogSchema === 2) return model.modality !== 'text' || model.capabilities.includes('responses') || model.capabilities.includes('chat');
if (model.vendor?.toLowerCase() === 'anthropic' || /^(?:anthropic\/|claude-)/i.test(model.id)) return false;
if (model.modality === 'text') return model.capabilities.includes('responses') && model.capabilities.includes('chat');
if (model.modality === 'transcription') return model.capabilities.includes('subtitle_timestamps');
return true;
}
- export function gatewayModelReady(model: GatewayModel): boolean { return !model.status || model.status === 'ready'; }
+ export function gatewayModelReady(model: GatewayModel): boolean {
+ return !(model.modality === 'image' && isRetiredOpenAiImageModel(model.id)) && (!model.status || model.status === 'ready');
+ }
+
+/** Translation uses Flash independently of the Agent's default text model. */
+export function gatewayTranslationFlashModel(models: readonly GatewayModel[]): GatewayModel | undefined {
+ const candidates = models.filter(model => model.modality === 'text' && gatewayModelReady(model)
+ && model.capabilities.includes('chat')
+ && /^(?:[^/]+\/)?deepseek-(?:flash|v4(?:[.-][0-9]+)*-flash)(?:-[0-9]+)?$/i.test((model.name || model.id).trim()));
+ return candidates.find(model => model.recommended) ?? candidates[0];
+}
+
export type GatewayConnectionDiagnostics = {
path: string;
reason: 'timeout' | 'network' | 'http' | 'invalid_response';
diff --cc packages/protocol/src/image-model-options.test.ts
index 00000000,2188eead..4c099abe
mode 000000,100644..100644
--- a/packages/protocol/src/image-model-options.test.ts
+++ b/packages/protocol/src/image-model-options.test.ts
@@@ -1,0 -1,22 +1,24 @@@
+ import { expect, it } from 'vitest';
+ import { gatewayModelCompatible, gatewayModelReady, type GatewayModel } from './gateway-account.js';
+ import { imageModelOptions, migrateOpenAiImageModel } from './image-model-options.js';
+
+ it.each(['gpt-image-1', 'gpt-image-1-mini', 'gpt-image-1-2025-04-15', 'openai/gpt-image-1', '88api/gpt-image-1', ' GPT-IMAGE-1 '])(
+ 'retires %s from manual controls and official model selection', id => {
+ expect(imageModelOptions('openai', id)).toEqual({});
- const model: GatewayModel = { id, modality: 'image', capabilities: ['generate'], status: 'ready' };
- expect(gatewayModelCompatible(model)).toBe(false);
- expect(gatewayModelReady(model)).toBe(false);
++ for (const catalogSchema of [undefined, 2]) {
++ const model: GatewayModel = { id, catalogSchema, modality: 'image', capabilities: ['generate'], status: 'ready' };
++ expect(gatewayModelCompatible(model)).toBe(false);
++ expect(gatewayModelReady(model)).toBe(false);
++ }
+ expect(migrateOpenAiImageModel(id)).toBe(id.includes('/') ? `${id.split('/')[0]}/gpt-image-2` : 'gpt-image-2');
+ }
+ );
+
+ it.each(['gpt-image-2', 'gpt-image-1.5', 'custom-image', 'chatgpt-image-latest'])(
+ 'preserves the independently configured model %s', id => {
+ expect(migrateOpenAiImageModel(id)).toBe(id);
+ const model: GatewayModel = { id, modality: 'image', capabilities: ['generate'] };
+ expect(gatewayModelCompatible(model)).toBe(true);
+ expect(gatewayModelReady(model)).toBe(true);
+ }
+ );