Class: OpenAI::Resources::Videos Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/videos.rb,
sig/openai/resources/videos.rbs

Overview

Deprecated.

The Sora API is scheduled to permanently shut down on September

24, 2026.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Videos

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Videos.

Parameters:



349
350
351
# File 'lib/openai/resources/videos.rb', line 349

def initialize(client:)
  @client = client
end

Instance Method Details

#create(prompt:, input_reference: nil, model: nil, seconds: nil, size: nil, request_options: {}) ⇒ OpenAI::Models::Video

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

Create a new video generation job from a prompt and optional reference assets.

String, StringIO, and pathless IO inputs are sent with generic upload metadata. Use OpenAI::FilePart when you need to override the filename or content type.

Parameters:

  • prompt (String)

    Text prompt that describes the video to generate.

  • input_reference (Pathname, StringIO, IO, String, OpenAI::FilePart, OpenAI::Models::ImageInputReferenceParam)

    Optional reference asset upload or reference object that guides generation.

    String, StringIO, and pathless IO inputs are sent with generic upload metadata. Use OpenAI::FilePart when you need to override the filename or content type.

  • model (String, Symbol, OpenAI::Models::VideoModel)

    The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to sora-2.

  • seconds (Symbol, OpenAI::Models::VideoSeconds)

    Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.

  • size (Symbol, OpenAI::Models::VideoSize)

    Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/openai/resources/videos.rb', line 44

def create(params)
  parsed, options = OpenAI::VideoCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "videos",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: OpenAI::Video,
    security: {bearer_auth: true},
    options: options
  )
end

#create_character(name:, video:, request_options: {}) ⇒ OpenAI::Models::VideoCreateCharacterResponse

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

Create a character from an uploaded video.

String, StringIO, and pathless IO inputs are sent with generic upload metadata. Use OpenAI::FilePart when you need to override the filename or content type.

Parameters:

  • name (String)

    Display name for this API character.

  • video (Pathname, StringIO, IO, String, OpenAI::FilePart)

    Video file used to create a character.

    String, StringIO, and pathless IO inputs are sent with generic upload metadata. Use OpenAI::FilePart when you need to override the filename or content type.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



165
166
167
168
169
170
171
172
173
174
175
176
# File 'lib/openai/resources/videos.rb', line 165

def create_character(params)
  parsed, options = OpenAI::VideoCreateCharacterParams.dump_request(params)
  @client.request(
    method: :post,
    path: "videos/characters",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: OpenAI::Models::VideoCreateCharacterResponse,
    security: {bearer_auth: true},
    options: options
  )
end

#delete(video_id, request_options: {}) ⇒ OpenAI::Models::VideoDeleteResponse

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

Permanently delete a completed or failed video and its stored assets.

Parameters:

  • video_id (String)

    The identifier of the video to delete.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



130
131
132
133
134
135
136
137
138
# File 'lib/openai/resources/videos.rb', line 130

def delete(video_id, params = {})
  @client.request(
    method: :delete,
    path: ["videos/%1$s", video_id],
    model: OpenAI::Models::VideoDeleteResponse,
    security: {bearer_auth: true},
    options: params[:request_options]
  )
end

#download_content(video_id, variant: nil, request_options: {}) ⇒ StringIO

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

Download the generated video bytes or a derived preview asset.

Streams the rendered video content for the specified video job.

Parameters:

Returns:

  • (StringIO)

See Also:



197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/openai/resources/videos.rb', line 197

def download_content(video_id, params = {})
  parsed, options = OpenAI::VideoDownloadContentParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["videos/%1$s/content", video_id],
    query: query,
    headers: {"accept" => "application/binary"},
    model: StringIO,
    security: {bearer_auth: true},
    options: options
  )
end

#edit(prompt:, video:, request_options: {}) ⇒ OpenAI::Models::Video

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

Create a new video generation job by editing a source video or existing generated video.

String, StringIO, and pathless IO inputs are sent with generic upload metadata. Use OpenAI::FilePart when you need to override the filename or content type.

Parameters:

Returns:

See Also:



237
238
239
240
241
242
243
244
245
246
247
248
# File 'lib/openai/resources/videos.rb', line 237

def edit(params)
  parsed, options = OpenAI::VideoEditParams.dump_request(params)
  @client.request(
    method: :post,
    path: "videos/edits",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: OpenAI::Video,
    security: {bearer_auth: true},
    options: options
  )
end

#extend_(prompt:, seconds:, video:, request_options: {}) ⇒ OpenAI::Models::Video

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

Create an extension of a completed video.

String, StringIO, and pathless IO inputs are sent with generic upload metadata. Use OpenAI::FilePart when you need to override the filename or content type.

Parameters:

Returns:

See Also:



279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/openai/resources/videos.rb', line 279

def extend_(params)
  parsed, options = OpenAI::VideoExtendParams.dump_request(params)
  @client.request(
    method: :post,
    path: "videos/extensions",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: OpenAI::Video,
    security: {bearer_auth: true},
    options: options
  )
end

#get_character(character_id, request_options: {}) ⇒ OpenAI::Models::VideoGetCharacterResponse

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

Fetch a character.

Parameters:

  • character_id (String)

    The identifier of the character to retrieve.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



306
307
308
309
310
311
312
313
314
# File 'lib/openai/resources/videos.rb', line 306

def get_character(character_id, params = {})
  @client.request(
    method: :get,
    path: ["videos/characters/%1$s", character_id],
    model: OpenAI::Models::VideoGetCharacterResponse,
    security: {bearer_auth: true},
    options: params[:request_options]
  )
end

#list(after: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::ConversationCursorPage<OpenAI::Models::Video>

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

List recently generated videos for the current project.

Parameters:

  • after (String)

    Identifier for the last item from the previous pagination request

  • limit (Integer)

    Number of items to retrieve

  • order (Symbol, OpenAI::Models::VideoListParams::Order)

    Sort order of results by timestamp. Use asc for ascending order or desc for descending order.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/openai/resources/videos.rb', line 102

def list(params = {})
  parsed, options = OpenAI::VideoListParams.dump_request(params)
  query = OpenAI::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "videos",
    query: query,
    page: OpenAI::Internal::ConversationCursorPage,
    model: OpenAI::Video,
    security: {bearer_auth: true},
    options: options
  )
end

#remix(video_id, prompt:, request_options: {}) ⇒ OpenAI::Models::Video

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

Create a remix of a completed video using a refreshed prompt.

Parameters:

  • video_id (String)

    The identifier of the completed video to remix.

  • prompt (String)

    Updated text prompt that directs the remix generation.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



333
334
335
336
337
338
339
340
341
342
343
344
# File 'lib/openai/resources/videos.rb', line 333

def remix(video_id, params)
  parsed, options = OpenAI::VideoRemixParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["videos/%1$s/remix", video_id],
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: OpenAI::Video,
    security: {bearer_auth: true},
    options: options
  )
end

#retrieve(video_id, request_options: {}) ⇒ OpenAI::Models::Video

Deprecated.

The Sora API is scheduled to permanently shut down on September 24, 2026.

Fetch the latest metadata for a generated video.

Parameters:

  • video_id (String)

    The identifier of the video to retrieve.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



71
72
73
74
75
76
77
78
79
# File 'lib/openai/resources/videos.rb', line 71

def retrieve(video_id, params = {})
  @client.request(
    method: :get,
    path: ["videos/%1$s", video_id],
    model: OpenAI::Video,
    security: {bearer_auth: true},
    options: params[:request_options]
  )
end