kingkont 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/providers.js +21 -2
  2. package/package.json +1 -1
package/lib/providers.js CHANGED
@@ -86,6 +86,11 @@ const CHATIUM_IMAGE_MODELS = {
86
86
  'grok': 'grok-imagine/text-to-image',
87
87
  'grok-i2i': 'grok-imagine/image-to-image',
88
88
  'seedream-5-lite': 'bytedance/seedream-5-lite',
89
+ // OpenAI gpt-image-2 — Chatium proxy поддерживает (проверено через
90
+ // probe). image-to-image вариант под отдельным slug, переключаем
91
+ // в startGeneration при наличии imageInputs.
92
+ // (gpt-image/1.5 НЕ доступен через Chatium — только KIE.)
93
+ 'gpt-image-2': 'gpt-image-2-text-to-image',
89
94
  };
90
95
  const CHATIUM_VIDEO_MODELS = {
91
96
  'seedance-2': 'bytedance/seedance-2',
@@ -304,7 +309,15 @@ async function startGeneration(args) {
304
309
  const kieAvailable = s.useKie && process.env.KIE_API_KEY;
305
310
  const kieSupportsModel = !!kieMap[kieKey];
306
311
 
307
- if (kieAvailable && kieSupportsModel) {
312
+ // gpt-image-2 — приоритет Chatium (биллинг через kingkont credits,
313
+ // юзеру одна точка оплаты). KIE — fallback если Chatium недоступен
314
+ // или не поддерживает модель (например gpt-image-1.5).
315
+ const chatiumAvailable = s.useChatium && s.chatium?.token && s.chatium?.base;
316
+ const chatiumMap = kind === 'video' ? CHATIUM_VIDEO_MODELS : CHATIUM_IMAGE_MODELS;
317
+ const isGptImage = kind === 'image' && (kieKey === 'gpt-image-2' || kieKey === 'gpt-image-1.5');
318
+ if (isGptImage && chatiumAvailable && chatiumMap[kieKey]) {
319
+ // → Chatium-путь ниже (skip KIE).
320
+ } else if (kieAvailable && kieSupportsModel) {
308
321
  return await _startGenerationViaKie({ kind, prompt, key: kieKey, imageInputs, videoInputs, aspectRatio, resolution, duration, quality });
309
322
  }
310
323
 
@@ -324,8 +337,14 @@ async function startGeneration(args) {
324
337
  body = { prompt, model: fullModel, imageInputs, videoInputs, firstFrame, lastFrame, aspectRatio, resolution, duration };
325
338
  } else {
326
339
  const isSeedream = fullModel.includes('seedream');
340
+ const isGptImage = fullModel.startsWith('gpt-image');
341
+ // gpt-image-2 — auto-switch на image-to-image вариант если есть refs.
342
+ let actualModel = fullModel;
343
+ if (isGptImage && imageInputs?.length) {
344
+ actualModel = 'gpt-image-2-image-to-image';
345
+ }
327
346
  body = {
328
- prompt, model: fullModel, aspectRatio, resolution,
347
+ prompt, model: actualModel, aspectRatio, resolution,
329
348
  outputFormat: isSeedream ? 'jpeg' : 'jpg',
330
349
  };
331
350
  if (quality) body.quality = quality; // 'low' | 'medium' | 'high' — модель сама решит как мапить
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kingkont",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "KingKont · Chatium — нод-редактор сцен с AI-генерацией (картинки/видео/голос/SFX/музыка/текст)",
5
5
  "main": "main.js",
6
6
  "bin": {