MCPcopy
hub / github.com/openai/openai-python / create_variation

Method create_variation

src/openai/resources/images.py:50–126  ·  src/openai/resources/images.py::Images.create_variation

Creates a variation of a given image. This endpoint only supports `dall-e-2`. Args: image: The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. model: The model to use for image generation. Only

(
        self,
        *,
        image: FileTypes,
        model: Union[str, ImageModel, None] | Omit = omit,
        n: Optional[int] | Omit = omit,
        response_format: Optional[Literal["url", "b64_json"]] | Omit = omit,
        size: Optional[Literal["256x256", "512x512", "1024x1024"]] | Omit = omit,
        user: str | Omit = omit,
        # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
        # The extra values given here take precedence over values defined on the client or passed to this method.
        extra_headers: Headers | None = None,
        extra_query: Query | None = None,
        extra_body: Body | None = None,
        timeout: float | httpx.Timeout | None | NotGiven = not_given,
    )

Source from the content-addressed store, hash-verified

48 return ImagesWithStreamingResponse(self)
49
50 def create_variation(
51 self,
52 *,
53 image: FileTypes,
54 model: Union[str, ImageModel, None] | Omit = omit,
55 n: Optional[int] | Omit = omit,
56 response_format: Optional[Literal[class="st">"url", class="st">"b64_json"]] | Omit = omit,
57 size: Optional[Literal[class="st">"256x256", class="st">"512x512", class="st">"1024x1024"]] | Omit = omit,
58 user: str | Omit = omit,
59 class="cm"># Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
60 class="cm"># The extra values given here take precedence over values defined on the client or passed to this method.
61 extra_headers: Headers | None = None,
62 extra_query: Query | None = None,
63 extra_body: Body | None = None,
64 timeout: float | httpx.Timeout | None | NotGiven = not_given,
65 ) -> ImagesResponse:
66 class="st">"""Creates a variation of a given image.
67
68 This endpoint only supports `dall-e-2`.
69
70 Args:
71 image: The image to use as the basis for the variation(s). Must be a valid PNG file,
72 less than 4MB, and square.
73
74 model: The model to use for image generation. Only `dall-e-2` is supported at this
75 time.
76
77 n: The number of images to generate. Must be between 1 and 10.
78
79 response_format: The format in which the generated images are returned. Must be one of `url` or
80 `b64_json`. URLs are only valid for 60 minutes after the image has been
81 generated.
82
83 size: The size of the generated images. Must be one of `256x256`, `512x512`, or
84 `1024x1024`.
85
86 user: A unique identifier representing your end-user, which can help OpenAI to monitor
87 and detect abuse.
88 [Learn more](https://platform.openai.com/docs/guides/safety-best-practicesclass="cm">#end-user-ids).
89
90 extra_headers: Send extra headers
91
92 extra_query: Add additional query parameters to the request
93
94 extra_body: Add additional JSON properties to the request
95
96 timeout: Override the client-level default timeout for this request, in seconds
97 class="st">"""
98 body = deepcopy_with_paths(
99 {
100 class="st">"image": image,
101 class="st">"model": model,
102 class="st">"n": n,
103 class="st">"response_format": response_format,
104 class="st">"size": size,
105 class="st">"user": user,
106 },
107 [[class="st">"image"]],

Calls 4

deepcopy_with_pathsFunction · 0.85
extract_filesFunction · 0.85
maybe_transformFunction · 0.85
make_request_optionsFunction · 0.85