Create a new video generation job from a prompt and optional reference assets. Args: prompt: Text prompt that describes the video to generate. input_reference: Optional reference asset upload or reference object that guides generation. model: The vid
(
self,
*,
prompt: str,
input_reference: video_create_params.InputReference | Omit = omit,
model: VideoModelParam | Omit = omit,
seconds: VideoSeconds | Omit = omit,
size: VideoSize | 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,
)
| 67 | return VideosWithStreamingResponse(self) |
| 68 | |
| 69 | def create( |
| 70 | self, |
| 71 | *, |
| 72 | prompt: str, |
| 73 | input_reference: video_create_params.InputReference | Omit = omit, |
| 74 | model: VideoModelParam | Omit = omit, |
| 75 | seconds: VideoSeconds | Omit = omit, |
| 76 | size: VideoSize | Omit = omit, |
| 77 | class="cm"># Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 78 | class="cm"># The extra values given here take precedence over values defined on the client or passed to this method. |
| 79 | extra_headers: Headers | None = None, |
| 80 | extra_query: Query | None = None, |
| 81 | extra_body: Body | None = None, |
| 82 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 83 | ) -> Video: |
| 84 | class="st">""" |
| 85 | Create a new video generation job from a prompt and optional reference assets. |
| 86 | |
| 87 | Args: |
| 88 | prompt: Text prompt that describes the video to generate. |
| 89 | |
| 90 | input_reference: Optional reference asset upload or reference object that guides generation. |
| 91 | |
| 92 | model: The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults |
| 93 | to `sora-2`. |
| 94 | |
| 95 | seconds: Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds. |
| 96 | |
| 97 | size: Output resolution formatted as width x height (allowed values: 720x1280, |
| 98 | 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280. |
| 99 | |
| 100 | extra_headers: Send extra headers |
| 101 | |
| 102 | extra_query: Add additional query parameters to the request |
| 103 | |
| 104 | extra_body: Add additional JSON properties to the request |
| 105 | |
| 106 | timeout: Override the client-level default timeout for this request, in seconds |
| 107 | class="st">""" |
| 108 | body = deepcopy_with_paths( |
| 109 | { |
| 110 | class="st">"prompt": prompt, |
| 111 | class="st">"input_reference": input_reference, |
| 112 | class="st">"model": model, |
| 113 | class="st">"seconds": seconds, |
| 114 | class="st">"size": size, |
| 115 | }, |
| 116 | [[class="st">"input_reference"]], |
| 117 | ) |
| 118 | files = extract_files(cast(Mapping[str, object], body), paths=[[class="st">"input_reference"]]) |
| 119 | class="cm"># It should be noted that the actual Content-Type header that will be |
| 120 | class="cm"># sent to the server will contain a `boundary` parameter, e.g. |
| 121 | class="cm"># multipart/form-data; boundary=---abc-- |
| 122 | extra_headers = {class="st">"Content-Type": class="st">"multipart/form-data", **(extra_headers or {})} |
| 123 | return self._post( |
| 124 | class="st">"/videos", |
| 125 | body=maybe_transform(body, video_create_params.VideoCreateParams), |
| 126 | files=files, |
no test coverage detected