egaki 0.3.0 → 0.4.0

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.
@@ -506,9 +506,24 @@ export const CATALOG: ModelEntry[] = [
506
506
  multipleImages: true,
507
507
  },
508
508
  },
509
- // NOTE: chatgpt-image-latest exists in OpenAI's .d.ts types but it's a moving
510
- // alias used by ChatGPT/Responses API, not a stable image endpoint model.
511
- // Omitted until OpenAI stabilizes it as a first-class image generation target.
509
+ {
510
+ id: 'chatgpt-image-latest',
511
+ name: 'ChatGPT Image',
512
+ description:
513
+ 'Rolling-latest alias that tracks the newest ChatGPT image model. Currently points ' +
514
+ 'to gpt-image-1.5. Pricing may shift when the alias retargets to a newer model.',
515
+ released: '2026-01',
516
+ ...openaiImage,
517
+ cost: { type: 'per-image', perImage: 0.034 },
518
+ features: {
519
+ editing: true,
520
+ inpainting: true,
521
+ aspectRatios: [],
522
+ sizes: ['1024x1024', '1536x1024', '1024x1536'],
523
+ seed: false,
524
+ multipleImages: true,
525
+ },
526
+ },
512
527
 
513
528
  // ── Replicate ──────────────────────────────────────────────────────────
514
529
  {
package/src/models.ts CHANGED
@@ -17,7 +17,7 @@
17
17
  // dist/index.d.ts and add entries here.
18
18
  import type { ImageModel, LanguageModel } from 'ai'
19
19
  import pc from 'picocolors'
20
- import { PROVIDERS, EGAKI_GATEWAY_URL } from './credentials.js'
20
+ import { PROVIDERS, EGAKI_GATEWAY_URL, shouldUseChatGptBackend } from './credentials.js'
21
21
  import { CATALOG, findModel } from './model-catalog.js'
22
22
  import type { ModelEntry } from './model-catalog.js'
23
23
  import { VIDEO_CATALOG, findVideoModel } from './video-model-catalog.js'
@@ -169,6 +169,16 @@ async function createGatewayVideoModel(modelId: string, provider: string) {
169
169
  return gateway.video(gatewayModelId)
170
170
  }
171
171
 
172
+ /**
173
+ * ChatGPT OAuth image generation goes through the Codex backend instead of the
174
+ * OpenAI Image API, so OpenAI image models need the custom responses path.
175
+ */
176
+ export function shouldUseResponsesApi(modelId: string): boolean {
177
+ const config = findModel(modelId)
178
+ if (!config) return false
179
+ return config.provider === 'openai' && config.strategy === 'image' && shouldUseChatGptBackend()
180
+ }
181
+
172
182
  // Lazily import the provider and create the right model instance.
173
183
  // This avoids loading all provider SDKs upfront — only the one needed
174
184
  // for the selected model gets imported.