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

Method create

src/openai/resources/videos.py:648–714  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

646 return AsyncVideosWithStreamingResponse(self)
647
648 async def create(
649 self,
650 *,
651 prompt: str,
652 input_reference: video_create_params.InputReference | Omit = omit,
653 model: VideoModelParam | Omit = omit,
654 seconds: VideoSeconds | Omit = omit,
655 size: VideoSize | Omit = omit,
656 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
657 # The extra values given here take precedence over values defined on the client or passed to this method.
658 extra_headers: Headers | None = None,
659 extra_query: Query | None = None,
660 extra_body: Body | None = None,
661 timeout: float | httpx.Timeout | None | NotGiven = not_given,
662 ) -> Video:
663 """
664 Create a new video generation job from a prompt and optional reference assets.
665
666 Args:
667 prompt: Text prompt that describes the video to generate.
668
669 input_reference: Optional reference asset upload or reference object that guides generation.
670
671 model: The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults
672 to `sora-2`.
673
674 seconds: Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.
675
676 size: Output resolution formatted as width x height (allowed values: 720x1280,
677 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.
678
679 extra_headers: Send extra headers
680
681 extra_query: Add additional query parameters to the request
682
683 extra_body: Add additional JSON properties to the request
684
685 timeout: Override the client-level default timeout for this request, in seconds
686 """
687 body = deepcopy_with_paths(
688 {
689 "prompt": prompt,
690 "input_reference": input_reference,
691 "model": model,
692 "seconds": seconds,
693 "size": size,
694 },
695 [["input_reference"]],
696 )
697 files = extract_files(cast(Mapping[str, object], body), paths=[["input_reference"]])
698 # It should be noted that the actual Content-Type header that will be
699 # sent to the server will contain a `boundary` parameter, e.g.
700 # multipart/form-data; boundary=---abc--
701 extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
702 return await self._post(
703 "/videos",
704 body=await async_maybe_transform(body, video_create_params.VideoCreateParams),
705 files=files,

Callers 1

create_and_pollMethod · 0.95

Calls 4

deepcopy_with_pathsFunction · 0.85
extract_filesFunction · 0.85
async_maybe_transformFunction · 0.85
make_request_optionsFunction · 0.85

Tested by

no test coverage detected