Create a new video generation job by editing a source video or existing generated video.
videos.edit(**kwargs) -> Video
post /videos/edits
Create a new video generation job by editing a source video or existing generated video.
Parameters
-
prompt: StringText prompt that describes how to edit the source video.
-
video: String | VideoReferenceInputParam{ id}Reference to the completed video to edit.
-
String = StringReference to the completed video to edit.
-
class VideoReferenceInputParamReference to the completed video to edit.
-
id: StringThe identifier of the completed video.
-
-
Returns
-
class VideoStructured information describing a generated video job.
-
id: StringUnique identifier for the video job.
-
completed_at: IntegerUnix timestamp (seconds) for when the job completed, if finished.
-
created_at: IntegerUnix timestamp (seconds) for when the job was created.
-
error: VideoCreateErrorError payload that explains why generation failed, if applicable.
-
code: StringA machine-readable error code that was returned.
-
message: StringA human-readable description of the error that was returned.
-
-
expires_at: IntegerUnix timestamp (seconds) for when the downloadable assets expire, if set.
-
model: VideoModelThe video generation model that produced the job.
-
String = String -
VideoModel = :"sora-2" | :"sora-2-pro" | :"sora-2-2025-10-06" | 2 more-
:"sora-2" -
:"sora-2-pro" -
:"sora-2-2025-10-06" -
:"sora-2-pro-2025-10-06" -
:"sora-2-2025-12-08"
-
-
-
object: :videoThe object type, which is always
video.:video
-
progress: IntegerApproximate completion percentage for the generation task.
-
prompt: StringThe prompt that was used to generate the video.
-
remixed_from_video_id: StringIdentifier of the source video if this video is a remix.
-
seconds: String | VideoSecondsDuration of the generated clip in seconds. For extensions, this is the stitched total duration.
-
String = String -
VideoSeconds = :"4" | :"8" | :"12"-
:"4" -
:"8" -
:"12"
-
-
-
size: VideoSizeThe resolution of the generated video.
-
:"720x1280" -
:"1280x720" -
:"1024x1792" -
:"1792x1024"
-
-
status: :queued | :in_progress | :completed | :failedCurrent lifecycle status of the video job.
-
:queued -
:in_progress -
:completed -
:failed
-
-
Example
require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
video = openai.videos.edit(prompt: "x", video: StringIO.new("Example data"))
puts(video)
Response
{
"id": "id",
"completed_at": 0,
"created_at": 0,
"error": {
"code": "code",
"message": "message"
},
"expires_at": 0,
"model": "sora-2",
"object": "video",
"progress": 0,
"prompt": "prompt",
"remixed_from_video_id": "remixed_from_video_id",
"seconds": "4",
"size": "720x1280",
"status": "queued"
}