indoxrouter 0.1.19__py3-none-any.whl → 0.1.22__py3-none-any.whl

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.
indoxrouter/client.py CHANGED
@@ -597,6 +597,8 @@ class Client:
597
597
  output_mime_type: Optional[str] = None,
598
598
  add_watermark: Optional[bool] = None,
599
599
  enhance_prompt: Optional[bool] = None,
600
+ # Google-specific direct parameters
601
+ aspect_ratio: Optional[str] = None,
600
602
  **kwargs,
601
603
  ) -> Dict[str, Any]:
602
604
  """
@@ -608,7 +610,7 @@ class Client:
608
610
 
609
611
  # Provider-specific parameters - will only be included if explicitly provided
610
612
  # Note: Different providers support different parameters
611
- size: Image size - For OpenAI: "1024x1024", "512x512", etc. For Google: "1:1", "4:3", etc.
613
+ size: Image size - For OpenAI: "1024x1024", "512x512", etc. For Google: use aspect_ratio instead
612
614
  n: Number of images to generate
613
615
  quality: Image quality (e.g., "standard", "hd") - supported by some providers
614
616
  style: Image style (e.g., "vivid", "natural") - supported by some providers
@@ -635,6 +637,7 @@ class Client:
635
637
  output_mime_type: MIME type of the generated image
636
638
  add_watermark: Whether to add a watermark to the generated images
637
639
  enhance_prompt: Whether to use prompt rewriting logic
640
+ aspect_ratio: Aspect ratio for Google models (e.g., "1:1", "16:9") - preferred over size
638
641
 
639
642
  **kwargs: Additional parameters to pass to the API
640
643
 
@@ -644,10 +647,11 @@ class Client:
644
647
  # Format the model string
645
648
  formatted_model = self._format_model_string(model)
646
649
 
647
- # Extract provider from model string if present
650
+ # Extract provider and model name from model string if present
648
651
  provider = "openai" # Default provider
652
+ model_name = model
649
653
  if "/" in model:
650
- provider, _ = model.split("/", 1)
654
+ provider, model_name = model.split("/", 1)
651
655
 
652
656
  # Filter out problematic parameters
653
657
  filtered_kwargs = {}
@@ -665,13 +669,26 @@ class Client:
665
669
  if n is not None:
666
670
  data["n"] = n
667
671
 
668
- # Handle size parameter with provider-specific formatting
669
- if size is not None:
670
- formatted_size = self._format_image_size_for_provider(size, provider, model)
671
- data["size"] = formatted_size
672
- elif provider.lower() == "google":
673
- # Default size for Google if not provided
674
- data["size"] = "1:1"
672
+ # Handle size/aspect_ratio parameters based on provider
673
+ if provider.lower() == "google":
674
+ # For Google, use aspect_ratio instead of size
675
+ if aspect_ratio is not None:
676
+ data["aspect_ratio"] = aspect_ratio
677
+ elif size is not None:
678
+ # Convert size to aspect_ratio
679
+ formatted_size = self._format_image_size_for_provider(
680
+ size, provider, model_name
681
+ )
682
+ data["aspect_ratio"] = formatted_size
683
+ else:
684
+ # Default aspect_ratio for Google
685
+ data["aspect_ratio"] = "1:1"
686
+ elif provider.lower() == "xai":
687
+ # xAI doesn't support size parameter - do not include it
688
+ pass
689
+ elif size is not None:
690
+ # For other providers (like OpenAI), use size as is
691
+ data["size"] = size
675
692
 
676
693
  if quality is not None:
677
694
  data["quality"] = quality
@@ -722,6 +739,12 @@ class Client:
722
739
  if filtered_kwargs:
723
740
  data["additional_params"] = filtered_kwargs
724
741
 
742
+ # Special case handling for specific models
743
+ if provider.lower() == "openai" and "gpt-image" in model_name.lower():
744
+ # Remove response_format for gpt-image models unless explicitly provided
745
+ if response_format is None and "response_format" in data:
746
+ del data["response_format"]
747
+
725
748
  return self._request("POST", IMAGE_ENDPOINT, data)
726
749
 
727
750
  def models(self, provider: Optional[str] = None) -> Dict[str, Any]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: indoxrouter
3
- Version: 0.1.19
3
+ Version: 0.1.22
4
4
  Summary: A unified client for various AI providers
5
5
  Author-email: indoxRouter Team <ashkan.eskandari.dev@gmail.com>
6
6
  License: MIT
@@ -0,0 +1,8 @@
1
+ indoxrouter/__init__.py,sha256=kwGvH8F5oqm2O4kLs-UtPfcY0AYiy5ZDUg-Sh3iYJA4,1627
2
+ indoxrouter/client.py,sha256=oAUpx_RDpEIHav_dgb4sc7f_Agji3UXPlvMWLFCnQwE,38437
3
+ indoxrouter/constants.py,sha256=GezZ9nuwK3A37xpWlcfXCrMsIIlCdP7xnvEkPBMyn5g,1383
4
+ indoxrouter/exceptions.py,sha256=qs7f9AnJ7SkOyf9N5qRaZIKpECE8uBq1Pvcg19Jif-U,1718
5
+ indoxrouter-0.1.22.dist-info/METADATA,sha256=aULhnVEH964jtJCoedkHH1SMCGZMkAJl3FK6CYsE-KY,6639
6
+ indoxrouter-0.1.22.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ indoxrouter-0.1.22.dist-info/top_level.txt,sha256=v6FGWkw0QAnXhyYtnXLI1cxzna0iveNvZUotVzCWabM,12
8
+ indoxrouter-0.1.22.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- indoxrouter/__init__.py,sha256=kwGvH8F5oqm2O4kLs-UtPfcY0AYiy5ZDUg-Sh3iYJA4,1627
2
- indoxrouter/client.py,sha256=5y2MFHYx-ge82K30yPYnDRUe4jS9aCF6n3D1JaB1Crw,37298
3
- indoxrouter/constants.py,sha256=GezZ9nuwK3A37xpWlcfXCrMsIIlCdP7xnvEkPBMyn5g,1383
4
- indoxrouter/exceptions.py,sha256=qs7f9AnJ7SkOyf9N5qRaZIKpECE8uBq1Pvcg19Jif-U,1718
5
- indoxrouter-0.1.19.dist-info/METADATA,sha256=bYZiVHEyt-yKnngnshHSu4fMHuBl1MnJqeWbKByr0aU,6639
6
- indoxrouter-0.1.19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- indoxrouter-0.1.19.dist-info/top_level.txt,sha256=v6FGWkw0QAnXhyYtnXLI1cxzna0iveNvZUotVzCWabM,12
8
- indoxrouter-0.1.19.dist-info/RECORD,,