@blinkdotnew/sdk 0.17.1 → 0.17.3
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/README.md +8 -26
- package/dist/index.d.mts +33 -33
- package/dist/index.d.ts +33 -33
- package/dist/index.js +100 -100
- package/dist/index.mjs +100 -100
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -279,13 +279,15 @@ const { text } = await blink.ai.generateText({
|
|
|
279
279
|
})
|
|
280
280
|
|
|
281
281
|
// Text generation with image content
|
|
282
|
+
// ⚠️ IMPORTANT: Images must be HTTPS URLs with file extensions (.jpg, .jpeg, .png, .gif, .webp)
|
|
283
|
+
// For file uploads, use blink.storage.upload() first to get public HTTPS URLs
|
|
282
284
|
const { text } = await blink.ai.generateText({
|
|
283
285
|
messages: [
|
|
284
286
|
{
|
|
285
287
|
role: "user",
|
|
286
288
|
content: [
|
|
287
289
|
{ type: "text", text: "What do you see in this image?" },
|
|
288
|
-
{ type: "image", image: "https://
|
|
290
|
+
{ type: "image", image: "https://storage.googleapis.com/.../.../photo.jpg" }
|
|
289
291
|
]
|
|
290
292
|
}
|
|
291
293
|
]
|
|
@@ -298,8 +300,8 @@ const { text } = await blink.ai.generateText({
|
|
|
298
300
|
role: "user",
|
|
299
301
|
content: [
|
|
300
302
|
{ type: "text", text: "Compare these two images:" },
|
|
301
|
-
{ type: "image", image: "https://
|
|
302
|
-
{ type: "image", image: "https://example.com/image2.
|
|
303
|
+
{ type: "image", image: "https://storage.googleapis.com/.../.../image1.jpg" },
|
|
304
|
+
{ type: "image", image: "https://cdn.example.com/image2.png" }
|
|
303
305
|
]
|
|
304
306
|
}
|
|
305
307
|
]
|
|
@@ -359,7 +361,7 @@ const { object: todoList } = await blink.ai.generateObject({
|
|
|
359
361
|
const { data } = await blink.ai.generateImage({
|
|
360
362
|
prompt: 'A serene landscape with mountains and a lake at sunset',
|
|
361
363
|
size: '1024x1024',
|
|
362
|
-
quality: '
|
|
364
|
+
quality: 'high',
|
|
363
365
|
n: 2
|
|
364
366
|
})
|
|
365
367
|
console.log('Image URL:', data[0].url)
|
|
@@ -368,10 +370,10 @@ console.log('Image URL:', data[0].url)
|
|
|
368
370
|
const { data: headshots } = await blink.ai.modifyImage({
|
|
369
371
|
images: ['https://storage.example.com/user-photo.jpg'], // ... up to 16 images maximum!
|
|
370
372
|
prompt: 'Generate professional business headshot with studio lighting for this person.',
|
|
371
|
-
quality: '
|
|
373
|
+
quality: 'high',
|
|
372
374
|
n: 4
|
|
373
375
|
})
|
|
374
|
-
// Options: size ('1024x1024', '1536x1024'), quality ('
|
|
376
|
+
// Options: size ('1024x1024', '1536x1024'), quality ('auto'|'low'|'medium'|'high'),
|
|
375
377
|
// background ('auto'|'transparent'|'opaque'), n (1-10 images)
|
|
376
378
|
|
|
377
379
|
|
|
@@ -1192,26 +1194,6 @@ try {
|
|
|
1192
1194
|
console.error('Auth error:', error.message)
|
|
1193
1195
|
}
|
|
1194
1196
|
}
|
|
1195
|
-
|
|
1196
|
-
// Image validation error handling
|
|
1197
|
-
try {
|
|
1198
|
-
const { text } = await blink.ai.generateText({
|
|
1199
|
-
messages: [
|
|
1200
|
-
{
|
|
1201
|
-
role: "user",
|
|
1202
|
-
content: [
|
|
1203
|
-
{ type: "text", text: "What's in this image?" },
|
|
1204
|
-
{ type: "image", image: "http://example.com/image.jpg" } // Invalid: not HTTPS
|
|
1205
|
-
]
|
|
1206
|
-
}
|
|
1207
|
-
]
|
|
1208
|
-
})
|
|
1209
|
-
} catch (error) {
|
|
1210
|
-
if (error instanceof BlinkAIError) {
|
|
1211
|
-
console.error('AI validation error:', error.message)
|
|
1212
|
-
// Example: "Message validation failed: Image URLs must use HTTPS protocol"
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
1197
|
```
|
|
1216
1198
|
|
|
1217
1199
|
### Custom Configuration
|
package/dist/index.d.mts
CHANGED
|
@@ -222,7 +222,7 @@ interface ImageGenerationRequest {
|
|
|
222
222
|
prompt: string;
|
|
223
223
|
images?: string[];
|
|
224
224
|
size?: string;
|
|
225
|
-
quality?: '
|
|
225
|
+
quality?: 'auto' | 'low' | 'medium' | 'high';
|
|
226
226
|
background?: 'auto' | 'transparent' | 'opaque';
|
|
227
227
|
n?: number;
|
|
228
228
|
response_format?: 'url' | 'b64_json';
|
|
@@ -291,7 +291,7 @@ interface BlinkAI {
|
|
|
291
291
|
images: string[];
|
|
292
292
|
prompt: string;
|
|
293
293
|
size?: string;
|
|
294
|
-
quality?: "
|
|
294
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
295
295
|
n?: number;
|
|
296
296
|
background?: "auto" | "transparent" | "opaque";
|
|
297
297
|
signal?: AbortSignal;
|
|
@@ -686,7 +686,7 @@ declare class HttpClient {
|
|
|
686
686
|
model?: string;
|
|
687
687
|
images?: string[];
|
|
688
688
|
size?: string;
|
|
689
|
-
quality?: '
|
|
689
|
+
quality?: 'auto' | 'low' | 'medium' | 'high';
|
|
690
690
|
background?: 'auto' | 'transparent' | 'opaque';
|
|
691
691
|
n?: number;
|
|
692
692
|
response_format?: 'url' | 'b64_json';
|
|
@@ -1452,7 +1452,7 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1452
1452
|
* @param options - Object containing:
|
|
1453
1453
|
* - `prompt`: Text description of the desired image (required)
|
|
1454
1454
|
* - `size`: Image dimensions (default: "1024x1024")
|
|
1455
|
-
* - `quality`: Image quality ("
|
|
1455
|
+
* - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
|
|
1456
1456
|
* - `n`: Number of images to generate (default: 1)
|
|
1457
1457
|
* - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
|
|
1458
1458
|
* - Plus optional signal parameter
|
|
@@ -1465,21 +1465,21 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1465
1465
|
* });
|
|
1466
1466
|
* console.log("Image URL:", data[0].url);
|
|
1467
1467
|
*
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1468
|
+
* // High-quality image with specific size
|
|
1469
|
+
* const { data } = await blink.ai.generateImage({
|
|
1470
|
+
* prompt: "A futuristic city skyline with flying cars",
|
|
1471
|
+
* size: "1536x1024",
|
|
1472
|
+
* quality: "high",
|
|
1473
|
+
* background: "transparent"
|
|
1474
|
+
* });
|
|
1475
1475
|
*
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1476
|
+
* // Multiple images
|
|
1477
|
+
* const { data } = await blink.ai.generateImage({
|
|
1478
|
+
* prompt: "A cute robot mascot for a tech company",
|
|
1479
|
+
* n: 3,
|
|
1480
|
+
* size: "1024x1024",
|
|
1481
|
+
* quality: "high"
|
|
1482
|
+
* });
|
|
1483
1483
|
* data.forEach((img, i) => console.log(`Image ${i+1}:`, img.url));
|
|
1484
1484
|
* ```
|
|
1485
1485
|
*
|
|
@@ -1491,7 +1491,7 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1491
1491
|
generateImage(options: {
|
|
1492
1492
|
prompt: string;
|
|
1493
1493
|
size?: string;
|
|
1494
|
-
quality?: "
|
|
1494
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
1495
1495
|
n?: number;
|
|
1496
1496
|
background?: "auto" | "transparent" | "opaque";
|
|
1497
1497
|
signal?: AbortSignal;
|
|
@@ -1503,7 +1503,7 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1503
1503
|
* - `images`: Array of public image URLs to modify (required, up to 16 images)
|
|
1504
1504
|
* - `prompt`: Text description of desired modifications (required)
|
|
1505
1505
|
* - `size`: Output image dimensions (default: "auto")
|
|
1506
|
-
* - `quality`: Image quality ("
|
|
1506
|
+
* - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
|
|
1507
1507
|
* - `n`: Number of output images to generate (default: 1)
|
|
1508
1508
|
* - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
|
|
1509
1509
|
* - Plus optional signal parameter
|
|
@@ -1516,19 +1516,19 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1516
1516
|
* "https://storage.example.com/user-photo-1.jpg",
|
|
1517
1517
|
* "https://storage.example.com/user-photo-2.jpg"
|
|
1518
1518
|
* ],
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1519
|
+
* prompt: "Transform into professional business headshots with studio lighting",
|
|
1520
|
+
* quality: "high",
|
|
1521
|
+
* n: 4
|
|
1522
1522
|
* });
|
|
1523
1523
|
* data.forEach((img, i) => console.log(`Headshot ${i+1}:`, img.url));
|
|
1524
1524
|
*
|
|
1525
1525
|
* // Artistic style transformation
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1526
|
+
* const { data } = await blink.ai.modifyImage({
|
|
1527
|
+
* images: ["https://storage.example.com/portrait.jpg"],
|
|
1528
|
+
* prompt: "Transform into oil painting style with dramatic lighting",
|
|
1529
|
+
* quality: "high",
|
|
1530
|
+
* size: "1024x1024"
|
|
1531
|
+
* });
|
|
1532
1532
|
*
|
|
1533
1533
|
* // Background replacement
|
|
1534
1534
|
* const { data } = await blink.ai.modifyImage({
|
|
@@ -1545,9 +1545,9 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1545
1545
|
* "https://storage.example.com/photo3.jpg"
|
|
1546
1546
|
* ];
|
|
1547
1547
|
* const { data } = await blink.ai.modifyImage({
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1548
|
+
* images: userPhotos,
|
|
1549
|
+
* prompt: "Convert to black and white vintage style photographs",
|
|
1550
|
+
* quality: "high"
|
|
1551
1551
|
* });
|
|
1552
1552
|
* ```
|
|
1553
1553
|
*
|
|
@@ -1560,7 +1560,7 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1560
1560
|
images: string[];
|
|
1561
1561
|
prompt: string;
|
|
1562
1562
|
size?: string;
|
|
1563
|
-
quality?: "
|
|
1563
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
1564
1564
|
n?: number;
|
|
1565
1565
|
background?: "auto" | "transparent" | "opaque";
|
|
1566
1566
|
signal?: AbortSignal;
|
package/dist/index.d.ts
CHANGED
|
@@ -222,7 +222,7 @@ interface ImageGenerationRequest {
|
|
|
222
222
|
prompt: string;
|
|
223
223
|
images?: string[];
|
|
224
224
|
size?: string;
|
|
225
|
-
quality?: '
|
|
225
|
+
quality?: 'auto' | 'low' | 'medium' | 'high';
|
|
226
226
|
background?: 'auto' | 'transparent' | 'opaque';
|
|
227
227
|
n?: number;
|
|
228
228
|
response_format?: 'url' | 'b64_json';
|
|
@@ -291,7 +291,7 @@ interface BlinkAI {
|
|
|
291
291
|
images: string[];
|
|
292
292
|
prompt: string;
|
|
293
293
|
size?: string;
|
|
294
|
-
quality?: "
|
|
294
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
295
295
|
n?: number;
|
|
296
296
|
background?: "auto" | "transparent" | "opaque";
|
|
297
297
|
signal?: AbortSignal;
|
|
@@ -686,7 +686,7 @@ declare class HttpClient {
|
|
|
686
686
|
model?: string;
|
|
687
687
|
images?: string[];
|
|
688
688
|
size?: string;
|
|
689
|
-
quality?: '
|
|
689
|
+
quality?: 'auto' | 'low' | 'medium' | 'high';
|
|
690
690
|
background?: 'auto' | 'transparent' | 'opaque';
|
|
691
691
|
n?: number;
|
|
692
692
|
response_format?: 'url' | 'b64_json';
|
|
@@ -1452,7 +1452,7 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1452
1452
|
* @param options - Object containing:
|
|
1453
1453
|
* - `prompt`: Text description of the desired image (required)
|
|
1454
1454
|
* - `size`: Image dimensions (default: "1024x1024")
|
|
1455
|
-
* - `quality`: Image quality ("
|
|
1455
|
+
* - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
|
|
1456
1456
|
* - `n`: Number of images to generate (default: 1)
|
|
1457
1457
|
* - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
|
|
1458
1458
|
* - Plus optional signal parameter
|
|
@@ -1465,21 +1465,21 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1465
1465
|
* });
|
|
1466
1466
|
* console.log("Image URL:", data[0].url);
|
|
1467
1467
|
*
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1468
|
+
* // High-quality image with specific size
|
|
1469
|
+
* const { data } = await blink.ai.generateImage({
|
|
1470
|
+
* prompt: "A futuristic city skyline with flying cars",
|
|
1471
|
+
* size: "1536x1024",
|
|
1472
|
+
* quality: "high",
|
|
1473
|
+
* background: "transparent"
|
|
1474
|
+
* });
|
|
1475
1475
|
*
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1476
|
+
* // Multiple images
|
|
1477
|
+
* const { data } = await blink.ai.generateImage({
|
|
1478
|
+
* prompt: "A cute robot mascot for a tech company",
|
|
1479
|
+
* n: 3,
|
|
1480
|
+
* size: "1024x1024",
|
|
1481
|
+
* quality: "high"
|
|
1482
|
+
* });
|
|
1483
1483
|
* data.forEach((img, i) => console.log(`Image ${i+1}:`, img.url));
|
|
1484
1484
|
* ```
|
|
1485
1485
|
*
|
|
@@ -1491,7 +1491,7 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1491
1491
|
generateImage(options: {
|
|
1492
1492
|
prompt: string;
|
|
1493
1493
|
size?: string;
|
|
1494
|
-
quality?: "
|
|
1494
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
1495
1495
|
n?: number;
|
|
1496
1496
|
background?: "auto" | "transparent" | "opaque";
|
|
1497
1497
|
signal?: AbortSignal;
|
|
@@ -1503,7 +1503,7 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1503
1503
|
* - `images`: Array of public image URLs to modify (required, up to 16 images)
|
|
1504
1504
|
* - `prompt`: Text description of desired modifications (required)
|
|
1505
1505
|
* - `size`: Output image dimensions (default: "auto")
|
|
1506
|
-
* - `quality`: Image quality ("
|
|
1506
|
+
* - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
|
|
1507
1507
|
* - `n`: Number of output images to generate (default: 1)
|
|
1508
1508
|
* - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
|
|
1509
1509
|
* - Plus optional signal parameter
|
|
@@ -1516,19 +1516,19 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1516
1516
|
* "https://storage.example.com/user-photo-1.jpg",
|
|
1517
1517
|
* "https://storage.example.com/user-photo-2.jpg"
|
|
1518
1518
|
* ],
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1519
|
+
* prompt: "Transform into professional business headshots with studio lighting",
|
|
1520
|
+
* quality: "high",
|
|
1521
|
+
* n: 4
|
|
1522
1522
|
* });
|
|
1523
1523
|
* data.forEach((img, i) => console.log(`Headshot ${i+1}:`, img.url));
|
|
1524
1524
|
*
|
|
1525
1525
|
* // Artistic style transformation
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1526
|
+
* const { data } = await blink.ai.modifyImage({
|
|
1527
|
+
* images: ["https://storage.example.com/portrait.jpg"],
|
|
1528
|
+
* prompt: "Transform into oil painting style with dramatic lighting",
|
|
1529
|
+
* quality: "high",
|
|
1530
|
+
* size: "1024x1024"
|
|
1531
|
+
* });
|
|
1532
1532
|
*
|
|
1533
1533
|
* // Background replacement
|
|
1534
1534
|
* const { data } = await blink.ai.modifyImage({
|
|
@@ -1545,9 +1545,9 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1545
1545
|
* "https://storage.example.com/photo3.jpg"
|
|
1546
1546
|
* ];
|
|
1547
1547
|
* const { data } = await blink.ai.modifyImage({
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1548
|
+
* images: userPhotos,
|
|
1549
|
+
* prompt: "Convert to black and white vintage style photographs",
|
|
1550
|
+
* quality: "high"
|
|
1551
1551
|
* });
|
|
1552
1552
|
* ```
|
|
1553
1553
|
*
|
|
@@ -1560,7 +1560,7 @@ declare class BlinkAIImpl implements BlinkAI {
|
|
|
1560
1560
|
images: string[];
|
|
1561
1561
|
prompt: string;
|
|
1562
1562
|
size?: string;
|
|
1563
|
-
quality?: "
|
|
1563
|
+
quality?: "auto" | "low" | "medium" | "high";
|
|
1564
1564
|
n?: number;
|
|
1565
1565
|
background?: "auto" | "transparent" | "opaque";
|
|
1566
1566
|
signal?: AbortSignal;
|
package/dist/index.js
CHANGED
|
@@ -2560,47 +2560,47 @@ var BlinkAIImpl = class {
|
|
|
2560
2560
|
}
|
|
2561
2561
|
}
|
|
2562
2562
|
/**
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2563
|
+
* Generates images from text descriptions using AI.
|
|
2564
|
+
*
|
|
2565
|
+
* @param options - Object containing:
|
|
2566
|
+
* - `prompt`: Text description of the desired image (required)
|
|
2567
|
+
* - `size`: Image dimensions (default: "1024x1024")
|
|
2568
|
+
* - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
|
|
2569
|
+
* - `n`: Number of images to generate (default: 1)
|
|
2570
|
+
* - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
|
|
2571
|
+
* - Plus optional signal parameter
|
|
2572
|
+
*
|
|
2573
|
+
* @example
|
|
2574
|
+
* ```ts
|
|
2575
|
+
* // Basic image generation
|
|
2576
|
+
* const { data } = await blink.ai.generateImage({
|
|
2577
|
+
* prompt: "A serene landscape with mountains and a lake at sunset"
|
|
2578
|
+
* });
|
|
2579
|
+
* console.log("Image URL:", data[0].url);
|
|
2580
|
+
*
|
|
2581
|
+
* // High-quality image with specific size
|
|
2582
|
+
* const { data } = await blink.ai.generateImage({
|
|
2583
|
+
* prompt: "A futuristic city skyline with flying cars",
|
|
2584
|
+
* size: "1536x1024",
|
|
2585
|
+
* quality: "high",
|
|
2586
|
+
* background: "transparent"
|
|
2587
|
+
* });
|
|
2588
|
+
*
|
|
2589
|
+
* // Multiple images
|
|
2590
|
+
* const { data } = await blink.ai.generateImage({
|
|
2591
|
+
* prompt: "A cute robot mascot for a tech company",
|
|
2592
|
+
* n: 3,
|
|
2593
|
+
* size: "1024x1024",
|
|
2594
|
+
* quality: "high"
|
|
2595
|
+
* });
|
|
2596
|
+
* data.forEach((img, i) => console.log(`Image ${i+1}:`, img.url));
|
|
2597
|
+
* ```
|
|
2598
|
+
*
|
|
2599
|
+
* @returns Promise<ImageGenerationResponse> - Object containing:
|
|
2600
|
+
* - `data`: Array of generated images with URLs
|
|
2601
|
+
* - `created`: Timestamp of generation
|
|
2602
|
+
* - `usage`: Token usage information
|
|
2603
|
+
*/
|
|
2604
2604
|
async generateImage(options) {
|
|
2605
2605
|
try {
|
|
2606
2606
|
if (!options.prompt) {
|
|
@@ -2651,65 +2651,65 @@ var BlinkAIImpl = class {
|
|
|
2651
2651
|
}
|
|
2652
2652
|
}
|
|
2653
2653
|
/**
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2654
|
+
* Modifies existing images using AI with text prompts for image-to-image editing.
|
|
2655
|
+
*
|
|
2656
|
+
* @param options - Object containing:
|
|
2657
|
+
* - `images`: Array of public image URLs to modify (required, up to 16 images)
|
|
2658
|
+
* - `prompt`: Text description of desired modifications (required)
|
|
2659
|
+
* - `size`: Output image dimensions (default: "auto")
|
|
2660
|
+
* - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
|
|
2661
|
+
* - `n`: Number of output images to generate (default: 1)
|
|
2662
|
+
* - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
|
|
2663
|
+
* - Plus optional signal parameter
|
|
2664
|
+
*
|
|
2665
|
+
* @example
|
|
2666
|
+
* ```ts
|
|
2667
|
+
* // Professional headshots from casual photos
|
|
2668
|
+
* const { data } = await blink.ai.modifyImage({
|
|
2669
|
+
* images: [
|
|
2670
|
+
* "https://storage.example.com/user-photo-1.jpg",
|
|
2671
|
+
* "https://storage.example.com/user-photo-2.jpg"
|
|
2672
|
+
* ],
|
|
2673
|
+
* prompt: "Transform into professional business headshots with studio lighting",
|
|
2674
|
+
* quality: "high",
|
|
2675
|
+
* n: 4
|
|
2676
|
+
* });
|
|
2677
|
+
* data.forEach((img, i) => console.log(`Headshot ${i+1}:`, img.url));
|
|
2678
|
+
*
|
|
2679
|
+
* // Artistic style transformation
|
|
2680
|
+
* const { data } = await blink.ai.modifyImage({
|
|
2681
|
+
* images: ["https://storage.example.com/portrait.jpg"],
|
|
2682
|
+
* prompt: "Transform into oil painting style with dramatic lighting",
|
|
2683
|
+
* quality: "high",
|
|
2684
|
+
* size: "1024x1024"
|
|
2685
|
+
* });
|
|
2686
|
+
*
|
|
2687
|
+
* // Background replacement
|
|
2688
|
+
* const { data } = await blink.ai.modifyImage({
|
|
2689
|
+
* images: ["https://storage.example.com/product.jpg"],
|
|
2690
|
+
* prompt: "Remove background and place on clean white studio background",
|
|
2691
|
+
* background: "transparent",
|
|
2692
|
+
* n: 2
|
|
2693
|
+
* });
|
|
2694
|
+
*
|
|
2695
|
+
* // Batch processing multiple photos
|
|
2696
|
+
* const userPhotos = [
|
|
2697
|
+
* "https://storage.example.com/photo1.jpg",
|
|
2698
|
+
* "https://storage.example.com/photo2.jpg",
|
|
2699
|
+
* "https://storage.example.com/photo3.jpg"
|
|
2700
|
+
* ];
|
|
2701
|
+
* const { data } = await blink.ai.modifyImage({
|
|
2702
|
+
* images: userPhotos,
|
|
2703
|
+
* prompt: "Convert to black and white vintage style photographs",
|
|
2704
|
+
* quality: "high"
|
|
2705
|
+
* });
|
|
2706
|
+
* ```
|
|
2707
|
+
*
|
|
2708
|
+
* @returns Promise<ImageGenerationResponse> - Object containing:
|
|
2709
|
+
* - `data`: Array of modified images with URLs
|
|
2710
|
+
* - `created`: Timestamp of generation
|
|
2711
|
+
* - `usage`: Token usage information
|
|
2712
|
+
*/
|
|
2713
2713
|
async modifyImage(options) {
|
|
2714
2714
|
try {
|
|
2715
2715
|
if (!options.prompt) {
|
package/dist/index.mjs
CHANGED
|
@@ -2558,47 +2558,47 @@ var BlinkAIImpl = class {
|
|
|
2558
2558
|
}
|
|
2559
2559
|
}
|
|
2560
2560
|
/**
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2561
|
+
* Generates images from text descriptions using AI.
|
|
2562
|
+
*
|
|
2563
|
+
* @param options - Object containing:
|
|
2564
|
+
* - `prompt`: Text description of the desired image (required)
|
|
2565
|
+
* - `size`: Image dimensions (default: "1024x1024")
|
|
2566
|
+
* - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
|
|
2567
|
+
* - `n`: Number of images to generate (default: 1)
|
|
2568
|
+
* - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
|
|
2569
|
+
* - Plus optional signal parameter
|
|
2570
|
+
*
|
|
2571
|
+
* @example
|
|
2572
|
+
* ```ts
|
|
2573
|
+
* // Basic image generation
|
|
2574
|
+
* const { data } = await blink.ai.generateImage({
|
|
2575
|
+
* prompt: "A serene landscape with mountains and a lake at sunset"
|
|
2576
|
+
* });
|
|
2577
|
+
* console.log("Image URL:", data[0].url);
|
|
2578
|
+
*
|
|
2579
|
+
* // High-quality image with specific size
|
|
2580
|
+
* const { data } = await blink.ai.generateImage({
|
|
2581
|
+
* prompt: "A futuristic city skyline with flying cars",
|
|
2582
|
+
* size: "1536x1024",
|
|
2583
|
+
* quality: "high",
|
|
2584
|
+
* background: "transparent"
|
|
2585
|
+
* });
|
|
2586
|
+
*
|
|
2587
|
+
* // Multiple images
|
|
2588
|
+
* const { data } = await blink.ai.generateImage({
|
|
2589
|
+
* prompt: "A cute robot mascot for a tech company",
|
|
2590
|
+
* n: 3,
|
|
2591
|
+
* size: "1024x1024",
|
|
2592
|
+
* quality: "high"
|
|
2593
|
+
* });
|
|
2594
|
+
* data.forEach((img, i) => console.log(`Image ${i+1}:`, img.url));
|
|
2595
|
+
* ```
|
|
2596
|
+
*
|
|
2597
|
+
* @returns Promise<ImageGenerationResponse> - Object containing:
|
|
2598
|
+
* - `data`: Array of generated images with URLs
|
|
2599
|
+
* - `created`: Timestamp of generation
|
|
2600
|
+
* - `usage`: Token usage information
|
|
2601
|
+
*/
|
|
2602
2602
|
async generateImage(options) {
|
|
2603
2603
|
try {
|
|
2604
2604
|
if (!options.prompt) {
|
|
@@ -2649,65 +2649,65 @@ var BlinkAIImpl = class {
|
|
|
2649
2649
|
}
|
|
2650
2650
|
}
|
|
2651
2651
|
/**
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2652
|
+
* Modifies existing images using AI with text prompts for image-to-image editing.
|
|
2653
|
+
*
|
|
2654
|
+
* @param options - Object containing:
|
|
2655
|
+
* - `images`: Array of public image URLs to modify (required, up to 16 images)
|
|
2656
|
+
* - `prompt`: Text description of desired modifications (required)
|
|
2657
|
+
* - `size`: Output image dimensions (default: "auto")
|
|
2658
|
+
* - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
|
|
2659
|
+
* - `n`: Number of output images to generate (default: 1)
|
|
2660
|
+
* - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
|
|
2661
|
+
* - Plus optional signal parameter
|
|
2662
|
+
*
|
|
2663
|
+
* @example
|
|
2664
|
+
* ```ts
|
|
2665
|
+
* // Professional headshots from casual photos
|
|
2666
|
+
* const { data } = await blink.ai.modifyImage({
|
|
2667
|
+
* images: [
|
|
2668
|
+
* "https://storage.example.com/user-photo-1.jpg",
|
|
2669
|
+
* "https://storage.example.com/user-photo-2.jpg"
|
|
2670
|
+
* ],
|
|
2671
|
+
* prompt: "Transform into professional business headshots with studio lighting",
|
|
2672
|
+
* quality: "high",
|
|
2673
|
+
* n: 4
|
|
2674
|
+
* });
|
|
2675
|
+
* data.forEach((img, i) => console.log(`Headshot ${i+1}:`, img.url));
|
|
2676
|
+
*
|
|
2677
|
+
* // Artistic style transformation
|
|
2678
|
+
* const { data } = await blink.ai.modifyImage({
|
|
2679
|
+
* images: ["https://storage.example.com/portrait.jpg"],
|
|
2680
|
+
* prompt: "Transform into oil painting style with dramatic lighting",
|
|
2681
|
+
* quality: "high",
|
|
2682
|
+
* size: "1024x1024"
|
|
2683
|
+
* });
|
|
2684
|
+
*
|
|
2685
|
+
* // Background replacement
|
|
2686
|
+
* const { data } = await blink.ai.modifyImage({
|
|
2687
|
+
* images: ["https://storage.example.com/product.jpg"],
|
|
2688
|
+
* prompt: "Remove background and place on clean white studio background",
|
|
2689
|
+
* background: "transparent",
|
|
2690
|
+
* n: 2
|
|
2691
|
+
* });
|
|
2692
|
+
*
|
|
2693
|
+
* // Batch processing multiple photos
|
|
2694
|
+
* const userPhotos = [
|
|
2695
|
+
* "https://storage.example.com/photo1.jpg",
|
|
2696
|
+
* "https://storage.example.com/photo2.jpg",
|
|
2697
|
+
* "https://storage.example.com/photo3.jpg"
|
|
2698
|
+
* ];
|
|
2699
|
+
* const { data } = await blink.ai.modifyImage({
|
|
2700
|
+
* images: userPhotos,
|
|
2701
|
+
* prompt: "Convert to black and white vintage style photographs",
|
|
2702
|
+
* quality: "high"
|
|
2703
|
+
* });
|
|
2704
|
+
* ```
|
|
2705
|
+
*
|
|
2706
|
+
* @returns Promise<ImageGenerationResponse> - Object containing:
|
|
2707
|
+
* - `data`: Array of modified images with URLs
|
|
2708
|
+
* - `created`: Timestamp of generation
|
|
2709
|
+
* - `usage`: Token usage information
|
|
2710
|
+
*/
|
|
2711
2711
|
async modifyImage(options) {
|
|
2712
2712
|
try {
|
|
2713
2713
|
if (!options.prompt) {
|
package/package.json
CHANGED