Skip to content

Examples and guides for using the OpenAI API

Update Sora cookbook (#2516)

annikab-oai51867ad01c71
diff --git a/examples/sora/gifs/alfie1.gif b/examples/sora/gifs/alfie1.gif
new file mode 100644
index 00000000..f566f572
Binary files /dev/null and b/examples/sora/gifs/alfie1.gif differ
diff --git a/examples/sora/gifs/alfie1_small.gif b/examples/sora/gifs/alfie1_small.gif
new file mode 100644
index 00000000..3b7f64eb
Binary files /dev/null and b/examples/sora/gifs/alfie1_small.gif differ
diff --git a/examples/sora/gifs/alfie_f1.gif b/examples/sora/gifs/alfie_f1.gif
new file mode 100644
index 00000000..5241d285
Binary files /dev/null and b/examples/sora/gifs/alfie_f1.gif differ
diff --git a/examples/sora/gifs/alfie_input.gif b/examples/sora/gifs/alfie_input.gif
new file mode 100644
index 00000000..f566f572
Binary files /dev/null and b/examples/sora/gifs/alfie_input.gif differ
diff --git a/examples/sora/gifs/alfie_museum.gif b/examples/sora/gifs/alfie_museum.gif
new file mode 100644
index 00000000..0a205ceb
Binary files /dev/null and b/examples/sora/gifs/alfie_museum.gif differ
diff --git a/examples/sora/gifs/alfie_museum_extension.gif b/examples/sora/gifs/alfie_museum_extension.gif
new file mode 100644
index 00000000..60e1beba
Binary files /dev/null and b/examples/sora/gifs/alfie_museum_extension.gif differ
diff --git a/examples/sora/gifs/alfie_museum_extension_lowerq.gif b/examples/sora/gifs/alfie_museum_extension_lowerq.gif
new file mode 100644
index 00000000..c58ee1de
Binary files /dev/null and b/examples/sora/gifs/alfie_museum_extension_lowerq.gif differ
diff --git a/examples/sora/gifs/alfie_tokyo.gif b/examples/sora/gifs/alfie_tokyo.gif
new file mode 100644
index 00000000..62b5f3bb
Binary files /dev/null and b/examples/sora/gifs/alfie_tokyo.gif differ
diff --git a/examples/sora/sora2_prompting_guide.ipynb b/examples/sora/sora2_prompting_guide.ipynb
index e2db91b0..7819f5d6 100644
--- a/examples/sora/sora2_prompting_guide.ipynb
+++ b/examples/sora/sora2_prompting_guide.ipynb
@@ -19,6 +19,15 @@
"id": "d07e0761",
"metadata": {},
"source": [
+ "## Updated - March 2026\n",
+ "This guide has been updated to reflect the latest Sora API capabilities, including:\n",
+ "- **Character references (objects and animals)** – Upload a character once and reuse it across videos with consistent appearance.\n",
+ "- **Higher-resolution exports** – Generate videos in 1920×1080 or 1080×1920.\n",
+ "- **Longer videos** – Maximum duration increased from 12s to 20s.\n",
+ "- **Video extension** – Extend an existing video using the full initial clip as context, not just the last frame.\n",
+ "- **Batch API for video** – Run asynchronous video generation jobs for larger production workflows.\n",
+ "\n",
+ "\n",
"## Before you prompt\n",
"Think of prompting like briefing a cinematographer who has never seen your storyboard. If you leave out details, they’ll improvise – and you may not get what you envisioned. By being specific about what the “shot” should achieve, you give the model more control and consistency to work with.\n",
"\n",
@@ -27,7 +36,9 @@
"\n",
"Most importantly, be prepared to iterate. Small changes to camera, lighting, or action can shift the outcome dramatically. Collaborate with the model: you provide direction, and the model delivers creative variations.\n",
"\n",
- "This isn’t an exact science—think of the guidance below as helpful suggestions we’ve learned from working with the model.\n"
+ "This isn’t an exact science—think of the guidance below as helpful suggestions we’ve learned from working with the model.\n",
+ "\n",
+ "\n"
]
},
{
@@ -40,13 +51,15 @@
"- **model**: `sora-2` or `sora-2-pro`.\n",
"- **size**: a string in the form {width}x{height}. Supported resolutions are dependent on the model selection:\n",
" - sora-2\n",
- " - 1280x720, 720x1280\n",
+ " - 720x1280, 1280x720, \n",
" - sora-2-pro\n",
- " - 1280x720, 720x1280\n",
+ " - 720x1280, 1280x720\n",
" - 1024x1792, 1792x1024\n",
- "- **seconds**: the clip length, supported values: “4”, “8”, “12”. Default value is “4”.\n",
+ " - 1080x1920, 1920x1080 \n",
+ "- **seconds**: the clip length, supported values: “4”, “8”, “12”, “16”, “20”. Default value is “4”.\n",
+ "- **characters** *(optional)*: reference up to **two uploaded characters** in a generation. Each entry should include the character ID returned from the Characters API.\n",
"\n",
- "These parameters are the video’s container – resolution, duration, and quality will not change based on prose like “make it longer.” Set them explicitly in the API call; your prompt controls everything else (subject, motion, lighting, style)."
+ "These parameters are the video’s container: resolution, duration, and character references will not change based on prose like “make it longer.” Set them explicitly in the API call; your prompt controls everything else (subject, motion, lighting, style)."
]
},
{
@@ -67,6 +80,27 @@
"The model generally follows instructions more reliably in shorter clips. For best results, aim for concise shots. If your project allows, you may see better results by stitching together two 4 second clips in editing instead of generating a single 8 second clip."
]
},
+ {
+ "cell_type": "markdown",
+ "id": "844595fe",
+ "metadata": {},
+ "source": [
+ "## Endpoints\n",
+ "The Sora API supports several endpoints for generating and iterating on videos:\n",
+ "\n",
+ "- **Create video** — `POST /v1/videos` \n",
+ " Generate a new video from a prompt.\n",
+ "\n",
+ "- **Create character** — `POST /v1/videos/characters` \n",
+ " Upload a short reference clip to create a reusable character for generation.\n",
+ "\n",
+ "- **Extend video** — `POST /v1/videos/extensions` \n",
+ " Continue an existing video. The full original clip is used as context.\n",
+ "\n",
+ "- **Edit video** — `POST /v1/videos/{video_id}/edits` \n",
+ " Edit an existing video with a new prompt."
+ ]
+ },
{
"cell_type": "markdown",
"id": "7d879cb4",
@@ -325,15 +359,69 @@
"id": "a54a3522",
"metadata": {},
"source": [
- "## Iterate with the remix functionality\n",
- "Remix is for nudging, not gambling. Use it to make controlled changes – one at a time – and say what you’re changing: “same shot, switch to 85 mm,” or “same lighting, new palette: teal, sand, rust.” When a result is close, pin it as a reference and describe only the tweak. That way, everything that already works stays locked.\n",
+ "## Iterate with video edits\n",
+ "Editing is for nudging, not gambling. Use it to make controlled changes – one at a time – and say what you’re changing: “same shot, switch to 85 mm,” or “same lighting, new palette: teal, sand, rust.” When a result is close, pin it as a reference and describe only the tweak. That way, everything that already works stays locked.\n",
"\n",
"If a shot keeps misfiring, strip it back: freeze the camera, simplify the action, clear the background. Once it works, layer additional complexity step by step.\n",
"\n",
- "| Original Video | Remix Generated Video |\n",
+ "| Original Video | Edited Video |\n",
"| --- | --- |\n",
- "| ![Original Video 1](https://cdn.openai.com/API/docs/images/sora/sora_monster_original.gif)<p><small>Original Video</small></p> | ![Remixed Video 1](https://cdn.openai.com/API/docs/images/sora/sora_monster_orange.gif)<p><small>_Prompt: “Change the color of the monster to orange”_</small></p> |\n",
- "| ![Original Video 1](https://cdn.openai.com/API/docs/images/sora/sora_monster_original.gif)<p><small>Original Video</small></p> | ![Remixed Video 2](https://cdn.openai.com/API/docs/images/sora/sora_monster_2monsters.gif)<p><small>_Prompt: “A second monster comes out right after”_</small></p> |"
+ "| ![Original Video 1](https://cdn.openai.com/API/docs/images/sora/sora_monster_original.gif)<p><small>Original Video</small></p> | ![Edited Video 1](https://cdn.openai.com/API/docs/images/sora/sora_monster_orange.gif)<p><small>_Edit prompt: \"Change the color of the monster to orange\"_</small></p> |\n",
+ "| ![Original Video 1](https://cdn.openai.com/API/docs/images/sora/sora_monster_original.gif)<p><small>Original Video</small></p> | ![Edited Video 2](https://cdn.openai.com/API/docs/images/sora/sora_monster_2monsters.gif)<p><small>_Edit prompt: \"A second monster comes out right after\"_</small></p> |"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9fbc5217",
+ "metadata": {},
+ "source": [
+ "## Characters\n",
+ "\n",
+ "The Characters API lets you create reusable characters from short reference videos. Once created, a character can be reused in future generations to keep appearance and on-screen identity consistent. You can create characters out of any animals or objects. \n",
+ "\n",
+ "### Create a character\n",
+ "Upload a short reference clip to create a character. Requirements:\n",
+ "- MP4 video\n",
+ "- 2–4 seconds\n",
+ "- 720p–1080p resolution\n",
+ "- 16:9 or 9:16 aspect ratio\n",
+ "\n",
+ "### Generate using a character\n",
+ "When creating a video, include the character ID and refer to the character by name in the prompt. We recommend no more than 2 characters per generation.\n",
+ "\n",
+ "```bash\n",
+ "{\n",
+ " \"model\": \"sora-2\",\n",
+ " \"prompt\": \"A cinematic shot of Alfie running through wet grass at sunrise\",\n",
+ " \"size\": \"720x1280\",\n",
+ " \"seconds\": \"4\",\n",
+ " \"characters\": [\n",
+ " { \"id\": \"char_123\" }\n",
+ " ]\n",
+ "}\n",
+ "```\n",
+ "Below are three generated GIF examples using an uploaded character of a dog named Alfie. The leftmost video is the original reference used to create the character"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "406b9389",
+ "metadata": {},
+ "source": [
+ "| Input character video | Generation 1 | Generation 2 | Generation 3 |\n",
+ "| --- | --- | --- | --- |\n",
+ "| <img src=\"gifs/alfie1.gif\" width=\"220\"> | <img src=\"gifs/alfie_museum.gif\" width=\"220\"> | <img src=\"gifs/alfie_f1.gif\" width=\"220\"> | <img src=\"gifs/alfie_tokyo.gif\" width=\"220\"> |"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c50d5e79",
+ "metadata": {},
+ "source": [
+ "## Extend a video\n",
+ "\n",
+ "You can extend an existing video by generating an additional segment. The model uses the full original clip as context, which helps maintain scene continuity. This is useful for building longer sequences from shorter clips. Individual extensions of up to 20 seconds are supported. A video can be extended up to 6 times, for a total of 120s.\n",
+ "\n"
]
},
{
diff --git a/registry.yaml b/registry.yaml
index 3e6ac948..2e7bfe6e 100644
--- a/registry.yaml
+++ b/registry.yaml
@@ -134,6 +134,7 @@
authors:
- rkoenig-openai
- joanneshin-openai
+ - annikab-oai
tags:
- sora
- prompt