# Picture to video

Make a clip that opens on a picture you give, or moves from one picture to another.

1. [Pick a model that takes your frames](#1-pick-a-model-that-takes-your-frames).
2. [Send the job with a first frame](#2-send-the-job-with-a-first-frame).
3. [Add a last frame for a transition](#3-add-a-last-frame-for-a-transition).
4. [Wait and fetch the clip](#4-wait-and-fetch-the-clip).

## 1. Pick a model that takes your frames

A model's `supported_frame_images` on the video models list names the frames it takes: `first_frame`, `last_frame`, or both. A model takes only the frames it lists. Which models take which, read 2026-09-29: [Choose a video model](/docs/cookbook/choose-a-video-model).

| You have | Pick a model listing |
|---|---|
| one picture the clip opens on | `first_frame` |
| two pictures, the clip moving from one to the other | `first_frame` and `last_frame` |

## 2. Send the job with a first frame

`frame_images` carries the picture and where it goes. The sample opens a 5-second `720p` clip in `16:9` on a picture of sand in golden light, on `alibaba/wan-3.0`, which takes a first frame. The prompt says what happens after that frame.

```python
import json
import os
import urllib.request

API_KEY = os.environ["OPENDUNES_API_KEY"]
ADDRESS = "https://opendunes.com/v1/videos"
MODEL = "alibaba/wan-3.0"
FIRST_FRAME = "https://opendunes.com/hero-dunes.webp"
PROMPT = (
    "The golden haze settles into sand dunes at dusk, wind lifting fine "
    "sand off the crests, slow pan right"
)

request = urllib.request.Request(
    ADDRESS,
    data=json.dumps(
        {
            "model": MODEL,
            "prompt": PROMPT,
            "duration": 5,
            "resolution": "720p",
            "aspect_ratio": "16:9",
            "frame_images": [
                {
                    "type": "image_url",
                    "image_url": {"url": FIRST_FRAME},
                    "frame_type": "first_frame",
                },
            ],
        }
    ).encode(),
    headers={
        "Authorization": "Bearer " + API_KEY,
        "Content-Type": "application/json",
    },
)
with urllib.request.urlopen(request) as response:
    job = json.load(response)

print(job["id"], job["status"])
```

```javascript
const API_KEY = process.env.OPENDUNES_API_KEY;
const ADDRESS = "https://opendunes.com/v1/videos";
const MODEL = "alibaba/wan-3.0";
const FIRST_FRAME = "https://opendunes.com/hero-dunes.webp";
const PROMPT =
  "The golden haze settles into sand dunes at dusk, wind lifting fine " +
  "sand off the crests, slow pan right";

const response = await fetch(ADDRESS, {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: MODEL,
    prompt: PROMPT,
    duration: 5,
    resolution: "720p",
    aspect_ratio: "16:9",
    frame_images: [
      {
        type: "image_url",
        image_url: { url: FIRST_FRAME },
        frame_type: "first_frame",
      },
    ],
  }),
});
const job = await response.json();

console.log(job.id, job.status);
```

```go
package main

import (
	"bytes"
	"encoding/json"
	"fmt"
	"net/http"
	"os"
)

const (
	address    = "https://opendunes.com/v1/videos"
	model      = "alibaba/wan-3.0"
	firstFrame = "https://opendunes.com/hero-dunes.webp"
	prompt     = "The golden haze settles into sand dunes at dusk, wind " +
		"lifting fine sand off the crests, slow pan right"
)

func main() {
	apiKey := os.Getenv("OPENDUNES_API_KEY")

	body, err := json.Marshal(map[string]any{
		"model":        model,
		"prompt":       prompt,
		"duration":     5,
		"resolution":   "720p",
		"aspect_ratio": "16:9",
		"frame_images": []map[string]any{
			{
				"type":       "image_url",
				"image_url":  map[string]string{"url": firstFrame},
				"frame_type": "first_frame",
			},
		},
	})
	if err != nil {
		panic(err)
	}

	req, err := http.NewRequest("POST", address, bytes.NewReader(body))
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer "+apiKey)
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	var job struct {
		ID     string `json:"id"`
		Status string `json:"status"`
	}
	if err := json.NewDecoder(res.Body).Decode(&job); err != nil {
		panic(err)
	}
	fmt.Println(job.ID, job.Status)
}
```

```bash cURL
ADDRESS="https://opendunes.com/v1/videos"
MODEL="alibaba/wan-3.0"
FIRST_FRAME="https://opendunes.com/hero-dunes.webp"
PROMPT="The golden haze settles into sand dunes at dusk, wind lifting fine"
PROMPT="$PROMPT sand off the crests, slow pan right"

curl "$ADDRESS" \
  -H "Authorization: Bearer $OPENDUNES_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "'"$MODEL"'",
    "prompt": "'"$PROMPT"'",
    "duration": 5,
    "resolution": "720p",
    "aspect_ratio": "16:9",
    "frame_images": [
      {
        "type": "image_url",
        "image_url": {"url": "'"$FIRST_FRAME"'"},
        "frame_type": "first_frame"
      }
    ]
  }'
```

| In each `frame_images` entry | Holds |
|---|---|
| `type` | `image_url` for a picture at an address, `file` for a picture you stored |
| `image_url.url` | the picture's address: public HTTPS, answering with the picture itself |
| `file.file_id` | the ID of a picture stored in [Files and storage](/docs/files-and-storage) |
| `frame_type` | `first_frame` or `last_frame`: where the picture goes |

The answer is `202`, with the job's `id` and `status` `pending`. `prompt` may be left out when the picture carries the whole request. Every field: [Clips](/docs/reference/videos).

<div class="watch-out">
<p>A frame takes the picture only from a model that lists that frame. Check <code>supported_frame_images</code> before you send a <code>last_frame</code>: <code>alibaba/wan-3.0</code> lists <code>first_frame</code> alone.</p>
</div>

## 3. Add a last frame for a transition

With a first and a last frame, the model makes the motion between them. Send two entries to a model that lists both, such as `bytedance/seedance-2.0-fast`: the second can be a picture you stored, by its `file_id`. The body, with your two pictures in place of `…`:

```json
{
  "model": "bytedance/seedance-2.0-fast",
  "prompt": "The shop's shutter rolls up on a morning in Oran",
  "duration": 5,
  "resolution": "720p",
  "aspect_ratio": "16:9",
  "frame_images": [
    {
      "type": "image_url",
      "image_url": {"url": "https://…/shutter-down.jpg"},
      "frame_type": "first_frame"
    },
    {
      "type": "file",
      "file": {"file_id": "file_…"},
      "frame_type": "last_frame"
    }
  ]
}
```

At most two entries: one first frame, one last. A `file_id` that is not yours, has expired, or is not a picture gets a 422, and no job is made.

<div class="good-to-know">
<p>A frame fixes the picture exactly. To guide the look of a clip without fixing a frame, send pictures in <code>input_references</code>: <a href="/docs/cookbook/reference-pictures">Reference pictures</a>. When both are sent, <code>frame_images</code> wins.</p>
</div>

## 4. Wait and fetch the clip

Ask [`GET /v1/videos/{id}`](/docs/reference/videos-id) every ten seconds until the job ends, then fetch the clip from `/v1/videos/{id}/content?index=0` with your API key. The whole loop, in four languages: [Text to video](/docs/cookbook/text-to-video). To have the end posted to you instead: [Video webhooks](/docs/cookbook/video-webhooks).

The clip is charged in DA once, when the job reports `completed`. On some models a clip from a picture has its own rate, and on others each picture sent in is charged: the model's page in *Models* lists what it charges for. A job that ends `failed`, `cancelled` or `expired` charges nothing.
