egaki 0.3.0 → 0.4.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.
- package/CHANGELOG.md +51 -0
- package/README.md +15 -0
- package/dist/chatgpt-auth.d.ts +25 -0
- package/dist/chatgpt-auth.d.ts.map +1 -0
- package/dist/chatgpt-auth.js +18 -11
- package/dist/cli.js +234 -15
- package/dist/credentials.d.ts +17 -4
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +50 -10
- package/dist/login.d.ts +1 -1
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +44 -3
- package/dist/model-catalog.d.ts.map +1 -1
- package/dist/model-catalog.js +36 -3
- package/dist/models.d.ts +5 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +11 -1
- package/package.json +3 -2
- package/src/chatgpt-auth.ts +387 -0
- package/src/cli.ts +304 -18
- package/src/credentials.ts +70 -17
- package/src/login.ts +49 -4
- package/src/model-catalog.ts +38 -3
- package/src/models.ts +11 -1
package/src/model-catalog.ts
CHANGED
|
@@ -506,9 +506,44 @@ export const CATALOG: ModelEntry[] = [
|
|
|
506
506
|
multipleImages: true,
|
|
507
507
|
},
|
|
508
508
|
},
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
509
|
+
{
|
|
510
|
+
id: 'gpt-image-2',
|
|
511
|
+
name: 'GPT Image 2',
|
|
512
|
+
description:
|
|
513
|
+
'State-of-the-art image generation model with token-based pricing. ' +
|
|
514
|
+
'Cost varies by quality and size; $0.053 is the medium-quality 1024×1024 estimate.',
|
|
515
|
+
released: '2026-04-21',
|
|
516
|
+
...openaiImage,
|
|
517
|
+
// Token-based pricing: $30/1M output image tokens. Medium quality 1024×1024 ≈ $0.053.
|
|
518
|
+
cost: { type: 'per-image', perImage: 0.053 },
|
|
519
|
+
features: {
|
|
520
|
+
editing: true,
|
|
521
|
+
inpainting: true,
|
|
522
|
+
aspectRatios: [],
|
|
523
|
+
sizes: ['1024x1024', '1536x1024', '1024x1536'],
|
|
524
|
+
seed: false,
|
|
525
|
+
multipleImages: true,
|
|
526
|
+
},
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
id: 'chatgpt-image-latest',
|
|
530
|
+
name: 'ChatGPT Image',
|
|
531
|
+
description:
|
|
532
|
+
'Rolling-latest alias that tracks the newest ChatGPT image model. Currently points ' +
|
|
533
|
+
'to gpt-image-2. Pricing may shift when the alias retargets to a newer model.',
|
|
534
|
+
released: '2026-01',
|
|
535
|
+
...openaiImage,
|
|
536
|
+
// Matches gpt-image-2 medium quality 1024×1024 estimate.
|
|
537
|
+
cost: { type: 'per-image', perImage: 0.053 },
|
|
538
|
+
features: {
|
|
539
|
+
editing: true,
|
|
540
|
+
inpainting: true,
|
|
541
|
+
aspectRatios: [],
|
|
542
|
+
sizes: ['1024x1024', '1536x1024', '1024x1536'],
|
|
543
|
+
seed: false,
|
|
544
|
+
multipleImages: true,
|
|
545
|
+
},
|
|
546
|
+
},
|
|
512
547
|
|
|
513
548
|
// ── Replicate ──────────────────────────────────────────────────────────
|
|
514
549
|
{
|
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.
|