<!-- https://bobabanana.com/ai-video-generation-api/ - AI video generation API for developers and AI agents: image-to-video, motion transfer, consistent characters, lip sync and SFX via REST and webhooks. -->

# AI video generation API for developers and AI agents

**The BobaBanana AI video generation API is a REST API at `https://bobabanana.com/api/v1` that turns a start frame, or a prompt with labeled reference images or library `@handles`, into a video of 2 to 10 seconds at standard quality or 3 to 15 seconds at 1080p and 4K, with optional lip-synced speech in a cloned or saved voice or your own audio (standard quality), or a generated sound effect.** It can also copy the motion of your own clip onto a character (motion transfer, as long as the clip: 1 to 15 seconds) or continue a clip from its last frame (extend). Every call returns an async job that you collect by long-polling or a signed webhook.

The same API also generates images, speech and sound effects. It is built for apps that need media generation behind an HTTP call, and for AI agents that need a tool with predictable JSON in and out.

## Key takeaways

- **Five endpoints** cover images, videos, speech, sound effects and file uploads.
- Keep subjects consistent with **up to 10 labeled reference images** or **`@handles`** from your library.
- Videos run **2 to 10 seconds** at standard quality and **3 to 15 seconds** at 1080p and 4K, with optional **lip sync** or your own audio (standard quality), or a sound effect.
- **Motion transfer** puts your character into the motion of a 1-15 second clip; **extend** continues a clip of up to 15 seconds.
- All generation is **asynchronous**: long-poll with `?wait=30` or receive **signed webhooks**.

## What can you build with an AI video generation API?

1. **Image-to-video.** Animate an existing picture with a motion prompt.
2. **Prompt-to-video with consistent subjects.** Describe a scene with references; BobaBanana makes the first frame and animates it.
3. **First and last frame.** Pass `image` and `last_frame` to move from one picture to the other.
4. **Talking characters.** Add a voice and a script, and the character speaks with lip sync.
5. **Audio-driven clips.** Supply your own speech or soundtrack.
6. **Motion transfer.** Send a 1-15 second `motion_video` and a picture or library character, and the subject performs the clip's motion. By default it is first redrawn in the clip's poses, and the video keeps the clip's sound when it has any.
7. **Extend, 1080p and 4K.** Continue a clip of up to 15 seconds from its last frame with `extend_video`, or set `resolution` for 16:9 or 9:16 clips of 3 to 15 seconds.
8. **Product videos.** Animate a [product shot](https://bobabanana.com/ai-product-photo-generator/) and mix in a sound effect.

## What you get: endpoints at a glance

| Method | Path | What it does |
|---|---|---|
| `POST` | `/v1/files` | Upload a reference image or voice/audio file |
| `POST` | `/v1/images` | Generate an image from a prompt plus up to 10 labeled references or `@handles` |
| `POST` | `/v1/videos` | Generate a video from a start frame or a generated frame, with optional lip sync, own audio or sound effect; or transfer a clip's motion, or extend a clip |
| `POST` | `/v1/speech` | Speak text in a cloned or saved voice |
| `POST` | `/v1/sound-effects` | Generate a 2 to 20 s sound effect from text |
| `GET` | `/v1/jobs/{id}` | Job status and results; `?wait=30` long-polls |

### Video sizes

The sizes below are for standard quality (`720p`). `1080p` and `2160p` (4K) videos are made in 16:9 or 9:16 only.

| `aspect_ratio` | Video size |
|---|---|
| 16:9 | 832x480 |
| 9:16 | 480x832 |
| 1:1 | 640x640 |
| 4:3 | 768x576 |
| 3:4 | 576x768 |

## How the API works

1. **Send a request** with your API key as a Bearer token. Inputs can be uploaded files, public `https://` URLs or base64 data.
2. **Get a job back right away,** with an ID and status `queued`.
3. **Rendering runs** in the BobaBanana studio, with busy-time rendering when it is busy. 1080p and 4K always use premium rendering, motion transfer uses it when the studio cannot make the clip, and videos with a last frame try it first. This needs "Make work quickly at busy times" on in the workspace's Settings, plus "Make work that shows people quickly at busy times" when people are shown (premium motion transfer always needs both).
4. **Collect the result** by long-polling or a signed webhook (below).
5. **Download** the output from the signed result URL when the status is `succeeded`.

## A curl example: consistent character to video

One job makes a first frame from a labeled reference and animates it:

```bash
curl https://bobabanana.com/api/v1/videos \
  -H "Authorization: Bearer $BOBABANANA_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: storyboard-shot-01" \
  -d '{
    "prompt": "Maya stands at a bus stop in the rain holding a red umbrella",
    "reference_images": [{"url": "https://example.com/maya.jpg", "label": "Maya, curly red hair, green raincoat"}],
    "motion": "she looks up at the sky and smiles, rain falling",
    "aspect_ratio": "9:16",
    "duration_seconds": 5,
    "sound_effect": {"prompt": "steady rain on pavement, distant traffic", "duration_seconds": 5}
  }'
```

Then call `GET /v1/jobs/JOB_ID?wait=30` until `status` is `succeeded`, `failed` or `canceled`. The [quickstart](https://bobabanana.com/docs/api/quickstart/) walks through the same flow in curl, Python and JavaScript.

## Async jobs, webhooks and long-polling

- **Long-poll.** `GET /v1/jobs/{id}?wait=30` returns when the job finishes, or after 30 seconds with the current status.
- **Signed webhooks.** Pass a `webhook_url` and BobaBanana posts the finished job to it, signed.
- **Idempotency keys.** An `Idempotency-Key` header stops a retried request from creating a duplicate job.

## Using the video API as an AI agent tool

Inputs accept URLs, outputs are signed URLs, and errors say how to fix the request, so an agent can chain jobs: generate an image, pass its URL as the video's `image`, then wait.

Machine-readable resources:

| Resource | Where |
|---|---|
| OpenAPI spec | `/docs/openapi.json` |
| llms.txt | `/docs/llms.txt` |
| Agent tool definitions | [/docs/api/agents/](https://bobabanana.com/docs/api/agents/) |

## Frequently asked questions

### Does the AI video generation API support image-to-video and text-to-video?
Yes. Pass `image` to animate a picture, or pass `prompt` with optional references and BobaBanana generates the first frame, then animates it. Send `motion_video` for motion transfer, or `extend_video` to continue a clip.

### How do I keep the same character across API calls?
Pass the same labeled reference images, or an approved library asset by `@handle`, in each request.

### Can API videos include speech with lip sync?
Yes, at standard quality. Send a voice (a saved `@handle`, or a sample uploaded with consent) and a script, and the character speaks with lip sync. Details are in the [video API docs](https://bobabanana.com/docs/api/videos/).

### How long can an API video be?
2 to 10 seconds at standard quality and 3 to 15 seconds at 1080p and 4K. A motion transfer is as long as your clip, up to 15 seconds. For longer pieces, make several clips and join them.

### How do I get an API key?
The API is in early access. Keys are created in a BobaBanana workspace. [Request early access](https://bobabanana.com/contact/) if you do not have one.

## Get started with BobaBanana

1. [Request early access](https://bobabanana.com/contact/) or [open the studio](https://bobabanana.com/app/) and create an API key.
2. Follow the [quickstart](https://bobabanana.com/docs/api/quickstart/) to run your first image and video job.
3. Read the full [API docs](https://bobabanana.com/docs/api/) and wire up webhooks for production.
