# This file was auto-generated by Fern from our API Definition.

import typing
import urllib.parse
from json.decoder import JSONDecodeError

from ..core.api_error import ApiError
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.jsonable_encoder import jsonable_encoder
from ..core.pydantic_utilities import pydantic_v1
from ..core.remove_none_from_dict import remove_none_from_dict
from ..core.request_options import RequestOptions
from .errors.unprocessable_entity_error import UnprocessableEntityError
from .types.http_validation_error import HttpValidationError
from .types.image_encoding import ImageEncoding
from .types.image_generation_request_seed import ImageGenerationRequestSeed
from .types.image_generation_response import ImageGenerationResponse
from .types.scheduler import Scheduler
from .types.sdxl_styles import SdxlStyles
from .types.video_generation_request_seed import VideoGenerationRequestSeed
from .types.video_generation_response import VideoGenerationResponse

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class ImageGenClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._client_wrapper = client_wrapper

    def generate_ssd(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import OctoAI

        client = OctoAI(
            api_key="YOUR_API_KEY",
        )
        client.image_gen.generate_ssd(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().image_gen}/", "generate/ssd"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def generate_controlnet_sdxl(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import OctoAI

        client = OctoAI(
            api_key="YOUR_API_KEY",
        )
        client.image_gen.generate_controlnet_sdxl(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(
                f"{self._client_wrapper.get_environment().image_gen}/", "generate/controlnet-sdxl"
            ),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def generate_controlnet_sd15(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import OctoAI

        client = OctoAI(
            api_key="YOUR_API_KEY",
        )
        client.image_gen.generate_controlnet_sd15(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(
                f"{self._client_wrapper.get_environment().image_gen}/", "generate/controlnet-sd15"
            ),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def generate_sdxl(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import OctoAI

        client = OctoAI(
            api_key="YOUR_API_KEY",
        )
        client.image_gen.generate_sdxl(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().image_gen}/", "generate/sdxl"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def generate_sd(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import OctoAI

        client = OctoAI(
            api_key="YOUR_API_KEY",
        )
        client.image_gen.generate_sd(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().image_gen}/", "generate/sd"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    def generate_svd(
        self,
        *,
        image: str,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        motion_scale: typing.Optional[float] = OMIT,
        noise_aug_strength: typing.Optional[float] = OMIT,
        num_videos: typing.Optional[int] = OMIT,
        fps: typing.Optional[int] = OMIT,
        seed: typing.Optional[VideoGenerationRequestSeed] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> VideoGenerationResponse:
        """
        Generate videos in response to the given request.

        Parameters
        ----------
        image : str
            Starting point image encoded in base64 string.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to 'image'. Must be a positive number no greater than 10.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 50.

        motion_scale : typing.Optional[float]
            A floating point number between 0.0 and 5.0 indicating how much motion should be in the generated video/animation.

        noise_aug_strength : typing.Optional[float]
            A floating point number between 0.0 and 1.0 indicatiing how much noise to add to the initial image. Higher values encourage creativity.

        num_videos : typing.Optional[int]
            Integer representing how many output videos/animations to generate with a single 'image' and configuration.

        fps : typing.Optional[int]
            Integer representing how fast the generated frames should play back.

        seed : typing.Optional[VideoGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators.Fixing random seed is useful when attempting to generate a specific video/animation (or set of videos/animations). Must be greater than 0 and less than 2^32.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        VideoGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import OctoAI

        client = OctoAI(
            api_key="YOUR_API_KEY",
        )
        client.image_gen.generate_svd(
            image="image",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"image": image}
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if motion_scale is not OMIT:
            _request["motion_scale"] = motion_scale
        if noise_aug_strength is not OMIT:
            _request["noise_aug_strength"] = noise_aug_strength
        if num_videos is not OMIT:
            _request["num_videos"] = num_videos
        if fps is not OMIT:
            _request["fps"] = fps
        if seed is not OMIT:
            _request["seed"] = seed
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().image_gen}/", "generate/svd"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(VideoGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)


class AsyncImageGenClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._client_wrapper = client_wrapper

    async def generate_ssd(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import AsyncOctoAI

        client = AsyncOctoAI(
            api_key="YOUR_API_KEY",
        )
        await client.image_gen.generate_ssd(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = await self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().image_gen}/", "generate/ssd"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def generate_controlnet_sdxl(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import AsyncOctoAI

        client = AsyncOctoAI(
            api_key="YOUR_API_KEY",
        )
        await client.image_gen.generate_controlnet_sdxl(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = await self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(
                f"{self._client_wrapper.get_environment().image_gen}/", "generate/controlnet-sdxl"
            ),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def generate_controlnet_sd15(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import AsyncOctoAI

        client = AsyncOctoAI(
            api_key="YOUR_API_KEY",
        )
        await client.image_gen.generate_controlnet_sd15(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = await self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(
                f"{self._client_wrapper.get_environment().image_gen}/", "generate/controlnet-sd15"
            ),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def generate_sdxl(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import AsyncOctoAI

        client = AsyncOctoAI(
            api_key="YOUR_API_KEY",
        )
        await client.image_gen.generate_sdxl(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = await self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().image_gen}/", "generate/sdxl"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def generate_sd(
        self,
        *,
        prompt: str,
        prompt2: typing.Optional[str] = OMIT,
        negative_prompt: typing.Optional[str] = OMIT,
        negative_prompt2: typing.Optional[str] = OMIT,
        checkpoint: typing.Optional[str] = OMIT,
        controlnet: typing.Optional[str] = OMIT,
        vae: typing.Optional[str] = OMIT,
        textual_inversions: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
        loras: typing.Optional[typing.Dict[str, typing.Optional[float]]] = OMIT,
        sampler: typing.Optional[Scheduler] = OMIT,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        num_images: typing.Optional[int] = OMIT,
        seed: typing.Optional[ImageGenerationRequestSeed] = OMIT,
        controlnet_image: typing.Optional[str] = OMIT,
        init_image: typing.Optional[str] = OMIT,
        mask_image: typing.Optional[str] = OMIT,
        strength: typing.Optional[float] = OMIT,
        style_preset: typing.Optional[SdxlStyles] = OMIT,
        use_refiner: typing.Optional[bool] = OMIT,
        high_noise_frac: typing.Optional[float] = OMIT,
        controlnet_conditioning_scale: typing.Optional[float] = OMIT,
        controlnet_early_stop: typing.Optional[float] = OMIT,
        controlnet_preprocess: typing.Optional[bool] = OMIT,
        clip_skip: typing.Optional[int] = OMIT,
        outpainting: typing.Optional[bool] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        image_encoding: typing.Optional[ImageEncoding] = OMIT,
        transfer_images: typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ImageGenerationResponse:
        """
        Generate images in response to the given request.

        Parameters
        ----------
        prompt : str
            Text describing the image content to generate.

        prompt2 : typing.Optional[str]

        negative_prompt : typing.Optional[str]

        negative_prompt2 : typing.Optional[str]

        checkpoint : typing.Optional[str]

        controlnet : typing.Optional[str]

        vae : typing.Optional[str]

        textual_inversions : typing.Optional[typing.Dict[str, typing.Optional[str]]]

        loras : typing.Optional[typing.Dict[str, typing.Optional[float]]]

        sampler : typing.Optional[Scheduler]
            Sampler name (also known as 'scheduler') to use during image generation.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to prompt description. Must be a positive number no greater than 50.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 200.

        num_images : typing.Optional[int]
            Integer representing how many output images to generate with a single prompt/configuration.

        seed : typing.Optional[ImageGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators. Fixing random seed is useful when attempting to generate a specific image. Must be greater than 0 and less than 2^32.

        controlnet_image : typing.Optional[str]

        init_image : typing.Optional[str]

        mask_image : typing.Optional[str]

        strength : typing.Optional[float]
            Floating-point number indicating how much creative the Image to Image generation mode should be. Must be greater than 0 and less than or equal to 1.0.

        style_preset : typing.Optional[SdxlStyles]

        use_refiner : typing.Optional[bool]
            Whether to enable and apply the SDXL refiner model to the image generation.

        high_noise_frac : typing.Optional[float]
            Floating-point number that defines the fraction of steps to perform with the base model. Used only by SD XL. Must be greater than or equal to 0.0 and less than or equal to 1.0.

        controlnet_conditioning_scale : typing.Optional[float]
            How strong the effect of the controlnet should be.

        controlnet_early_stop : typing.Optional[float]

        controlnet_preprocess : typing.Optional[bool]
            Whether to apply automatic ControlNet preprocessing.

        clip_skip : typing.Optional[int]

        outpainting : typing.Optional[bool]
            Whether the request requires outpainting or not. If so, special preprocessing is applied for better results.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        image_encoding : typing.Optional[ImageEncoding]
            Define which encoding process should be applied before returning the generated image(s).

        transfer_images : typing.Optional[typing.Dict[str, typing.Optional[typing.Sequence[str]]]]

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ImageGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import AsyncOctoAI

        client = AsyncOctoAI(
            api_key="YOUR_API_KEY",
        )
        await client.image_gen.generate_sd(
            prompt="An octopus playing chess, masterpiece, photorealistic",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"prompt": prompt}
        if prompt2 is not OMIT:
            _request["prompt_2"] = prompt2
        if negative_prompt is not OMIT:
            _request["negative_prompt"] = negative_prompt
        if negative_prompt2 is not OMIT:
            _request["negative_prompt_2"] = negative_prompt2
        if checkpoint is not OMIT:
            _request["checkpoint"] = checkpoint
        if controlnet is not OMIT:
            _request["controlnet"] = controlnet
        if vae is not OMIT:
            _request["vae"] = vae
        if textual_inversions is not OMIT:
            _request["textual_inversions"] = textual_inversions
        if loras is not OMIT:
            _request["loras"] = loras
        if sampler is not OMIT:
            _request["sampler"] = sampler
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if num_images is not OMIT:
            _request["num_images"] = num_images
        if seed is not OMIT:
            _request["seed"] = seed
        if controlnet_image is not OMIT:
            _request["controlnet_image"] = controlnet_image
        if init_image is not OMIT:
            _request["init_image"] = init_image
        if mask_image is not OMIT:
            _request["mask_image"] = mask_image
        if strength is not OMIT:
            _request["strength"] = strength
        if style_preset is not OMIT:
            _request["style_preset"] = style_preset
        if use_refiner is not OMIT:
            _request["use_refiner"] = use_refiner
        if high_noise_frac is not OMIT:
            _request["high_noise_frac"] = high_noise_frac
        if controlnet_conditioning_scale is not OMIT:
            _request["controlnet_conditioning_scale"] = controlnet_conditioning_scale
        if controlnet_early_stop is not OMIT:
            _request["controlnet_early_stop"] = controlnet_early_stop
        if controlnet_preprocess is not OMIT:
            _request["controlnet_preprocess"] = controlnet_preprocess
        if clip_skip is not OMIT:
            _request["clip_skip"] = clip_skip
        if outpainting is not OMIT:
            _request["outpainting"] = outpainting
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if image_encoding is not OMIT:
            _request["image_encoding"] = image_encoding
        if transfer_images is not OMIT:
            _request["transfer_images"] = transfer_images
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = await self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().image_gen}/", "generate/sd"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(ImageGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)

    async def generate_svd(
        self,
        *,
        image: str,
        height: typing.Optional[int] = OMIT,
        width: typing.Optional[int] = OMIT,
        cfg_scale: typing.Optional[float] = OMIT,
        steps: typing.Optional[int] = OMIT,
        motion_scale: typing.Optional[float] = OMIT,
        noise_aug_strength: typing.Optional[float] = OMIT,
        num_videos: typing.Optional[int] = OMIT,
        fps: typing.Optional[int] = OMIT,
        seed: typing.Optional[VideoGenerationRequestSeed] = OMIT,
        enable_safety: typing.Optional[bool] = OMIT,
        force_asset_download: typing.Optional[bool] = OMIT,
        force_asset_gpu_copy: typing.Optional[bool] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> VideoGenerationResponse:
        """
        Generate videos in response to the given request.

        Parameters
        ----------
        image : str
            Starting point image encoded in base64 string.

        height : typing.Optional[int]

        width : typing.Optional[int]

        cfg_scale : typing.Optional[float]
            Floating-point number represeting how closely to adhere to 'image'. Must be a positive number no greater than 10.0.

        steps : typing.Optional[int]
            Integer repreenting how many steps of diffusion to run. Must be greater than 0 and less than or equal to 50.

        motion_scale : typing.Optional[float]
            A floating point number between 0.0 and 5.0 indicating how much motion should be in the generated video/animation.

        noise_aug_strength : typing.Optional[float]
            A floating point number between 0.0 and 1.0 indicatiing how much noise to add to the initial image. Higher values encourage creativity.

        num_videos : typing.Optional[int]
            Integer representing how many output videos/animations to generate with a single 'image' and configuration.

        fps : typing.Optional[int]
            Integer representing how fast the generated frames should play back.

        seed : typing.Optional[VideoGenerationRequestSeed]
            Integer number or list of integers representing the seeds of random generators.Fixing random seed is useful when attempting to generate a specific video/animation (or set of videos/animations). Must be greater than 0 and less than 2^32.

        enable_safety : typing.Optional[bool]
            Boolean defining whether to use safety checker system on generated outputs or not.

        force_asset_download : typing.Optional[bool]
            [Internal] Boolean defining if assets must be re-downloaded into the cache even if present.

        force_asset_gpu_copy : typing.Optional[bool]
            [Internal] Boolean defining if assets must to be copied into the GPU even if present.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        VideoGenerationResponse
            Successful Response

        Examples
        --------
        from octoai.client import AsyncOctoAI

        client = AsyncOctoAI(
            api_key="YOUR_API_KEY",
        )
        await client.image_gen.generate_svd(
            image="image",
        )
        """
        _request: typing.Dict[str, typing.Any] = {"image": image}
        if height is not OMIT:
            _request["height"] = height
        if width is not OMIT:
            _request["width"] = width
        if cfg_scale is not OMIT:
            _request["cfg_scale"] = cfg_scale
        if steps is not OMIT:
            _request["steps"] = steps
        if motion_scale is not OMIT:
            _request["motion_scale"] = motion_scale
        if noise_aug_strength is not OMIT:
            _request["noise_aug_strength"] = noise_aug_strength
        if num_videos is not OMIT:
            _request["num_videos"] = num_videos
        if fps is not OMIT:
            _request["fps"] = fps
        if seed is not OMIT:
            _request["seed"] = seed
        if enable_safety is not OMIT:
            _request["enable_safety"] = enable_safety
        if force_asset_download is not OMIT:
            _request["force_asset_download"] = force_asset_download
        if force_asset_gpu_copy is not OMIT:
            _request["force_asset_gpu_copy"] = force_asset_gpu_copy
        _response = await self._client_wrapper.httpx_client.request(
            method="POST",
            url=urllib.parse.urljoin(f"{self._client_wrapper.get_environment().image_gen}/", "generate/svd"),
            params=jsonable_encoder(
                request_options.get("additional_query_parameters") if request_options is not None else None
            ),
            json=jsonable_encoder(_request)
            if request_options is None or request_options.get("additional_body_parameters") is None
            else {
                **jsonable_encoder(_request),
                **(jsonable_encoder(remove_none_from_dict(request_options.get("additional_body_parameters", {})))),
            },
            headers=jsonable_encoder(
                remove_none_from_dict(
                    {
                        **self._client_wrapper.get_headers(),
                        **(request_options.get("additional_headers", {}) if request_options is not None else {}),
                    }
                )
            ),
            timeout=request_options.get("timeout_in_seconds")
            if request_options is not None and request_options.get("timeout_in_seconds") is not None
            else self._client_wrapper.get_timeout(),
            retries=0,
            max_retries=request_options.get("max_retries") if request_options is not None else 0,  # type: ignore
        )
        if 200 <= _response.status_code < 300:
            return pydantic_v1.parse_obj_as(VideoGenerationResponse, _response.json())  # type: ignore
        if _response.status_code == 422:
            raise UnprocessableEntityError(
                pydantic_v1.parse_obj_as(HttpValidationError, _response.json())  # type: ignore
            )
        try:
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, body=_response.text)
        raise ApiError(status_code=_response.status_code, body=_response_json)
