2323 VideoResourceWithStreamingResponse ,
2424 AsyncVideoResourceWithStreamingResponse ,
2525)
26- from ...types import generation_list_params , generation_create_params
26+ from ...types import generation_list_params , generation_create_params , generation_upscale_params
2727from ..._types import NOT_GIVEN , Body , Query , Headers , NoneType , NotGiven
2828from ..._utils import (
2929 maybe_transform ,
@@ -95,7 +95,7 @@ def create(
9595 loop : bool | NotGiven = NOT_GIVEN ,
9696 model : Literal ["ray-1-6" , "ray-2" ] | NotGiven = NOT_GIVEN ,
9797 prompt : str | NotGiven = NOT_GIVEN ,
98- resolution : Union [Literal ["540p" , "720p" ], str ] | NotGiven = NOT_GIVEN ,
98+ resolution : Union [Literal ["540p" , "720p" , "1080p" , "4k" ], str ] | NotGiven = NOT_GIVEN ,
9999 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
100100 # The extra values given here take precedence over values defined on the client or passed to this method.
101101 extra_headers : Headers | None = None ,
@@ -264,6 +264,54 @@ def get(
264264 cast_to = Generation ,
265265 )
266266
267+ def upscale (
268+ self ,
269+ id : str ,
270+ * ,
271+ callback_url : str | NotGiven = NOT_GIVEN ,
272+ generation_type : Literal ["upscale_video" ] | NotGiven = NOT_GIVEN ,
273+ resolution : Union [Literal ["540p" , "720p" , "1080p" , "4k" ], str ] | NotGiven = NOT_GIVEN ,
274+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
275+ # The extra values given here take precedence over values defined on the client or passed to this method.
276+ extra_headers : Headers | None = None ,
277+ extra_query : Query | None = None ,
278+ extra_body : Body | None = None ,
279+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
280+ ) -> Generation :
281+ """
282+ Upscale a generation by its ID
283+
284+ Args:
285+ callback_url: The callback URL for the upscale
286+
287+ resolution: The resolution of the upscale
288+
289+ extra_headers: Send extra headers
290+
291+ extra_query: Add additional query parameters to the request
292+
293+ extra_body: Add additional JSON properties to the request
294+
295+ timeout: Override the client-level default timeout for this request, in seconds
296+ """
297+ if not id :
298+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
299+ return self ._post (
300+ f"/generations/{ id } /upscale" ,
301+ body = maybe_transform (
302+ {
303+ "callback_url" : callback_url ,
304+ "generation_type" : generation_type ,
305+ "resolution" : resolution ,
306+ },
307+ generation_upscale_params .GenerationUpscaleParams ,
308+ ),
309+ options = make_request_options (
310+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
311+ ),
312+ cast_to = Generation ,
313+ )
314+
267315
268316class AsyncGenerationsResource (AsyncAPIResource ):
269317 @cached_property
@@ -308,7 +356,7 @@ async def create(
308356 loop : bool | NotGiven = NOT_GIVEN ,
309357 model : Literal ["ray-1-6" , "ray-2" ] | NotGiven = NOT_GIVEN ,
310358 prompt : str | NotGiven = NOT_GIVEN ,
311- resolution : Union [Literal ["540p" , "720p" ], str ] | NotGiven = NOT_GIVEN ,
359+ resolution : Union [Literal ["540p" , "720p" , "1080p" , "4k" ], str ] | NotGiven = NOT_GIVEN ,
312360 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
313361 # The extra values given here take precedence over values defined on the client or passed to this method.
314362 extra_headers : Headers | None = None ,
@@ -477,6 +525,54 @@ async def get(
477525 cast_to = Generation ,
478526 )
479527
528+ async def upscale (
529+ self ,
530+ id : str ,
531+ * ,
532+ callback_url : str | NotGiven = NOT_GIVEN ,
533+ generation_type : Literal ["upscale_video" ] | NotGiven = NOT_GIVEN ,
534+ resolution : Union [Literal ["540p" , "720p" , "1080p" , "4k" ], str ] | NotGiven = NOT_GIVEN ,
535+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
536+ # The extra values given here take precedence over values defined on the client or passed to this method.
537+ extra_headers : Headers | None = None ,
538+ extra_query : Query | None = None ,
539+ extra_body : Body | None = None ,
540+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
541+ ) -> Generation :
542+ """
543+ Upscale a generation by its ID
544+
545+ Args:
546+ callback_url: The callback URL for the upscale
547+
548+ resolution: The resolution of the upscale
549+
550+ extra_headers: Send extra headers
551+
552+ extra_query: Add additional query parameters to the request
553+
554+ extra_body: Add additional JSON properties to the request
555+
556+ timeout: Override the client-level default timeout for this request, in seconds
557+ """
558+ if not id :
559+ raise ValueError (f"Expected a non-empty value for `id` but received { id !r} " )
560+ return await self ._post (
561+ f"/generations/{ id } /upscale" ,
562+ body = await async_maybe_transform (
563+ {
564+ "callback_url" : callback_url ,
565+ "generation_type" : generation_type ,
566+ "resolution" : resolution ,
567+ },
568+ generation_upscale_params .GenerationUpscaleParams ,
569+ ),
570+ options = make_request_options (
571+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
572+ ),
573+ cast_to = Generation ,
574+ )
575+
480576
481577class GenerationsResourceWithRawResponse :
482578 def __init__ (self , generations : GenerationsResource ) -> None :
@@ -494,6 +590,9 @@ def __init__(self, generations: GenerationsResource) -> None:
494590 self .get = to_raw_response_wrapper (
495591 generations .get ,
496592 )
593+ self .upscale = to_raw_response_wrapper (
594+ generations .upscale ,
595+ )
497596
498597 @cached_property
499598 def camera_motion (self ) -> CameraMotionResourceWithRawResponse :
@@ -524,6 +623,9 @@ def __init__(self, generations: AsyncGenerationsResource) -> None:
524623 self .get = async_to_raw_response_wrapper (
525624 generations .get ,
526625 )
626+ self .upscale = async_to_raw_response_wrapper (
627+ generations .upscale ,
628+ )
527629
528630 @cached_property
529631 def camera_motion (self ) -> AsyncCameraMotionResourceWithRawResponse :
@@ -554,6 +656,9 @@ def __init__(self, generations: GenerationsResource) -> None:
554656 self .get = to_streamed_response_wrapper (
555657 generations .get ,
556658 )
659+ self .upscale = to_streamed_response_wrapper (
660+ generations .upscale ,
661+ )
557662
558663 @cached_property
559664 def camera_motion (self ) -> CameraMotionResourceWithStreamingResponse :
@@ -584,6 +689,9 @@ def __init__(self, generations: AsyncGenerationsResource) -> None:
584689 self .get = async_to_streamed_response_wrapper (
585690 generations .get ,
586691 )
692+ self .upscale = async_to_streamed_response_wrapper (
693+ generations .upscale ,
694+ )
587695
588696 @cached_property
589697 def camera_motion (self ) -> AsyncCameraMotionResourceWithStreamingResponse :
0 commit comments