@loonylabs/tti-middleware 1.6.0 → 1.7.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.
@@ -8,6 +8,7 @@
8
8
  * - Imagen 4 Ultra (imagen-4.0-ultra-generate-001) - Highest quality variant
9
9
  * - Gemini 2.5 Flash Image - Text-to-image with character consistency
10
10
  * - Gemini 3 Pro Image (gemini-3-pro-image-preview) - 4K, text rendering
11
+ * - Gemini 3.1 Flash Image (gemini-3.1-flash-image-preview) - 4K, improved text rendering (global endpoint)
11
12
  *
12
13
  * All requests go through Google Cloud (Vertex AI) with proper DPA.
13
14
  * EU-compliant when using EU regions.
@@ -9,6 +9,7 @@
9
9
  * - Imagen 4 Ultra (imagen-4.0-ultra-generate-001) - Highest quality variant
10
10
  * - Gemini 2.5 Flash Image - Text-to-image with character consistency
11
11
  * - Gemini 3 Pro Image (gemini-3-pro-image-preview) - 4K, text rendering
12
+ * - Gemini 3.1 Flash Image (gemini-3.1-flash-image-preview) - 4K, improved text rendering (global endpoint)
12
13
  *
13
14
  * All requests go through Google Cloud (Vertex AI) with proper DPA.
14
15
  * EU-compliant when using EU regions.
@@ -163,6 +164,20 @@ const GOOGLE_CLOUD_MODELS = [
163
164
  availableRegions: ['global'],
164
165
  pricingUrl: 'https://cloud.google.com/vertex-ai/generative-ai/pricing',
165
166
  },
167
+ {
168
+ id: 'gemini-flash-image-2',
169
+ displayName: 'Gemini 3.1 Flash Image',
170
+ capabilities: {
171
+ textToImage: true,
172
+ characterConsistency: true, // Up to 5 characters + 14 objects
173
+ imageEditing: false,
174
+ maxImagesPerRequest: 1,
175
+ },
176
+ // Preview model — requires global endpoint (same as gemini-pro-image).
177
+ // Will likely get regional endpoints once GA.
178
+ availableRegions: ['global'],
179
+ pricingUrl: 'https://cloud.google.com/vertex-ai/generative-ai/pricing',
180
+ },
166
181
  ];
167
182
  // Internal model IDs used in Vertex AI API calls
168
183
  const MODEL_ID_MAP = {
@@ -172,9 +187,10 @@ const MODEL_ID_MAP = {
172
187
  'imagen-4-ultra': 'imagen-4.0-ultra-generate-001',
173
188
  'gemini-flash-image': 'gemini-2.5-flash-image',
174
189
  'gemini-pro-image': 'gemini-3-pro-image-preview',
190
+ 'gemini-flash-image-2': 'gemini-3.1-flash-image-preview',
175
191
  };
176
192
  // Models that use the Gemini generateContent API (vs Imagen predict API)
177
- const GEMINI_API_MODELS = new Set(['gemini-flash-image', 'gemini-pro-image']);
193
+ const GEMINI_API_MODELS = new Set(['gemini-flash-image', 'gemini-pro-image', 'gemini-flash-image-2']);
178
194
  // ============================================================
179
195
  // PROVIDER IMPLEMENTATION
180
196
  // ============================================================
@@ -553,11 +569,17 @@ class GoogleCloudTTIProvider extends base_tti_provider_1.BaseTTIProvider {
553
569
  const config = {
554
570
  responseModalities: ['TEXT', 'IMAGE'],
555
571
  };
556
- // Add imageConfig with aspectRatio if provided
557
- if (request.aspectRatio) {
558
- config.imageConfig = {
559
- aspectRatio: request.aspectRatio,
560
- };
572
+ // Add imageConfig with aspectRatio and/or imageSize if provided
573
+ if (request.aspectRatio || request.providerOptions?.imageSize) {
574
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
575
+ const imageConfig = {};
576
+ if (request.aspectRatio) {
577
+ imageConfig.aspectRatio = request.aspectRatio;
578
+ }
579
+ if (request.providerOptions?.imageSize) {
580
+ imageConfig.imageSize = request.providerOptions.imageSize;
581
+ }
582
+ config.imageConfig = imageConfig;
561
583
  }
562
584
  // Add temperature if provided
563
585
  if (request.providerOptions?.temperature !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loonylabs/tti-middleware",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Provider-agnostic Text-to-Image middleware with GDPR compliance. Supports Google Cloud (Imagen, Gemini), Eden AI, and IONOS.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",