openapi: 3.0.0
info:
title: OpenAI Assistants Videos API
description: The Assistants API allows you to build AI assistants within your own applications. An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries. The Assistants API currently supports three types of tools - Code Interpreter, Retrieval, and Function calling. In the future, we plan to release more OpenAI-built tools, and allow you to provide your own tools on our platform.
version: 2.0.0
termsOfService: https://openai.com/policies/terms-of-use
contact:
name: OpenAI Support
url: https://help.openai.com/
license:
name: MIT
url: https://github.com/openai/openai-openapi/blob/master/LICENSE
servers:
- url: https://api.openai.com/v1
security:
- ApiKeyAuth: []
tags:
- name: Videos
paths:
/videos:
post:
tags:
- Videos
summary: Create a new video generation job from a prompt and optional reference assets.
operationId: createVideo
parameters: []
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/CreateVideoMultipartBody'
application/json:
schema:
$ref: '#/components/schemas/CreateVideoJsonBody'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/VideoResource'
x-oaiMeta:
name: Create video
group: videos
path: create
examples:
request:
curl: "curl https://api.openai.com/v1/videos \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -F \"model=sora-2\" \\\n -F \"prompt=A calico cat playing a piano on stage\"\n"
javascript: 'import OpenAI from ''openai'';
const openai = new OpenAI();
const video = await openai.videos.create({ prompt: ''A calico cat playing a piano on stage'' });
console.log(video.id);
'
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvideo = client.videos.create(\n prompt=\"x\",\n)\nprint(video.id)"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.New(context.TODO(), openai.VideoNewParams{\n\t\tPrompt: \"x\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
video = openai.videos.create(prompt: "x")
puts(video)'
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoCreateParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoCreateParams params = VideoCreateParams.builder()\n .prompt(\"x\")\n .build();\n Video video = client.videos().create(params);\n }\n}"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst video = await client.videos.create({ prompt: 'x' });\n\nconsole.log(video.id);"
response: "{\n \"id\": \"video_123\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"queued\",\n \"progress\": 0,\n \"created_at\": 1712697600,\n \"size\": \"1024x1792\",\n \"seconds\": \"8\",\n \"quality\": \"standard\"\n}\n"
get:
tags:
- Videos
summary: List recently generated videos for the current project.
operationId: ListVideos
parameters:
- name: limit
in: query
description: Number of items to retrieve
required: false
schema:
type: integer
minimum: 0
maximum: 100
- name: order
in: query
description: Sort order of results by timestamp. Use `asc` for ascending order or `desc` for descending order.
required: false
schema:
$ref: '#/components/schemas/OrderEnum'
- name: after
in: query
description: Identifier for the last item from the previous pagination request
required: false
schema:
description: Identifier for the last item from the previous pagination request
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/VideoListResource'
x-oaiMeta:
name: List videos
group: videos
path: list for the organization.
examples:
request:
curl: "curl https://api.openai.com/v1/videos \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\"\n"
javascript: "import OpenAI from 'openai';\n\nconst openai = new OpenAI();\n\n// Automatically fetches more pages as needed.\nfor await (const video of openai.videos.list()) {\n console.log(video.id);\n}\n"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\npage = client.videos.list()\npage = page.data[0]\nprint(page.id)"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Videos.List(context.TODO(), openai.VideoListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
page = openai.videos.list
puts(page)'
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.VideoListPage;\nimport com.openai.models.videos.VideoListParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoListPage page = client.videos().list();\n }\n}"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const video of client.videos.list()) {\n console.log(video.id);\n}"
response: "{\n \"data\": [\n {\n \"id\": \"video_123\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"completed\"\n }\n ],\n \"object\": \"list\"\n}\n"
/videos/characters:
post:
tags:
- Videos
summary: Create a character from an uploaded video.
operationId: CreateVideoCharacter
parameters: []
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/CreateVideoCharacterBody'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/VideoCharacterResource'
x-oaiMeta:
examples:
response: ''
request:
node.js: "import fs from 'fs';\nimport OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.videos.createCharacter({\n name: 'x',\n video: fs.createReadStream('path/to/file'),\n});\n\nconsole.log(response.id);"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nresponse = client.videos.create_character(\n name=\"x\",\n video=b\"Example data\",\n)\nprint(response.id)"
go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Videos.NewCharacter(context.TODO(), openai.VideoNewCharacterParams{\n\t\tName: \"x\",\n\t\tVideo: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.VideoCreateCharacterParams;\nimport com.openai.models.videos.VideoCreateCharacterResponse;\nimport java.io.ByteArrayInputStream;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoCreateCharacterParams params = VideoCreateCharacterParams.builder()\n .name(\"x\")\n .video(new ByteArrayInputStream(\"Example data\".getBytes()))\n .build();\n VideoCreateCharacterResponse response = client.videos().createCharacter(params);\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
response = openai.videos.create_character(name: "x", video: StringIO.new("Example data"))
puts(response)'
/videos/characters/{character_id}:
get:
tags:
- Videos
summary: Fetch a character.
operationId: GetVideoCharacter
parameters:
- name: character_id
in: path
description: The identifier of the character to retrieve.
required: true
schema:
example: char_123
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/VideoCharacterResource'
x-oaiMeta:
examples:
response: ''
request:
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.videos.getCharacter('char_123');\n\nconsole.log(response.id);"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nresponse = client.videos.get_character(\n \"char_123\",\n)\nprint(response.id)"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Videos.GetCharacter(context.TODO(), \"char_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.VideoGetCharacterParams;\nimport com.openai.models.videos.VideoGetCharacterResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoGetCharacterResponse response = client.videos().getCharacter(\"char_123\");\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
response = openai.videos.get_character("char_123")
puts(response)'
/videos/edits:
post:
tags:
- Videos
summary: Create a new video generation job by editing a source video or existing generated video.
operationId: CreateVideoEdit
parameters: []
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/CreateVideoEditMultipartBody'
application/json:
schema:
$ref: '#/components/schemas/CreateVideoEditJsonBody'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/VideoResource'
x-oaiMeta:
examples:
response: ''
request:
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst video = await client.videos.edit({ prompt: 'x', video: fs.createReadStream('path/to/file') });\n\nconsole.log(video.id);"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvideo = client.videos.edit(\n prompt=\"x\",\n video=b\"Example data\",\n)\nprint(video.id)"
go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Edit(context.TODO(), openai.VideoEditParams{\n\t\tPrompt: \"x\",\n\t\tVideo: openai.VideoEditParamsVideoUnion{\n\t\t\tOfFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoEditParams;\nimport java.io.ByteArrayInputStream;\nimport java.io.InputStream;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoEditParams params = VideoEditParams.builder()\n .prompt(\"x\")\n .video(new ByteArrayInputStream(\"Example data\".getBytes()))\n .build();\n Video video = client.videos().edit(params);\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
video = openai.videos.edit(prompt: "x", video: StringIO.new("Example data"))
puts(video)'
/videos/extensions:
post:
tags:
- Videos
summary: Create an extension of a completed video.
operationId: CreateVideoExtend
parameters: []
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/CreateVideoExtendMultipartBody'
application/json:
schema:
$ref: '#/components/schemas/CreateVideoExtendJsonBody'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/VideoResource'
x-oaiMeta:
examples:
response: ''
request:
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst video = await client.videos.extend({\n prompt: 'x',\n seconds: '4',\n video: fs.createReadStream('path/to/file'),\n});\n\nconsole.log(video.id);"
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvideo = client.videos.extend(\n prompt=\"x\",\n seconds=\"4\",\n video=b\"Example data\",\n)\nprint(video.id)"
go: "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Extend(context.TODO(), openai.VideoExtendParams{\n\t\tPrompt: \"x\",\n\t\tSeconds: openai.VideoSeconds4,\n\t\tVideo: openai.VideoExtendParamsVideoUnion{\n\t\t\tOfFile: io.Reader(bytes.NewBuffer([]byte(\"Example data\"))),\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n"
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoExtendParams;\nimport com.openai.models.videos.VideoSeconds;\nimport java.io.ByteArrayInputStream;\nimport java.io.InputStream;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoExtendParams params = VideoExtendParams.builder()\n .prompt(\"x\")\n .seconds(VideoSeconds._4)\n .video(new ByteArrayInputStream(\"Example data\".getBytes()))\n .build();\n Video video = client.videos().extend(params);\n }\n}"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
video = openai.videos.extend_(prompt: "x", seconds: :"4", video: StringIO.new("Example data"))
puts(video)'
/videos/{video_id}:
get:
tags:
- Videos
summary: Fetch the latest metadata for a generated video.
operationId: GetVideo
parameters:
- name: video_id
in: path
description: The identifier of the video to retrieve.
required: true
schema:
example: video_123
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/VideoResource'
x-oaiMeta:
name: Retrieve video
group: videos
path: retrieve matching the provided identifier.
examples:
response: ''
request:
javascript: 'import OpenAI from ''openai'';
const client = new OpenAI();
const video = await client.videos.retrieve(''video_123'');
console.log(video.id);
'
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvideo = client.videos.retrieve(\n \"video_123\",\n)\nprint(video.id)"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Get(context.TODO(), \"video_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
video = openai.videos.retrieve("video_123")
puts(video)'
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoRetrieveParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n Video video = client.videos().retrieve(\"video_123\");\n }\n}"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst video = await client.videos.retrieve('video_123');\n\nconsole.log(video.id);"
delete:
tags:
- Videos
summary: Permanently delete a completed or failed video and its stored assets.
operationId: DeleteVideo
parameters:
- name: video_id
in: path
description: The identifier of the video to delete.
required: true
schema:
example: video_123
type: string
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/DeletedVideoResource'
x-oaiMeta:
name: Delete video
group: videos
path: delete
examples:
response: ''
request:
javascript: 'import OpenAI from ''openai'';
const client = new OpenAI();
const video = await client.videos.delete(''video_123'');
console.log(video.id);
'
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvideo = client.videos.delete(\n \"video_123\",\n)\nprint(video.id)"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Delete(context.TODO(), \"video_123\")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
video = openai.videos.delete("video_123")
puts(video)'
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.VideoDeleteParams;\nimport com.openai.models.videos.VideoDeleteResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoDeleteResponse video = client.videos().delete(\"video_123\");\n }\n}"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst video = await client.videos.delete('video_123');\n\nconsole.log(video.id);"
/videos/{video_id}/content:
get:
tags:
- Videos
summary: 'Download the generated video bytes or a derived preview asset.
Streams the rendered video content for the specified video job.'
operationId: RetrieveVideoContent
parameters:
- name: video_id
in: path
description: The identifier of the video whose media to download.
required: true
schema:
example: video_123
type: string
- name: variant
in: query
description: Which downloadable asset to return. Defaults to the MP4 video.
required: false
schema:
$ref: '#/components/schemas/VideoContentVariant'
responses:
'200':
description: The video bytes or preview asset that matches the requested variant.
content:
video/mp4:
schema:
type: string
format: binary
image/webp:
schema:
type: string
format: binary
application/json:
schema:
type: string
x-oaiMeta:
name: Retrieve video content
group: videos
path: content
examples:
response: ''
request:
javascript: 'import OpenAI from ''openai'';
const client = new OpenAI();
const response = await client.videos.downloadContent(''video_123'');
console.log(response);
const content = await response.blob();
console.log(content);
'
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nresponse = client.videos.download_content(\n video_id=\"video_123\",\n)\nprint(response)\ncontent = response.read()\nprint(content)"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Videos.DownloadContent(\n\t\tcontext.TODO(),\n\t\t\"video_123\",\n\t\topenai.VideoDownloadContentParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
response = openai.videos.download_content("video_123")
puts(response)'
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.core.http.HttpResponse;\nimport com.openai.models.videos.VideoDownloadContentParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n HttpResponse response = client.videos().downloadContent(\"video_123\");\n }\n}"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.videos.downloadContent('video_123');\n\nconsole.log(response);\n\nconst content = await response.blob();\nconsole.log(content);"
/videos/{video_id}/remix:
post:
tags:
- Videos
summary: Create a remix of a completed video using a refreshed prompt.
operationId: CreateVideoRemix
parameters:
- name: video_id
in: path
description: The identifier of the completed video to remix.
required: true
schema:
example: video_123
type: string
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/CreateVideoRemixBody'
application/json:
schema:
$ref: '#/components/schemas/CreateVideoRemixBody'
responses:
'200':
description: Success
content:
application/json:
schema:
$ref: '#/components/schemas/VideoResource'
x-oaiMeta:
name: Remix video
group: videos
path: remix using the provided prompt.
examples:
request:
curl: "curl -X POST https://api.openai.com/v1/videos/video_123/remix \\\n -H \"Authorization: Bearer $OPENAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"prompt\": \"Extend the scene with the cat taking a bow to the cheering audience\"\n }'\n"
javascript: 'import OpenAI from ''openai'';
const client = new OpenAI();
const video = await client.videos.remix(''video_123'', { prompt: ''Extend the scene with the cat taking a bow to the cheering audience'' });
console.log(video.id);
'
python: "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ.get(\"OPENAI_API_KEY\"), # This is the default and can be omitted\n)\nvideo = client.videos.remix(\n video_id=\"video_123\",\n prompt=\"x\",\n)\nprint(video.id)"
go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tvideo, err := client.Videos.Remix(\n\t\tcontext.TODO(),\n\t\t\"video_123\",\n\t\topenai.VideoRemixParams{\n\t\t\tPrompt: \"x\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", video.ID)\n}\n"
ruby: 'require "openai"
openai = OpenAI::Client.new(api_key: "My API Key")
video = openai.videos.remix("video_123", prompt: "x")
puts(video)'
java: "package com.openai.example;\n\nimport com.openai.client.OpenAIClient;\nimport com.openai.client.okhttp.OpenAIOkHttpClient;\nimport com.openai.models.videos.Video;\nimport com.openai.models.videos.VideoRemixParams;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n OpenAIClient client = OpenAIOkHttpClient.fromEnv();\n\n VideoRemixParams params = VideoRemixParams.builder()\n .videoId(\"video_123\")\n .prompt(\"x\")\n .build();\n Video video = client.videos().remix(params);\n }\n}"
node.js: "import OpenAI from 'openai';\n\nconst client = new OpenAI({\n apiKey: process.env['OPENAI_API_KEY'], // This is the default and can be omitted\n});\n\nconst video = await client.videos.remix('video_123', { prompt: 'x' });\n\nconsole.log(video.id);"
response: "{\n \"id\": \"video_456\",\n \"object\": \"video\",\n \"model\": \"sora-2\",\n \"status\": \"queued\",\n \"progress\": 0,\n \"created_at\": 1712698600,\n \"size\": \"720x1280\",\n \"seconds\": \"8\",\n \"remixed_from_video_id\": \"video_123\"\n}\n"
components:
schemas:
CreateVideoMultipartBody:
properties:
model:
$ref: '#/components/schemas/VideoModel'
description: 'The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults to `sora-2`.'
prompt:
type: string
maxLength: 32000
minLength: 1
description: Text prompt that describes the video to generate.
input_reference:
oneOf:
- type: string
format: binary
description: Optional reference asset upload or reference object that guides generation.
- $ref: '#/components/schemas/ImageRefParam-2'
seconds:
$ref: '#/components/schemas/VideoSeconds'
description: 'Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.'
size:
$ref: '#/components/schemas/VideoSize'
description: 'Output resolution formatted as width x height (allowed values: 720x1280, 1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.'
type: object
required:
- prompt
title: Create video multipart request
description: Multipart parameters for creating a new video generation job.
CreateVideoRemixBody:
properties:
prompt:
type: string
maxLength: 32000
minLength: 1
description: Updated text prompt that directs the remix generation.
type: object
required:
- prompt
title: Create video remix request
description: Parameters for remixing an existing generated video.
Error-2:
properties:
code:
type: string
description: A machine-readable error code that was returned.
message:
type: string
description: A human-readable description of the error that was returned.
type: object
required:
- code
- message
title: Error
description: An error that occurred while generating the response.
ImageRefParam-2:
properties:
image_url:
type: string
maxLength: 20971520
format: uri
descripti
# --- truncated at 32 KB (49 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/openai/refs/heads/main/openapi/openai-videos-api-openapi.yml