@blinkdotnew/sdk 0.17.0 → 0.17.2

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 CHANGED
@@ -359,7 +359,7 @@ const { object: todoList } = await blink.ai.generateObject({
359
359
  const { data } = await blink.ai.generateImage({
360
360
  prompt: 'A serene landscape with mountains and a lake at sunset',
361
361
  size: '1024x1024',
362
- quality: 'hd',
362
+ quality: 'high',
363
363
  n: 2
364
364
  })
365
365
  console.log('Image URL:', data[0].url)
@@ -368,10 +368,10 @@ console.log('Image URL:', data[0].url)
368
368
  const { data: headshots } = await blink.ai.modifyImage({
369
369
  images: ['https://storage.example.com/user-photo.jpg'], // ... up to 16 images maximum!
370
370
  prompt: 'Generate professional business headshot with studio lighting for this person.',
371
- quality: 'hd',
371
+ quality: 'high',
372
372
  n: 4
373
373
  })
374
- // Options: size ('1024x1024', '1536x1024'), quality ('standard'|'hd'),
374
+ // Options: size ('1024x1024', '1536x1024'), quality ('auto'|'low'|'medium'|'high'),
375
375
  // background ('auto'|'transparent'|'opaque'), n (1-10 images)
376
376
 
377
377
 
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?: 'standard' | 'hd';
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?: "standard" | "hd";
294
+ quality?: "auto" | "low" | "medium" | "high";
295
295
  n?: number;
296
296
  background?: "auto" | "transparent" | "opaque";
297
297
  signal?: AbortSignal;
@@ -625,6 +625,7 @@ declare class HttpClient {
625
625
  uploadFile(path: string, file: File | Blob | Buffer, filePath: string, options?: {
626
626
  upsert?: boolean;
627
627
  onProgress?: (percent: number) => void;
628
+ contentType?: string;
628
629
  }): Promise<BlinkResponse<any>>;
629
630
  /**
630
631
  * Upload with progress tracking using XMLHttpRequest
@@ -685,7 +686,7 @@ declare class HttpClient {
685
686
  model?: string;
686
687
  images?: string[];
687
688
  size?: string;
688
- quality?: 'standard' | 'hd';
689
+ quality?: 'auto' | 'low' | 'medium' | 'high';
689
690
  background?: 'auto' | 'transparent' | 'opaque';
690
691
  n?: number;
691
692
  response_format?: 'url' | 'b64_json';
@@ -1451,7 +1452,7 @@ declare class BlinkAIImpl implements BlinkAI {
1451
1452
  * @param options - Object containing:
1452
1453
  * - `prompt`: Text description of the desired image (required)
1453
1454
  * - `size`: Image dimensions (default: "1024x1024")
1454
- * - `quality`: Image quality ("standard" or "hd", default: "standard")
1455
+ * - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
1455
1456
  * - `n`: Number of images to generate (default: 1)
1456
1457
  * - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
1457
1458
  * - Plus optional signal parameter
@@ -1464,21 +1465,21 @@ declare class BlinkAIImpl implements BlinkAI {
1464
1465
  * });
1465
1466
  * console.log("Image URL:", data[0].url);
1466
1467
  *
1467
- * // High-quality image with specific size
1468
- * const { data } = await blink.ai.generateImage({
1469
- * prompt: "A futuristic city skyline with flying cars",
1470
- * size: "1536x1024",
1471
- * quality: "hd",
1472
- * background: "transparent"
1473
- * });
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
+ * });
1474
1475
  *
1475
- * // Multiple images
1476
- * const { data } = await blink.ai.generateImage({
1477
- * prompt: "A cute robot mascot for a tech company",
1478
- * n: 3,
1479
- * size: "1024x1024",
1480
- * quality: "hd"
1481
- * });
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
+ * });
1482
1483
  * data.forEach((img, i) => console.log(`Image ${i+1}:`, img.url));
1483
1484
  * ```
1484
1485
  *
@@ -1490,7 +1491,7 @@ declare class BlinkAIImpl implements BlinkAI {
1490
1491
  generateImage(options: {
1491
1492
  prompt: string;
1492
1493
  size?: string;
1493
- quality?: "standard" | "hd";
1494
+ quality?: "auto" | "low" | "medium" | "high";
1494
1495
  n?: number;
1495
1496
  background?: "auto" | "transparent" | "opaque";
1496
1497
  signal?: AbortSignal;
@@ -1502,7 +1503,7 @@ declare class BlinkAIImpl implements BlinkAI {
1502
1503
  * - `images`: Array of public image URLs to modify (required, up to 16 images)
1503
1504
  * - `prompt`: Text description of desired modifications (required)
1504
1505
  * - `size`: Output image dimensions (default: "auto")
1505
- * - `quality`: Image quality ("standard" or "hd", default: "standard")
1506
+ * - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
1506
1507
  * - `n`: Number of output images to generate (default: 1)
1507
1508
  * - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
1508
1509
  * - Plus optional signal parameter
@@ -1515,19 +1516,19 @@ declare class BlinkAIImpl implements BlinkAI {
1515
1516
  * "https://storage.example.com/user-photo-1.jpg",
1516
1517
  * "https://storage.example.com/user-photo-2.jpg"
1517
1518
  * ],
1518
- * prompt: "Transform into professional business headshots with studio lighting",
1519
- * quality: "hd",
1520
- * n: 4
1519
+ * prompt: "Transform into professional business headshots with studio lighting",
1520
+ * quality: "high",
1521
+ * n: 4
1521
1522
  * });
1522
1523
  * data.forEach((img, i) => console.log(`Headshot ${i+1}:`, img.url));
1523
1524
  *
1524
1525
  * // Artistic style transformation
1525
- * const { data } = await blink.ai.modifyImage({
1526
- * images: ["https://storage.example.com/portrait.jpg"],
1527
- * prompt: "Transform into oil painting style with dramatic lighting",
1528
- * quality: "hd",
1529
- * size: "1024x1024"
1530
- * });
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
+ * });
1531
1532
  *
1532
1533
  * // Background replacement
1533
1534
  * const { data } = await blink.ai.modifyImage({
@@ -1544,9 +1545,9 @@ declare class BlinkAIImpl implements BlinkAI {
1544
1545
  * "https://storage.example.com/photo3.jpg"
1545
1546
  * ];
1546
1547
  * const { data } = await blink.ai.modifyImage({
1547
- * images: userPhotos,
1548
- * prompt: "Convert to black and white vintage style photographs",
1549
- * quality: "hd"
1548
+ * images: userPhotos,
1549
+ * prompt: "Convert to black and white vintage style photographs",
1550
+ * quality: "high"
1550
1551
  * });
1551
1552
  * ```
1552
1553
  *
@@ -1559,7 +1560,7 @@ declare class BlinkAIImpl implements BlinkAI {
1559
1560
  images: string[];
1560
1561
  prompt: string;
1561
1562
  size?: string;
1562
- quality?: "standard" | "hd";
1563
+ quality?: "auto" | "low" | "medium" | "high";
1563
1564
  n?: number;
1564
1565
  background?: "auto" | "transparent" | "opaque";
1565
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?: 'standard' | 'hd';
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?: "standard" | "hd";
294
+ quality?: "auto" | "low" | "medium" | "high";
295
295
  n?: number;
296
296
  background?: "auto" | "transparent" | "opaque";
297
297
  signal?: AbortSignal;
@@ -625,6 +625,7 @@ declare class HttpClient {
625
625
  uploadFile(path: string, file: File | Blob | Buffer, filePath: string, options?: {
626
626
  upsert?: boolean;
627
627
  onProgress?: (percent: number) => void;
628
+ contentType?: string;
628
629
  }): Promise<BlinkResponse<any>>;
629
630
  /**
630
631
  * Upload with progress tracking using XMLHttpRequest
@@ -685,7 +686,7 @@ declare class HttpClient {
685
686
  model?: string;
686
687
  images?: string[];
687
688
  size?: string;
688
- quality?: 'standard' | 'hd';
689
+ quality?: 'auto' | 'low' | 'medium' | 'high';
689
690
  background?: 'auto' | 'transparent' | 'opaque';
690
691
  n?: number;
691
692
  response_format?: 'url' | 'b64_json';
@@ -1451,7 +1452,7 @@ declare class BlinkAIImpl implements BlinkAI {
1451
1452
  * @param options - Object containing:
1452
1453
  * - `prompt`: Text description of the desired image (required)
1453
1454
  * - `size`: Image dimensions (default: "1024x1024")
1454
- * - `quality`: Image quality ("standard" or "hd", default: "standard")
1455
+ * - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
1455
1456
  * - `n`: Number of images to generate (default: 1)
1456
1457
  * - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
1457
1458
  * - Plus optional signal parameter
@@ -1464,21 +1465,21 @@ declare class BlinkAIImpl implements BlinkAI {
1464
1465
  * });
1465
1466
  * console.log("Image URL:", data[0].url);
1466
1467
  *
1467
- * // High-quality image with specific size
1468
- * const { data } = await blink.ai.generateImage({
1469
- * prompt: "A futuristic city skyline with flying cars",
1470
- * size: "1536x1024",
1471
- * quality: "hd",
1472
- * background: "transparent"
1473
- * });
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
+ * });
1474
1475
  *
1475
- * // Multiple images
1476
- * const { data } = await blink.ai.generateImage({
1477
- * prompt: "A cute robot mascot for a tech company",
1478
- * n: 3,
1479
- * size: "1024x1024",
1480
- * quality: "hd"
1481
- * });
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
+ * });
1482
1483
  * data.forEach((img, i) => console.log(`Image ${i+1}:`, img.url));
1483
1484
  * ```
1484
1485
  *
@@ -1490,7 +1491,7 @@ declare class BlinkAIImpl implements BlinkAI {
1490
1491
  generateImage(options: {
1491
1492
  prompt: string;
1492
1493
  size?: string;
1493
- quality?: "standard" | "hd";
1494
+ quality?: "auto" | "low" | "medium" | "high";
1494
1495
  n?: number;
1495
1496
  background?: "auto" | "transparent" | "opaque";
1496
1497
  signal?: AbortSignal;
@@ -1502,7 +1503,7 @@ declare class BlinkAIImpl implements BlinkAI {
1502
1503
  * - `images`: Array of public image URLs to modify (required, up to 16 images)
1503
1504
  * - `prompt`: Text description of desired modifications (required)
1504
1505
  * - `size`: Output image dimensions (default: "auto")
1505
- * - `quality`: Image quality ("standard" or "hd", default: "standard")
1506
+ * - `quality`: Image quality ("auto", "low", "medium", or "high", default: "auto")
1506
1507
  * - `n`: Number of output images to generate (default: 1)
1507
1508
  * - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
1508
1509
  * - Plus optional signal parameter
@@ -1515,19 +1516,19 @@ declare class BlinkAIImpl implements BlinkAI {
1515
1516
  * "https://storage.example.com/user-photo-1.jpg",
1516
1517
  * "https://storage.example.com/user-photo-2.jpg"
1517
1518
  * ],
1518
- * prompt: "Transform into professional business headshots with studio lighting",
1519
- * quality: "hd",
1520
- * n: 4
1519
+ * prompt: "Transform into professional business headshots with studio lighting",
1520
+ * quality: "high",
1521
+ * n: 4
1521
1522
  * });
1522
1523
  * data.forEach((img, i) => console.log(`Headshot ${i+1}:`, img.url));
1523
1524
  *
1524
1525
  * // Artistic style transformation
1525
- * const { data } = await blink.ai.modifyImage({
1526
- * images: ["https://storage.example.com/portrait.jpg"],
1527
- * prompt: "Transform into oil painting style with dramatic lighting",
1528
- * quality: "hd",
1529
- * size: "1024x1024"
1530
- * });
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
+ * });
1531
1532
  *
1532
1533
  * // Background replacement
1533
1534
  * const { data } = await blink.ai.modifyImage({
@@ -1544,9 +1545,9 @@ declare class BlinkAIImpl implements BlinkAI {
1544
1545
  * "https://storage.example.com/photo3.jpg"
1545
1546
  * ];
1546
1547
  * const { data } = await blink.ai.modifyImage({
1547
- * images: userPhotos,
1548
- * prompt: "Convert to black and white vintage style photographs",
1549
- * quality: "hd"
1548
+ * images: userPhotos,
1549
+ * prompt: "Convert to black and white vintage style photographs",
1550
+ * quality: "high"
1550
1551
  * });
1551
1552
  * ```
1552
1553
  *
@@ -1559,7 +1560,7 @@ declare class BlinkAIImpl implements BlinkAI {
1559
1560
  images: string[];
1560
1561
  prompt: string;
1561
1562
  size?: string;
1562
- quality?: "standard" | "hd";
1563
+ quality?: "auto" | "low" | "medium" | "high";
1563
1564
  n?: number;
1564
1565
  background?: "auto" | "transparent" | "opaque";
1565
1566
  signal?: AbortSignal;
package/dist/index.js CHANGED
@@ -403,9 +403,10 @@ var HttpClient = class {
403
403
  if (file instanceof File) {
404
404
  formData.append("file", file);
405
405
  } else if (file instanceof Blob) {
406
- formData.append("file", file);
406
+ const blobWithType = options.contentType ? new Blob([file], { type: options.contentType }) : file;
407
+ formData.append("file", blobWithType);
407
408
  } else if (typeof Buffer !== "undefined" && file instanceof Buffer) {
408
- const blob = new Blob([file]);
409
+ const blob = new Blob([file], { type: options.contentType || "application/octet-stream" });
409
410
  formData.append("file", blob);
410
411
  } else {
411
412
  throw new BlinkValidationError("Unsupported file type");
@@ -1866,7 +1867,9 @@ var BlinkStorageImpl = class {
1866
1867
  // Use corrected path with proper extension
1867
1868
  {
1868
1869
  upsert: options.upsert,
1869
- onProgress: options.onProgress
1870
+ onProgress: options.onProgress,
1871
+ contentType: detectedContentType
1872
+ // Pass detected content type
1870
1873
  }
1871
1874
  );
1872
1875
  if (response.data?.data?.publicUrl) {
@@ -2557,47 +2560,47 @@ var BlinkAIImpl = class {
2557
2560
  }
2558
2561
  }
2559
2562
  /**
2560
- * Generates images from text descriptions using AI.
2561
- *
2562
- * @param options - Object containing:
2563
- * - `prompt`: Text description of the desired image (required)
2564
- * - `size`: Image dimensions (default: "1024x1024")
2565
- * - `quality`: Image quality ("standard" or "hd", default: "standard")
2566
- * - `n`: Number of images to generate (default: 1)
2567
- * - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
2568
- * - Plus optional signal parameter
2569
- *
2570
- * @example
2571
- * ```ts
2572
- * // Basic image generation
2573
- * const { data } = await blink.ai.generateImage({
2574
- * prompt: "A serene landscape with mountains and a lake at sunset"
2575
- * });
2576
- * console.log("Image URL:", data[0].url);
2577
- *
2578
- * // High-quality image with specific size
2579
- * const { data } = await blink.ai.generateImage({
2580
- * prompt: "A futuristic city skyline with flying cars",
2581
- * size: "1536x1024",
2582
- * quality: "hd",
2583
- * background: "transparent"
2584
- * });
2585
- *
2586
- * // Multiple images
2587
- * const { data } = await blink.ai.generateImage({
2588
- * prompt: "A cute robot mascot for a tech company",
2589
- * n: 3,
2590
- * size: "1024x1024",
2591
- * quality: "hd"
2592
- * });
2593
- * data.forEach((img, i) => console.log(`Image ${i+1}:`, img.url));
2594
- * ```
2595
- *
2596
- * @returns Promise<ImageGenerationResponse> - Object containing:
2597
- * - `data`: Array of generated images with URLs
2598
- * - `created`: Timestamp of generation
2599
- * - `usage`: Token usage information
2600
- */
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
+ */
2601
2604
  async generateImage(options) {
2602
2605
  try {
2603
2606
  if (!options.prompt) {
@@ -2648,65 +2651,65 @@ var BlinkAIImpl = class {
2648
2651
  }
2649
2652
  }
2650
2653
  /**
2651
- * Modifies existing images using AI with text prompts for image-to-image editing.
2652
- *
2653
- * @param options - Object containing:
2654
- * - `images`: Array of public image URLs to modify (required, up to 16 images)
2655
- * - `prompt`: Text description of desired modifications (required)
2656
- * - `size`: Output image dimensions (default: "auto")
2657
- * - `quality`: Image quality ("standard" or "hd", default: "standard")
2658
- * - `n`: Number of output images to generate (default: 1)
2659
- * - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
2660
- * - Plus optional signal parameter
2661
- *
2662
- * @example
2663
- * ```ts
2664
- * // Professional headshots from casual photos
2665
- * const { data } = await blink.ai.modifyImage({
2666
- * images: [
2667
- * "https://storage.example.com/user-photo-1.jpg",
2668
- * "https://storage.example.com/user-photo-2.jpg"
2669
- * ],
2670
- * prompt: "Transform into professional business headshots with studio lighting",
2671
- * quality: "hd",
2672
- * n: 4
2673
- * });
2674
- * data.forEach((img, i) => console.log(`Headshot ${i+1}:`, img.url));
2675
- *
2676
- * // Artistic style transformation
2677
- * const { data } = await blink.ai.modifyImage({
2678
- * images: ["https://storage.example.com/portrait.jpg"],
2679
- * prompt: "Transform into oil painting style with dramatic lighting",
2680
- * quality: "hd",
2681
- * size: "1024x1024"
2682
- * });
2683
- *
2684
- * // Background replacement
2685
- * const { data } = await blink.ai.modifyImage({
2686
- * images: ["https://storage.example.com/product.jpg"],
2687
- * prompt: "Remove background and place on clean white studio background",
2688
- * background: "transparent",
2689
- * n: 2
2690
- * });
2691
- *
2692
- * // Batch processing multiple photos
2693
- * const userPhotos = [
2694
- * "https://storage.example.com/photo1.jpg",
2695
- * "https://storage.example.com/photo2.jpg",
2696
- * "https://storage.example.com/photo3.jpg"
2697
- * ];
2698
- * const { data } = await blink.ai.modifyImage({
2699
- * images: userPhotos,
2700
- * prompt: "Convert to black and white vintage style photographs",
2701
- * quality: "hd"
2702
- * });
2703
- * ```
2704
- *
2705
- * @returns Promise<ImageGenerationResponse> - Object containing:
2706
- * - `data`: Array of modified images with URLs
2707
- * - `created`: Timestamp of generation
2708
- * - `usage`: Token usage information
2709
- */
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
+ */
2710
2713
  async modifyImage(options) {
2711
2714
  try {
2712
2715
  if (!options.prompt) {
package/dist/index.mjs CHANGED
@@ -401,9 +401,10 @@ var HttpClient = class {
401
401
  if (file instanceof File) {
402
402
  formData.append("file", file);
403
403
  } else if (file instanceof Blob) {
404
- formData.append("file", file);
404
+ const blobWithType = options.contentType ? new Blob([file], { type: options.contentType }) : file;
405
+ formData.append("file", blobWithType);
405
406
  } else if (typeof Buffer !== "undefined" && file instanceof Buffer) {
406
- const blob = new Blob([file]);
407
+ const blob = new Blob([file], { type: options.contentType || "application/octet-stream" });
407
408
  formData.append("file", blob);
408
409
  } else {
409
410
  throw new BlinkValidationError("Unsupported file type");
@@ -1864,7 +1865,9 @@ var BlinkStorageImpl = class {
1864
1865
  // Use corrected path with proper extension
1865
1866
  {
1866
1867
  upsert: options.upsert,
1867
- onProgress: options.onProgress
1868
+ onProgress: options.onProgress,
1869
+ contentType: detectedContentType
1870
+ // Pass detected content type
1868
1871
  }
1869
1872
  );
1870
1873
  if (response.data?.data?.publicUrl) {
@@ -2555,47 +2558,47 @@ var BlinkAIImpl = class {
2555
2558
  }
2556
2559
  }
2557
2560
  /**
2558
- * Generates images from text descriptions using AI.
2559
- *
2560
- * @param options - Object containing:
2561
- * - `prompt`: Text description of the desired image (required)
2562
- * - `size`: Image dimensions (default: "1024x1024")
2563
- * - `quality`: Image quality ("standard" or "hd", default: "standard")
2564
- * - `n`: Number of images to generate (default: 1)
2565
- * - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
2566
- * - Plus optional signal parameter
2567
- *
2568
- * @example
2569
- * ```ts
2570
- * // Basic image generation
2571
- * const { data } = await blink.ai.generateImage({
2572
- * prompt: "A serene landscape with mountains and a lake at sunset"
2573
- * });
2574
- * console.log("Image URL:", data[0].url);
2575
- *
2576
- * // High-quality image with specific size
2577
- * const { data } = await blink.ai.generateImage({
2578
- * prompt: "A futuristic city skyline with flying cars",
2579
- * size: "1536x1024",
2580
- * quality: "hd",
2581
- * background: "transparent"
2582
- * });
2583
- *
2584
- * // Multiple images
2585
- * const { data } = await blink.ai.generateImage({
2586
- * prompt: "A cute robot mascot for a tech company",
2587
- * n: 3,
2588
- * size: "1024x1024",
2589
- * quality: "hd"
2590
- * });
2591
- * data.forEach((img, i) => console.log(`Image ${i+1}:`, img.url));
2592
- * ```
2593
- *
2594
- * @returns Promise<ImageGenerationResponse> - Object containing:
2595
- * - `data`: Array of generated images with URLs
2596
- * - `created`: Timestamp of generation
2597
- * - `usage`: Token usage information
2598
- */
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
+ */
2599
2602
  async generateImage(options) {
2600
2603
  try {
2601
2604
  if (!options.prompt) {
@@ -2646,65 +2649,65 @@ var BlinkAIImpl = class {
2646
2649
  }
2647
2650
  }
2648
2651
  /**
2649
- * Modifies existing images using AI with text prompts for image-to-image editing.
2650
- *
2651
- * @param options - Object containing:
2652
- * - `images`: Array of public image URLs to modify (required, up to 16 images)
2653
- * - `prompt`: Text description of desired modifications (required)
2654
- * - `size`: Output image dimensions (default: "auto")
2655
- * - `quality`: Image quality ("standard" or "hd", default: "standard")
2656
- * - `n`: Number of output images to generate (default: 1)
2657
- * - `background`: Background handling ("auto", "transparent", "opaque", default: "auto")
2658
- * - Plus optional signal parameter
2659
- *
2660
- * @example
2661
- * ```ts
2662
- * // Professional headshots from casual photos
2663
- * const { data } = await blink.ai.modifyImage({
2664
- * images: [
2665
- * "https://storage.example.com/user-photo-1.jpg",
2666
- * "https://storage.example.com/user-photo-2.jpg"
2667
- * ],
2668
- * prompt: "Transform into professional business headshots with studio lighting",
2669
- * quality: "hd",
2670
- * n: 4
2671
- * });
2672
- * data.forEach((img, i) => console.log(`Headshot ${i+1}:`, img.url));
2673
- *
2674
- * // Artistic style transformation
2675
- * const { data } = await blink.ai.modifyImage({
2676
- * images: ["https://storage.example.com/portrait.jpg"],
2677
- * prompt: "Transform into oil painting style with dramatic lighting",
2678
- * quality: "hd",
2679
- * size: "1024x1024"
2680
- * });
2681
- *
2682
- * // Background replacement
2683
- * const { data } = await blink.ai.modifyImage({
2684
- * images: ["https://storage.example.com/product.jpg"],
2685
- * prompt: "Remove background and place on clean white studio background",
2686
- * background: "transparent",
2687
- * n: 2
2688
- * });
2689
- *
2690
- * // Batch processing multiple photos
2691
- * const userPhotos = [
2692
- * "https://storage.example.com/photo1.jpg",
2693
- * "https://storage.example.com/photo2.jpg",
2694
- * "https://storage.example.com/photo3.jpg"
2695
- * ];
2696
- * const { data } = await blink.ai.modifyImage({
2697
- * images: userPhotos,
2698
- * prompt: "Convert to black and white vintage style photographs",
2699
- * quality: "hd"
2700
- * });
2701
- * ```
2702
- *
2703
- * @returns Promise<ImageGenerationResponse> - Object containing:
2704
- * - `data`: Array of modified images with URLs
2705
- * - `created`: Timestamp of generation
2706
- * - `usage`: Token usage information
2707
- */
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
+ */
2708
2711
  async modifyImage(options) {
2709
2712
  try {
2710
2713
  if (!options.prompt) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blinkdotnew/sdk",
3
- "version": "0.17.0",
3
+ "version": "0.17.2",
4
4
  "description": "Blink TypeScript SDK for client-side applications - Zero-boilerplate CRUD + auth + AI + analytics + notifications for modern SaaS/AI apps",
5
5
  "keywords": [
6
6
  "blink",