Sora 2 API

Sora 2 is available as standard and Pro variants for narrative video, musical scenes, and reference-guided video generation.

Model keys

  • openai/sora-2 — Sora 2
  • openai/sora-2-pro — Sora 2 Pro

Supported modes and inputs

Model Mode Label Input requirements
openai/sora-2 text_to_video Text to Video Prompt max 2000 chars
openai/sora-2 reference_to_video Reference to Video Prompt max 2000 chars
Images reference: 1-1 files, 10 MB, formats jpg, png, webp, jpeg
openai/sora-2-pro text_to_video Text to Video Prompt max 2000 chars
openai/sora-2-pro reference_to_video Reference to Video Prompt max 2000 chars
Images reference: 1-1 files, 10 MB, formats jpg, png, webp, jpeg

Options

Model Option Default Allowed values Applies to
openai/sora-2 duration 4s 4s, 8s, 12s All modes
openai/sora-2 aspect_ratio landscape landscape, portrait All modes
openai/sora-2-pro duration 4s 4s, 8s, 12s All modes
openai/sora-2-pro aspect_ratio landscape landscape, portrait All modes
openai/sora-2-pro resolution standard standard, high All modes

Pricing

Model Pricing
openai/sora-2 6 credits per second
openai/sora-2-pro 14 credits per second; option multipliers: resolution={"high":2,"standard":1}

Production guidance

  • Pass mode explicitly.
  • Use only option values listed above.
  • Upload media with POST /api/v1/files before calling media-input modes.
  • Use the exact model key for the variant you want.

Example: text to video

curl https://img2vid.net/api/v1/generations \
  -H "Authorization: Bearer $BUBLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/sora-2",
    "mode": "text_to_video",
    "prompt": "A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion",
    "duration": "4s",
    "aspect_ratio": "landscape"
  }'

Example: media-guided video

curl https://img2vid.net/api/v1/generations \
  -H "Authorization: Bearer $BUBLE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/sora-2",
    "mode": "reference_to_video",
    "prompt": "Animate the source into a polished cinematic motion shot with natural camera movement",
    "image_urls": ["https://example.com/reference.png"],
    "duration": "4s",
    "aspect_ratio": "landscape"
  }'

SDK examples

The examples below use this page's public model key, mode, and parameter values. They assume you have already initialized the SDK client as shown in the Quickstart and imported the required language SDK types. For media-input modes, upload local files first and pass the returned URL through public fields such as image_urls, start_frame, or video_urls.

JavaScript / TypeScript

const task = await buble.generations.create({
  model: 'openai/sora-2',
  mode: 'text_to_video',
  prompt:
    'A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion',
  duration: '4s',
  aspect_ratio: 'landscape',
});

const result = await buble.generations.wait(task.data.id);
console.log(result.data.result?.videos?.[0]?.url);

Python

task = client.generations.create(
    model="openai/sora-2",
    mode="text_to_video",
    prompt="A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion",
    duration="4s",
    aspect_ratio="landscape",
)

result = client.generations.wait(task["data"]["id"])
print(result["data"]["result"]["videos"][0]["url"])

Go

task, err := client.Generations.Create(ctx, &buble.CreateGenerationRequest{
	Model:  "openai/sora-2",
	Mode:   "text_to_video",
	Prompt: "A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion",
	Params: map[string]any{
		"duration": "4s",
		"aspect_ratio": "landscape",
	},
})
if err != nil {
	return err
}

result, err := client.Generations.Wait(ctx, task.Data.ID)
if err != nil {
	return err
}
fmt.Println(result.Data.Result.Videos[0].URL)

Rust

let task = client.generations().create(
    CreateGenerationRequest::new("openai/sora-2")
        .mode("text_to_video")
        .prompt("A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion")
        .param("duration", "4s")?
        .param("aspect_ratio", "landscape")?,
).await?;

let result = client
    .generations()
    .wait(&task.data.id, WaitOptions::default())
    .await?;

Swift

let task = try await client.generations.create(
    try CreateGenerationRequest(model: "openai/sora-2")
        .mode("text_to_video")
        .prompt("A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion")
        .param("duration", "4s")
        .param("aspect_ratio", "landscape")
)

let result = try await client.generations.wait(task.data.id)
print(result.data.result?.videos?.first?.url.absoluteString ?? "")

Dart / Flutter

final task = await client.generations.create(
  CreateGenerationRequest(
    model: 'openai/sora-2',
    mode: 'text_to_video',
    prompt: 'A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion',
  ).withParam('duration', '4s').withParam('aspect_ratio', 'landscape'),
);

final result = await client.generations.wait(task.data.id);
print(result.data.result?.videos.firstOrNull?.url);

Elixir

{:ok, task} =
  Buble.Generations.create(client, %{
    model: "openai/sora-2",
    mode: "text_to_video",
    prompt: "A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion",
    duration: "4s",
    aspect_ratio: "landscape"
  })

{:ok, result} = Buble.Generations.wait(client, task["data"]["id"])
IO.puts(result["data"]["result"]["videos"] |> List.first() |> Map.fetch!("url"))

Java

Envelope<GenerationTask> task = client.generations().create(
        CreateGenerationRequest.builder()
                .model("openai/sora-2")
                .mode("text_to_video")
                .prompt("A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion")
                .param("duration", "4s")
                .param("aspect_ratio", "landscape")
                .build());

Envelope<GenerationTask> result = client.generations().wait(task.getData().getId());

.NET

var task = await client.Generations.CreateAsync(new CreateGenerationRequest
{
    Model = "openai/sora-2",
    Mode = "text_to_video",
    Prompt = "A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion"
}.WithParam("duration", "4s").WithParam("aspect_ratio", "landscape"));

var result = await client.Generations.WaitAsync(task!.Data!.Id!);

PHP

$task = $client->generations()->create(
    CreateGenerationRequest::make(
        model: 'openai/sora-2',
        mode: 'text_to_video',
        prompt: 'A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion',
    )
    ->withParam('duration', '4s')
    ->withParam('aspect_ratio', 'landscape')
);

$result = $client->generations()->wait($task['data']['id']);

Ruby

task = client.generations.create(
  model: "openai/sora-2",
  mode: "text_to_video",
  prompt: "A cinematic product launch shot with slow camera movement, premium lighting, and realistic motion",
  duration: "4s",
  aspect_ratio: "landscape"
)

result = client.generations.wait(task.dig("data", "id"))
puts result.dig("data", "result", "videos", 0, "url")