# BobaBanana API documentation (full text) Source: https://bobabanana.com/docs/api/ · Updated 2026-12-02 --- # BobaBanana API: generate consistent images, videos and voices from references **The BobaBanana API is a REST API that turns reference images and reference voices into new images, videos, speech and sound effects, keeping characters, products and places consistent from one result to the next.** Send a prompt plus up to 10 reference pictures and get an image. Send a start frame, or let BobaBanana make one, and get a video. Add a voice sample and a script, and the character speaks with lip sync. It is built for two kinds of callers: **apps** that need media generation behind a simple HTTP call, and **AI agents** (LLM agents and assistants with tool use) that need a tool with predictable JSON in and out. - **Base URL:** `https://bobabanana.com/api/v1` - **Auth:** `Authorization: Bearer bb_...` ([how to get a key](https://bobabanana.com/docs/api/authentication/)) - **Format:** JSON in, JSON out; every generation is an asynchronous [job](https://bobabanana.com/docs/api/jobs/) - **Machine-readable:** [OpenAPI 3.1 spec](https://bobabanana.com/docs/openapi.json) · [llms.txt](https://bobabanana.com/docs/llms.txt) · [llms-full.txt](https://bobabanana.com/docs/llms-full.txt) ## What you can build with the BobaBanana API 1. **Reference-consistent image generation.** Keep the same face, outfit, product or room across many pictures by passing reference images. [Image API →](https://bobabanana.com/docs/api/images/) 2. **Video in four modes.** Image to video (optional last frame), text to video (optionally with references), motion transfer and extend: 2 to 10 seconds at standard quality, 3 to 15 at 1080p and 4K; a motion transfer is as long as its clip (1 to 15 seconds). [Video API →](https://bobabanana.com/docs/api/videos/) 3. **Text to video, motion transfer and extend.** Describe a scene with references and BobaBanana generates the first frame and animates it in one job; copy the movement of a 1 to 15 second clip onto a picture or library character; or continue an uploaded clip of up to 15 seconds from its last frame. 4. **Talking videos with a cloned voice.** Upload 5 to 30 seconds of a voice, write a script, and get a lip-synced talking clip. 5. **Audio-driven video.** Supply your own speech or soundtrack and the clip is driven by it. 6. **Voice cloning and text-to-speech.** Turn a short sample into new speech in that voice. [Speech API →](https://bobabanana.com/docs/api/speech/) 7. **Sound effects from text.** "Rain on a tin roof with distant thunder", 2 to 20 seconds. [Sound effects →](https://bobabanana.com/docs/api/sound-effects/) 8. **Reusable library assets.** Reference approved characters, objects, places and voices from your BobaBanana workspace by `@handle`. [Assets →](https://bobabanana.com/docs/api/assets/) ## 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 and references | | `POST` | `/v1/videos` | Generate a video (start frame or generated frame, optional last frame, motion transfer, extend; optional voice, audio, sound effect) | | `POST` | `/v1/videos/estimate` | Price a motion transfer before you send it: its scenes, price multiplier and credits | | `POST` | `/v1/speech` | Speak text in a saved or cloned voice | | `POST` | `/v1/sound-effects` | Generate a sound effect from text | | `GET` | `/v1/jobs/{id}` | Job status and result URLs (`?wait=30` long-polls) | | `GET` | `/v1/jobs` | List your jobs | | `POST` | `/v1/jobs/{id}/upscale` | [Upscale](https://bobabanana.com/docs/api/upscale/) a finished image or video job (2x, 2.25x, 4x) | | `GET` | `/v1/jobs/{id}/upscale-options` | The sizes a job can be upscaled to, with prices | | `POST` | `/v1/jobs/{id}/cancel` | Cancel a job | | `DELETE` | `/v1/jobs/{id}` | Delete a finished job and its results | | `POST` | `/v1/jobs/{id}/webhook/replay` | Send a finished job's webhook again | | `GET`, `DELETE` | `/v1/files/{id}` | Look up or delete an uploaded file | | `GET` | `/v1/assets`, `/v1/voices` | List approved library assets and voices | | `GET` | `/v1/balance` | Your workspace's credits | | `GET` | `/v1/prices` | What each kind of job costs ([credits](https://bobabanana.com/docs/api/credits/)) | | `GET` | `/v1/status` | Engine availability, your queue, typical durations and prices | ## A first request in 30 seconds ```bash curl https://bobabanana.com/api/v1/images \ -H "Authorization: Bearer $BOBABANANA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "the sofa in a sunlit loft, morning light", "reference_images": [{"url": "https://example.com/sofa.jpg", "label": "a mustard yellow three-seat sofa"}], "aspect_ratio": "16:9" }' ``` The response is a job with `"status": "queued"`. Poll `GET /v1/jobs/{id}?wait=30` or pass a `webhook_url`; when `status` is `succeeded`, download `output.image.url`. The full walkthrough is in the [quickstart](https://bobabanana.com/docs/api/quickstart/). ## How the BobaBanana API works 1. **You send a request.** Inputs can be uploaded files, public `https://` URLs or base64 data. 2. **BobaBanana queues a job** and answers immediately with `202 Accepted` and a job ID. 3. **The studio makes it** in steps: first frame, speech, sound effect, then animation. 4. **You collect the result** by polling, long-polling or a signed webhook. Result links are signed and valid for 24 hours. Jobs made through the API also appear in the BobaBanana studio, so a person can review what an agent created. ## Frequently asked questions ### What is the BobaBanana API? A REST API for generating images, videos, speech and sound effects that stay consistent with the reference images and voices you provide. It is designed for both apps and AI agents. ### Can the API keep the same character across many images and videos? Yes. Pass the same reference images (or a saved library asset by `@handle`) in each request. References are labelled in the prompt, so several characters, products and places can appear together. ### Does it support image-to-video and text-to-video? Both. Give `image` to animate an existing picture, or give `prompt` plus optional references and BobaBanana generates the first frame, then animates it. `/v1/videos` also does motion transfer (`motion_video`) and extends a clip (`extend_video`). ### Can a video speak with a cloned voice? Yes. Send `voice` (a 5 to 30 second sample, with `voice_consent: true`) and a `script`. The speech is generated in that voice and the video is lip-synced to it. ### Is there an OpenAPI spec for agents and code generators? Yes, at [https://bobabanana.com/docs/openapi.json](https://bobabanana.com/docs/openapi.json) (also served live at `/api/v1/openapi.json`). The [agents guide](https://bobabanana.com/docs/api/agents/) has ready-made tool definitions. ### How long does a job take? Typically one to three minutes for an image, under a minute for speech or a sound effect, and several minutes for a video. `GET /v1/status` reports current typical durations, and each queued job carries an `eta_seconds` estimate. ### How do I get an API key? API access is in early access. Keys are created in a BobaBanana workspace under **Settings → API keys**. See [authentication](https://bobabanana.com/docs/api/authentication/). --- # BobaBanana API quickstart: your first image and video **This quickstart takes you from an API key to a finished image and a finished video in five steps, using curl, Python or JavaScript.** Every generation call returns a job immediately; you then wait for it and download the result. ## What you need before you start - An API key that starts with `bb_` ([get one](https://bobabanana.com/docs/api/authentication/)) - One reference picture, for example a product photo or a character portrait - `curl`, Python 3.9+ with `requests`, or Node 18+ (built-in `fetch`) ```bash export BOBABANANA_API_KEY="bb_your_key_here" ``` ## Step 1: upload a reference image ```bash curl https://bobabanana.com/api/v1/files \ -H "Authorization: Bearer $BOBABANANA_API_KEY" \ -F "file=@sofa.jpg" ``` ```json {"id": "file_3f9c2a1b7d4e", "object": "file", "type": "image", "name": "sofa.jpg", "bytes": 912345, "width": 1600, "height": 1200, "warnings": []} ``` You can skip uploading and pass a public `https://` URL or base64 data directly in the next step. Uploading first is best when you reuse the same reference in many requests. ## Step 2: generate an image with the reference ```bash curl https://bobabanana.com/api/v1/images \ -H "Authorization: Bearer $BOBABANANA_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "the sofa in a bright Scandinavian living room, plants, morning light", "reference_images": [{"file_id": "file_3f9c2a1b7d4e", "label": "a mustard yellow three-seat sofa with oak legs"}], "aspect_ratio": "16:9" }' ``` ```json {"id": "x_8d21c0f4a9b3", "object": "job", "type": "image", "status": "queued", "eta_seconds": 140, "poll_after_seconds": 35, "output": {}, "error": null} ``` ## Step 3: wait for the job Long-poll: the call returns as soon as the job finishes, or after 30 seconds with the current status. ```bash curl "https://bobabanana.com/api/v1/jobs/x_8d21c0f4a9b3?wait=30" \ -H "Authorization: Bearer $BOBABANANA_API_KEY" ``` Repeat until `status` is `succeeded`, `failed` or `canceled`. For production, use a [webhook](https://bobabanana.com/docs/api/webhooks/) instead. ## Step 4: download the result ```json {"id": "x_8d21c0f4a9b3", "status": "succeeded", "output": {"image": {"url": "https://bobabanana.com/api/v1/files/content/out/...png?expires=...&signature=...", "content_type": "image/png"}}} ``` Result URLs are signed and need no API key, so you can hand them to a browser or another service. They expire after 24 hours; fetch the job again for a fresh link, and store files you want to keep. ## Step 5: animate it into a video ```bash curl https://bobabanana.com/api/v1/videos \ -H "Authorization: Bearer $BOBABANANA_API_KEY" \ -H "Content-Type: application/json" \ -d '{"image": "https://example.com/living-room.png", "motion": "slow dolly-in toward the sofa, curtains moving in a breeze", "duration_seconds": 5}' ``` ## Complete example in Python ```python import os, time, requests API = "https://bobabanana.com/api/v1" H = {"Authorization": f"Bearer {os.environ['BOBABANANA_API_KEY']}"} def wait(job): while job["status"] in ("queued", "running"): job = requests.get(f"{API}/jobs/{job['id']}", params={"wait": 30}, headers=H).json() if job["status"] != "succeeded": raise RuntimeError(job["error"]) return job ref = requests.post(f"{API}/files", headers=H, files={"file": open("sofa.jpg", "rb")}).json() img = wait(requests.post(f"{API}/images", headers=H, json={ "prompt": "the sofa in a bright Scandinavian living room", "reference_images": [{"file_id": ref["id"], "label": "a mustard yellow sofa"}], }).json()) vid = wait(requests.post(f"{API}/videos", headers=H, json={ "image": img["output"]["image"]["url"], "motion": "slow dolly-in", "duration_seconds": 5, }).json()) open("living-room.mp4", "wb").write(requests.get(vid["output"]["video"]["url"]).content) ``` ## Complete example in JavaScript (Node 18+) ```javascript const API = "https://bobabanana.com/api/v1"; const H = { Authorization: `Bearer ${process.env.BOBABANANA_API_KEY}`, "Content-Type": "application/json" }; async function wait(job) { while (job.status === "queued" || job.status === "running") { job = await (await fetch(`${API}/jobs/${job.id}?wait=30`, { headers: H })).json(); } if (job.status !== "succeeded") throw new Error(job.error?.message); return job; } const job = await (await fetch(`${API}/images`, { method: "POST", headers: H, body: JSON.stringify({ prompt: "a fox mascot with aviator goggles waving", aspect_ratio: "1:1" }), })).json(); const done = await wait(job); console.log(done.output.image.url); ``` ## Next steps - [Generate images with several references](https://bobabanana.com/docs/api/images/) - [Make talking videos with a cloned voice](https://bobabanana.com/docs/api/videos/) - [Give an AI agent BobaBanana as a tool](https://bobabanana.com/docs/api/agents/) --- # BobaBanana API authentication and API keys **Every BobaBanana API request is authenticated with a secret API key sent as a bearer token: `Authorization: Bearer bb_...`.** A key belongs to one workspace, spends that workspace's [credits](https://bobabanana.com/docs/api/credits/), is shown once, and can be revoked at any time. ## How to get an API key 1. Sign in to your BobaBanana workspace at `https://bobabanana.com/app/`. 2. Open **Settings → API keys**. 3. Type a name (for example "Video agent") and choose **Make API key**. 4. Copy the key immediately. It is shown only once; BobaBanana stores only a hash of it. 5. Copy the **webhook signing secret** too if you will use [webhooks](https://bobabanana.com/docs/api/webhooks/). A workspace can have up to 5 live keys; revoke one to make room. Making a key asks you to confirm your password. BobaBanana is invite-only: request access at `https://bobabanana.com/app/request-access`. Once approved you get your own workspace with welcome credits. ## Sending the key ```bash curl https://bobabanana.com/api/v1/status -H "Authorization: Bearer bb_your_key_here" ``` The header `X-API-Key: bb_your_key_here` is accepted as an alternative for tools that cannot set `Authorization`. Send a `User-Agent` that names your app, for example `User-Agent: my-app/1.0`. Python's built-in `urllib` sends a default one (`Python-urllib/3.x`) that is refused with a plain-text `403` reading `error code: 1010`; `requests`, `httpx`, Node, Go and curl work as they are. ## Limits on each key | Limit | Default | What happens when reached | |---|---|---| | Jobs per rolling 24 hours (deleted jobs still count) | 200 | `429 daily_limit_reached`, `Retry-After: 3600` | | Unfinished jobs at once | 10 | `429 too_many_active_jobs`, `Retry-After: 30` | | Reference pictures per request | 10 | `400 too_many_references` | | Image upload size | 25 MB | `400 file_too_large` | | Audio upload size | 60 MB | `400 file_too_large` | The workspace owner can change the per-key limits. ## What a key can and cannot see - A key sees only its own workspace. IDs from any other workspace return `404`, exactly like IDs that do not exist. - **Jobs** are private to the key that made them; another key of the same workspace gets `404`. - **Uploaded files** are shared by every key of the workspace, so one key can upload and another can use the `file_id`. - A key can **use** the workspace's approved library assets and voices by `@handle` ([assets](https://bobabanana.com/docs/api/assets/)), but cannot change them. - If the workspace is suspended, every request gets `403 workspace_suspended`. - Result download links are signed separately and work without a key for 24 hours, so treat them like private links. ## Keeping keys safe: best practices 1. **Keep keys on the server.** Do not ship a key in a mobile app or public web page; call BobaBanana from your backend. 2. **Use one key per app or agent**, so you can revoke one without breaking the others. 3. **Store keys in environment variables or a secret manager**, never in source control. 4. **Revoke a leaked key at once** in Settings → API keys. Queued jobs still finish, but their webhooks are no longer sent; new requests are refused with `401 invalid_api_key`. ## Frequently asked questions ### Do API keys expire? No. A key works until it is revoked. ### Can I use the API from a browser? CORS is enabled so you can, but anyone who opens the page can read the key. Use a server-side proxy for public sites. ### What does a 401 mean? `missing_api_key` means no key was sent; `invalid_api_key` means the key is wrong or revoked. --- # Image generation API with reference images **`POST /v1/images` creates a new picture from a text prompt and up to 10 reference images, keeping the people, products and places in those references recognisably the same.** Each reference can carry a short label so the model knows which picture is which, which is what makes multi-subject scenes work. ## When to use reference-based image generation - **Character consistency:** the same person or mascot in new poses, outfits and settings. - **Product shots:** your exact product, label and colour in lifestyle scenes. - **Interior and place continuity:** the same room or location from a new angle or at a new time of day. - **Composite scenes:** several characters, objects and a place combined into one coherent picture. - **Storyboards:** a series of frames that keep one cast, ready to animate with the [video API](https://bobabanana.com/docs/api/videos/). ## Request ```http POST https://bobabanana.com/api/v1/images Authorization: Bearer bb_... Content-Type: application/json ``` | Field | Type | Required | Description | |---|---|---|---| | `prompt` | string, up to 1500 chars | yes | What to create | | `reference_images` | array of [media inputs](https://bobabanana.com/docs/api/files/#media-inputs) | no | Pictures to keep consistent. Each may have a `label` | | `assets` | array of strings | no | Approved library assets by handle, e.g. `["@maya", "@red_sofa"]` | | `aspect_ratio` | `16:9`, `9:16`, `1:1`, `4:3`, `3:4` | no | Default `16:9` | | `webhook_url` | https URL | no | Receives a signed POST when the job finishes | | `metadata` | object | no | Up to 16 string keys, echoed back on the job | | `name` | string | no | Label shown in the BobaBanana studio | The `Idempotency-Key` header is supported: repeating a request with the same key within 24 hours returns the original job instead of creating a new one. ## Output sizes by aspect ratio | `aspect_ratio` | Size in pixels | |---|---| | `16:9` | 1344 × 768 | | `9:16` | 768 × 1344 | | `1:1` | 1024 × 1024 | | `4:3` | 1152 × 896 | | `3:4` | 896 × 1152 | ## Example: one product, new scene ```bash curl https://bobabanana.com/api/v1/images \ -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \ -d '{ "prompt": "the sneaker on a wet city street at night, neon reflections, low angle", "reference_images": [{"url": "https://example.com/sneaker.png", "label": "a white leather sneaker with a green heel tab"}], "aspect_ratio": "4:3" }' ``` ## Example: several references in one scene ```json { "prompt": "Maya sits on the sofa reading, the floor lamp beside her, evening light", "reference_images": [ {"file_id": "file_a1", "label": "Maya, a woman in her thirties with curly red hair"}, {"file_id": "file_b2", "label": "a mustard yellow three-seat sofa"}, {"file_id": "file_c3", "label": "a brass arc floor lamp"} ], "aspect_ratio": "16:9" } ``` BobaBanana tells the model "Picture 1 is Maya…, Picture 2 is a mustard yellow sofa…" before your prompt and asks it to keep every referenced subject exactly as pictured. ## Example: library assets by @handle ```json {"prompt": "@maya walking her dog through an autumn park", "assets": ["@maya"], "aspect_ratio": "9:16"} ``` A character asset from the library brings its approved face picture and, when available, its full-body picture (it counts as two of the 10 references). See [assets](https://bobabanana.com/docs/api/assets/). ## Response `202 Accepted` with a [job](https://bobabanana.com/docs/api/jobs/). When it succeeds: ```json { "id": "x_8d21c0f4a9b3", "object": "job", "type": "image", "status": "succeeded", "output": {"image": {"url": "https://bobabanana.com/api/v1/files/content/out/...png?expires=...&signature=...", "content_type": "image/png"}}, "error": null } ``` ## Tips for better reference-consistent images 1. **Label every reference** with what it shows and its key details ("navy wool coat with brass buttons"), not just a name. 2. **Use clear, well-lit references** at least 512 px on the short side; the upload response warns about low resolution. 3. **One subject per reference** works better than a crowded photo. 4. **Say what must stay the same** in the prompt ("keep the logo text exactly"). 5. **Reuse the same references** across a series for the most consistent results. ## Frequently asked questions ### How many reference images can I send? Up to 10 per request, counting the pictures brought in by library assets. ### Which image formats are accepted? PNG, JPG, WEBP, GIF and BMP, up to 25 MB. Images over 2048 px on the long side are scaled down. ### Can I generate without any reference? Yes. With no references `POST /v1/images` is plain text-to-image. ### How do I make a series of images with the same character? Send the same reference images (or the same `@handle`) with every request and keep the character description in the labels the same. --- # AI video generation API: image to video, text to video, motion transfer and extend **`POST /v1/videos` makes a video clip in one of four modes, the same as in the Video Studio: Image to video (optionally ending on a last frame you choose), Text to video (optionally with reference images or library assets), Motion transfer and Extend. A clip runs 2 to 10 seconds at `720p` and 3 to 15 at `1080p` and `2160p`; a motion transfer follows its clip (1 to 15 seconds).** Optionally the character speaks a script in a saved or cloned voice with lip sync, the clip follows your own recorded audio, or a generated sound effect is mixed in. With motion transfer, a character or object of yours performs the motion of a clip you send, for as long as the clip (up to 15 seconds). ## Four video modes | Mode | Send | Result | |---|---|---| | **Image to video** | `image` + `motion` | Your picture, animated | | **Image to video with a last frame** | `image` + `last_frame` + `motion` | The clip moves from your picture to the last frame ([example](#example-image-to-video-with-a-last-frame)) | | **Text to video** | `prompt` (+ optional `motion`) | BobaBanana generates a first frame from your prompt, then animates it | | **Text to video with references** | `prompt` + `reference_images` / `assets` + `motion` | A first frame that keeps your characters, objects or places consistent, then animated | | **Motion transfer** | `motion_video` (a 1-15 s clip) + `image` or one entry in `assets` + optional `prompt` | Your subject performs the motion, gestures and camera move of the clip, with the clip's sound when it has any ([details](#motion-transfer)) | | **Extend** | `extend_video` (a clip of 15 s at most) + `prompt` | A new clip that starts on the last frame of yours ([example](#example-extend-a-video)) | Text to video and Extend can also take a `last_frame` to choose how the clip ends. ## Add speech or sound | Add | Send | Result | |---|---|---| | **Cloned voice** | a mode above + `voice` (sample) + `script` + `voice_consent: true` | The character says the script in that voice, lip-synced | | **Saved voice** | a mode above + `voice: "@handle"` + `script` | Same, with a voice from your library | | **Your own audio** | a mode above + `audio` | The clip follows your speech or soundtrack | | **Sound effect** | a mode above + `sound_effect` | A generated sound mixed under the clip | Speech, audio and sound effects work in every mode except motion transfer (which keeps the clip's own sound instead). Speech and audio are not available at `1080p` and `2160p`. ## Request fields | Field | Type | Description | |---|---|---| | `image` | [media input](https://bobabanana.com/docs/api/files/#media-inputs) | Start frame to animate. Leave out to generate one | | `last_frame` | media input | Last frame: the clip ends on this picture. Priced as a first + last frame video | | `motion_video` | media input (`url` or `data`) | [Motion transfer](#motion-transfer): a clip whose motion is copied onto the subject (`image`, or one character or object in `assets`). MP4 or MOV, H.264 or H.265, 1 to 15 s, at most 50 MB (about 25 MB as `data`), 23.976 to 60 fps, each side 256 to 4096 px, width / height between 0.4 and 2.5; `file_id` is not accepted. The video lasts as long as the clip (rounded to whole seconds); `duration_seconds` and `resolution` are ignored. `aspect_ratio` is optional: with `match_pose` the video takes the clip's shape, otherwise `aspect_ratio` or the subject's shape. Not with `last_frame`, `reference_images`, `extend_video`, `voice`, `script`, `audio` or `sound_effect` | | `match_pose` | boolean | Motion transfer only. Default `true`: the subject is first redrawn in the poses, framing and shape of the clip's opening, middle and closing frames (the opening frame only for clips under 2 s), and the video is guided by those pictures. `false` animates your picture as it is | | `keep_sound` | boolean | Motion transfer only. Default `true`: the clip's own sound is put on the result (when the clip has sound) | | `first_shot_only` | boolean | Motion transfer only. Default `false`. When the clip has [cuts](#clips-with-cuts), `true` makes only its first shot, at the normal price of a clip that long; `false` makes every scene and joins them at 1.5 times the price | | `extend_video` | media input (`url` or `data`) | An MP4, MOV or WEBM clip of 15 seconds at most (100 MB by `url`, about 25 MB as `data`). Its last frame becomes the start frame. Not with `image`, `reference_images` or `assets`; `file_id` is not accepted | | `prompt` | string, up to 1500 chars | The scene. Required without `image`; also the motion prompt when `motion` is empty | | `reference_images` | array of media inputs | References for the generated first frame (not with `image`) | | `assets` | array of `@handles` | Library assets for the first frame (not with `image`) | | `motion` | string, up to 400 chars | Camera and subject movement, e.g. "slow push-in, she turns and smiles" | | `duration_seconds` | number, 2 to 15 | Default 5. 2 to 10 at `720p`; 3 to 15 at `1080p` and `2160p` (10 at most with `last_frame`); outside these a 400 `invalid_request`. A started second counts as a whole second | | `aspect_ratio` | `16:9`, `9:16`, `1:1`, `4:3`, `3:4` | Default `16:9`. At `1080p` and `2160p` only `16:9` and `9:16` are made; any other shape is a 400 `invalid_request` | | `resolution` | `720p`, `1080p`, `2160p` | Default `720p` (standard). `1080p` and `2160p` (4K) use premium rendering and cost more; not with `voice`, `script` or `audio` | | `voice` | `"@handle"` or [voice sample](https://bobabanana.com/docs/api/speech/#voice-samples) | Voice that speaks `script` | | `voice_consent` | boolean | Must be `true` with an uploaded voice sample | | `script` | string, up to 600 chars | Words the character says | | `audio` | media input (audio) | Pre-recorded speech or soundtrack that drives the clip (instead of `voice` + `script`) | | `sound_effect` | `{"prompt": "...", "duration_seconds": 8}` | Generated sound mixed under the clip | | `webhook_url`, `metadata`, `name` | | As for [images](https://bobabanana.com/docs/api/images/) | ## Video sizes | `aspect_ratio` | Size in pixels | |---|---| | `16:9` | 832 × 480 | | `9:16` | 480 × 832 | | `1:1` | 640 × 640 | | `4:3` | 768 × 576 | | `3:4` | 576 × 768 | These are the sizes from the BobaBanana studio. When a busy queue sends a video to busy-time rendering, it keeps the same aspect ratio but can come out larger (for example 1024 × 768 for 4:3). A video with `last_frame` (including `extend_video` with `last_frame`) uses premium rendering first, at 768 pixels high in the requested aspect ratio, so it can come out larger than the table above; if that is not available, it is made in the BobaBanana studio. A video with `reference_images` or `assets` is made in the studio and moves to busy-time rendering, at 720 pixels high, only when the queue is long. Either way it costs the same credits. Both need "Make work quickly at busy times" on in the workspace's Settings, and content with people also needs "Make work that shows people quickly at busy times". ## Example: image to video ```bash curl https://bobabanana.com/api/v1/videos \ -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \ -d '{"image": "https://example.com/beach.png", "motion": "waves roll in, camera slowly pans right", "duration_seconds": 6}' ``` ## Example: text to video ```bash curl https://bobabanana.com/api/v1/videos \ -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \ -d '{"prompt": "a lighthouse on a rocky coast at sunset, waves breaking below", "motion": "slow aerial orbit around the lighthouse", "duration_seconds": 5}' ``` BobaBanana generates the first frame from `prompt`, then animates it. The job returns that frame as `output.image`. ## Example: text to video with references ```json { "prompt": "Maya stands at a bus stop in the rain holding a red umbrella", "reference_images": [{"file_id": "file_a1", "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 } ``` ## Example: talking video with a cloned voice and lip sync ```json { "image": {"file_id": "file_portrait"}, "voice": {"file_id": "file_voice", "transcript": "Hi, I'm Sam, and this is how I sound when I talk normally."}, "voice_consent": true, "script": "Welcome back! Today I'll show you three tricks for faster mornings.", "motion": "she talks warmly to the camera with small natural head movements", "duration_seconds": 6, "aspect_ratio": "9:16" } ``` If you leave out `transcript`, BobaBanana transcribes the sample first (adds a few seconds). ## Example: saved voice by @handle plus a sound effect ```json { "prompt": "@captain_fox on the deck of a ship in a storm", "assets": ["@captain_fox"], "voice": "@fox_voice", "script": "Hold steady, crew! The harbour is just past those rocks.", "sound_effect": {"prompt": "howling wind, crashing waves, creaking wood", "duration_seconds": 8}, "duration_seconds": 7 } ``` ## Example: drive the clip with your own audio ```json {"image": "https://example.com/host.png", "audio": "https://example.com/intro.mp3", "motion": "the host speaks to camera", "duration_seconds": 8} ``` ## Example: image to video with a last frame ```bash curl https://bobabanana.com/api/v1/videos \ -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \ -d '{"image": {"file_id": "file_day"}, "last_frame": {"file_id": "file_night"}, "motion": "time-lapse from day to night", "duration_seconds": 6}' ``` The clip starts on `image` and ends on `last_frame`. Use two pictures with the same framing for the smoothest result. ## Example: extend a video ```bash curl https://bobabanana.com/api/v1/videos \ -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \ -d '{"extend_video": {"url": "https://example.com/clip.mp4"}, "prompt": "she keeps walking and turns to the camera", "duration_seconds": 5}' ``` The new clip starts exactly where yours ends. The job's `input.extend_video` shows the extracted frame's `file_id` and the length of your clip (`source_seconds`). A clip longer than 15 seconds, or one that cannot be read, is a 400 `invalid_video`. Join the two clips yourself if you want one longer video. ## 1080p and 4K Set `resolution` to `1080p` or `2160p` for a sharper clip (1080p or 4K), in `16:9` or `9:16`. These always use premium rendering (the workspace needs "Make work quickly at busy times" on in Settings; content with people also needs "Make work that shows people quickly at busy times") and cost more than standard videos. They do not wait in the studio's queue, but premium jobs are sent one at a time across the platform, so a job can still wait its turn. Their price comes from premium rendering's live price when the job is accepted: `cost.credits_estimate` is the most the job can cost and is held when it is accepted, and the job is charged what it really cost once it is done (never more than the estimate). Send `max_credits` to refuse a job that would cost more. The request answers `400 resolution_unavailable` when the resolution cannot be made for the workspace now ("Make work quickly at busy times" off, a person with "Make work that shows people quickly at busy times" off, the workspace's monthly premium spending limit reached). If the live price rises above what the job was accepted at before it renders, or the render fails, the job fails and its credits are released; send it again for a new price. ```bash curl https://bobabanana.com/api/v1/videos -H "Authorization: Bearer $BB_KEY" -H "Content-Type: application/json" \ -d '{"image": "https://example.com/beach.png", "motion": "slow aerial push-in", "resolution": "2160p", "duration_seconds": 8, "max_credits": 900}' ``` ## Motion transfer Send a clip of someone moving (a dance, a gesture, a walk, a camera move) as `motion_video`, and the subject to move as `image` or as one character or object in `assets` (its main view is used). The result is a new video of your subject performing that motion with the clip's timing, framing and camera move, for as long as the clip (1 to 15 seconds). The subject keeps its own face, hair, clothing and proportions; the person in the clip is not copied. ```bash curl https://bobabanana.com/api/v1/videos \ -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \ -d '{"motion_video": {"url": "https://example.com/dance.mp4"}, "assets": ["@captain_fox"], "prompt": "keep the red jacket"}' ``` 1. **Pose match** (`match_pose`, on by default): your subject is redrawn three times, standing exactly like the person in the clip's opening, middle and closing frames: the same pose, position and size in the frame, camera angle, framing and shape, with your subject's own natural proportions. Clips under 2 seconds use the opening frame only. Matching the start, middle and end keeps your character steady through the whole clip and makes the result follow the clip much more closely; turn it off only when your picture already matches the clip's first frame. 2. **Motion:** the clip's motion is applied to your subject, guided by the pose-matched pictures, in the studio when it can make the clip, otherwise with premium rendering (never busy-time rendering). Premium rendering needs both of the workspace's Settings switches, "Make work quickly at busy times" and "Make work that shows people quickly at busy times", whatever the subject is, because the clip usually shows a person. When it cannot be made for the workspace now, the request answers `400 motion_unavailable` with the reason. 3. **Sound** (`keep_sound`, on by default): the clip's own sound is put back on the result. `prompt` (or `motion`) is optional: add details to keep, such as clothing or the background. The job's `input.motion_video.seconds`, `input.duration_seconds`, `input.aspect_ratio`, `input.match_pose`, `input.keep_sound` and `input.keyframes` (how many pose-matched pictures were made first: 3, 1 or 0) show what was made. If the render fails, the job fails and its credits are released. For the best result use a clip with one person, fully in view, on a steady camera, and a subject picture with a similar framing. ### Clips with cuts A clip that cuts between several shots (a tutorial, an edited reel) is recognised automatically when you send it. Quick motion, a hand or a brush passing in front of the lens and on-screen text are not cuts. Each scene is then made on its own, so your subject follows every shot's framing instead of blending them together: 1. every scene gets its own pose-matched pictures, from that scene's own frames (its opening frame, and its middle and closing frames for a scene of 2 seconds or more); 2. every scene's motion is applied to your subject the normal way; 3. the scenes are joined in their original order, each exactly as long as in your clip, under the clip's own sound (with `keep_sound`). Because every scene is matched and made separately, a clip with cuts costs **1.5 times** what one continuous clip of the same length costs, and never less than its scenes cost on their own (several short scenes can cost more than that). The job's `input.scenes` shows `count`, `made`, `scene_seconds`, `price_multiplier`, `first_shot_only` and `reason` (for example "This clip has 3 scenes"); a continuous clip has no `input.scenes`. A clip can have up to **6 scenes**, each at least **1 second** long: every scene needs its own pictures and its own render, and a shorter scene has too little motion to follow. Otherwise the request answers `400 motion_scenes` with the reason (`too_many` or `too_short`), `scenes`, `scene_seconds`, `max_scenes`, `min_scene_seconds` and `first_shot_ok`. Send `first_shot_only: true` to make just the clip's first shot (it must be at least 1 second long), at the normal price of a clip that long; its own sound is kept up to the cut. To see the scenes and the price before you send a job, post the same body to `POST /v1/videos/estimate`. Nothing is queued, held or stored: ```bash curl https://bobabanana.com/api/v1/videos/estimate \ -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \ -d '{"motion_video": {"url": "https://example.com/tutorial.mp4"}, "image": "https://example.com/me.png"}' ``` ```json {"object": "estimate", "credits_estimate": 342, "duration_seconds": 12, "scenes": 3, "scenes_made": 3, "scene_seconds": [4.5, 3.6, 3.9], "price_multiplier": 1.5, "normal_credits": 228, "first_shot_only": false, "reason": "This clip has 3 scenes"} ``` `credits_estimate` is what the job would hold if you sent it now; `normal_credits` is what one continuous clip of the same length costs. A clip whose scenes cannot be made answers `400 motion_scenes`, as the job itself would. ## What a video costs Videos are priced by class, so a plain clip costs less than one that keeps references consistent: | Class | When | Price key (no voice / voice) | |---|---|---| | Plain | `image` or `extend_video` alone, or `prompt` with no references or assets | `video` / `video_voice` | | References | any `reference_images` or `assets` | `video_ref` / `video_voice_ref` | | First + last frame | `last_frame` is given | `video_frames` / `video_voice_frames` | | Motion transfer | `motion_video` is given | `video_motion` | A `1080p` or `2160p` video uses one key per resolution, `video_1080` or `video_2160`, priced from premium rendering's live price (see above) whatever its class. A generated first frame costs an `image` on top. The job's `cost.video_price_key` and `cost.resolution` show the price used, and [`GET /v1/prices`](https://bobabanana.com/docs/api/credits/) lists the current prices. `video_1080` and `video_2160` show `"pricing": "live_quote"` there: their credits are the most they cost at the regular rate, and the job's `cost.credits_estimate` is what it is held at. A motion transfer (`video_motion`) is priced from the length of your clip, plus one `image` for each pose-matched picture when `match_pose` is on (three, or one for a clip under 2 seconds): `cost.credits_estimate` is the most it can cost, and you are charged what it really cost, never more. Clips of 3 seconds or less can be made on a dearer route with a minimum length, so they cost more per second than longer clips. A clip with cuts costs 1.5 times as much, or the normal price with `first_shot_only` ([details](#clips-with-cuts)). `GET /v1/prices` shows `video_motion` with `"pricing": "live_quote"`: its `base_credits` plus `per_second_credits` for each second of the clip is the most any clip of that length costs. Rely on the job's `cost.credits_estimate`. ## How a video job runs 1. **First frame:** skipped when you send `image`; otherwise generated from `prompt` and references. With `last_frame`, the clip is guided to end on that picture. 2. **Speech:** with `voice` + `script`, the line is spoken in that voice (after a transcript step if needed). 3. **Sound effect:** generated if requested. 4. **Animation:** the frame is animated, driven by the speech or `audio` when present. When it succeeds, `output.video.url` is an MP4. A generated first frame is also returned as `output.image`, and generated speech as `output.speech`, so you can reuse them. ## Tips for better AI videos 1. **Describe motion, not the picture**, in `motion`: camera moves, gestures, what changes. 2. **Keep scripts short**: about 2.5 words per second of `duration_seconds`. 3. **Use a front-facing, well-lit portrait** for talking videos. 4. **Use a clean voice sample**: 5 to 30 seconds, one speaker, no music. 5. **Start with 5 seconds** while you iterate, then go longer. ## Frequently asked questions ### How long can a video be? 2 to 10 seconds per job at `720p`, up to 15 at `1080p` and `2160p`, and as long as your clip (up to 15 seconds) for a motion transfer. For longer pieces, generate several clips that share references and join them. ### Does the API support lip sync? Yes. With `voice` + `script`, or with your own `audio`, the character's mouth follows the speech. ### Is voice cloning allowed for any voice? Only voices that are yours or that you have the speaker's explicit permission to clone. `voice_consent: true` records that confirmation. ### Can I animate an image that BobaBanana generated earlier? Yes. Pass the earlier job's `output.image.url` as `image`. ### What format is the output? MP4 (H.264) video. With speech, `audio` or a sound effect, that sound is in the file; otherwise the clip may carry generated ambient sound. --- # Voice cloning and text-to-speech API **`POST /v1/speech` speaks your text in a voice you choose: either a saved library voice (`"@handle"`) or a new voice cloned from a 5 to 30 second recording you upload.** The result is a WAV file. Use the same voice in [videos](https://bobabanana.com/docs/api/videos/) to make lip-synced talking characters. ## Request fields | Field | Type | Required | Description | |---|---|---|---| | `text` | string, up to 600 chars | yes | What to say | | `voice` | `"@handle"` or a voice sample object | yes | The voice | | `voice_consent` | boolean | with a sample | Must be `true` to clone an uploaded voice | | `webhook_url`, `metadata`, `name` | | no | As for [images](https://bobabanana.com/docs/api/images/) | ## Voice samples A voice sample is an object with one of `file_id`, `url` or `data`, plus an optional `transcript`: ```json {"file_id": "file_voice123", "transcript": "The exact words spoken in the recording."} ``` A plain string also works: `"file_voice123"`, an `https://` URL or a `data:` URI. **What makes a good sample:** 1. **5 to 30 seconds** of speech (2 to 60 seconds is accepted). 2. **One speaker only**, no music, no background noise. 3. **Clear, natural delivery** in the style you want to hear back. 4. **An exact transcript**, if you have one. Without it, BobaBanana transcribes the sample first. Accepted formats: WAV, MP3, M4A, OGG, FLAC, WEBM, AAC, OPUS, up to 60 MB. The upload response includes `duration` and quality `warnings` (too short, too quiet, distorted, noisy). ## Example: clone a voice and speak ```bash # 1. upload the sample curl https://bobabanana.com/api/v1/files -H "Authorization: Bearer $BOBABANANA_API_KEY" -F "file=@my-voice.wav" # 2. speak new text in that voice curl https://bobabanana.com/api/v1/speech \ -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \ -d '{ "text": "Thanks for joining us. The next episode drops on Friday.", "voice": {"file_id": "file_voice123", "transcript": "Hi, this is my normal speaking voice for the sample."}, "voice_consent": true }' ``` ## Example: a saved library voice ```json {"text": "Once upon a time, in a valley hidden by mist, there lived a clockmaker.", "voice": "@storyteller"} ``` List available voices with `GET /v1/voices` ([assets](https://bobabanana.com/docs/api/assets/)). ## Response When the job succeeds, `output.speech.url` is a WAV file: ```json {"id": "x_51aa", "type": "speech", "status": "succeeded", "output": {"speech": {"url": "https://bobabanana.com/api/v1/files/content/out/...wav?...", "content_type": "audio/wav"}}} ``` ## Responsible voice cloning - Clone only your own voice, or a voice whose speaker has given you explicit permission. - `voice_consent: true` is required for every uploaded sample and is stored with the job. - Voice samples are used only to make the jobs you request with them. ## Frequently asked questions ### How much audio do I need to clone a voice? 5 to 30 seconds of clean speech from one person. ### Do I have to provide a transcript? No, but it helps. Without one, the sample is transcribed automatically before speaking. ### Which languages are supported? English works best. Speech in the sample's language is the most reliable. ### Can I use the cloned voice in a video? Yes. Send the same `voice` with a `script` to `POST /v1/videos` for a lip-synced talking clip. --- # Text-to-sound-effects API **`POST /v1/sound-effects` generates a 2 to 20 second sound effect, ambience or foley clip from a text description and returns a WAV file.** The same feature can be mixed directly into a clip through the `sound_effect` field of [`POST /v1/videos`](https://bobabanana.com/docs/api/videos/). ## Request fields | Field | Type | Required | Description | |---|---|---|---| | `prompt` | string, up to 300 chars | yes | The sound, e.g. "rain on a tin roof with distant thunder" | | `duration_seconds` | number, 2 to 20 | no | Default 8 | | `webhook_url`, `metadata`, `name` | | no | As for [images](https://bobabanana.com/docs/api/images/) | ## Example ```bash curl https://bobabanana.com/api/v1/sound-effects \ -H "Authorization: Bearer $BOBABANANA_API_KEY" -H "Content-Type: application/json" \ -d '{"prompt": "busy cafe ambience, cups clinking, soft chatter", "duration_seconds": 12}' ``` When it succeeds, `output.sound_effect.url` is a WAV file. ## Prompt ideas that work well 1. **Ambience:** "forest at dawn, birdsong, light wind in leaves" 2. **Weather:** "heavy rain on a car roof, distant thunder" 3. **Foley:** "footsteps on gravel, slow walking pace" 4. **Machines:** "old film projector whirring" 5. **Impacts:** "a wooden door slams shut in a large hall, echo" 6. **Crowds:** "stadium crowd cheering after a goal" Describe the source, the space and the intensity. Sound effects are not music or speech generators. ## Frequently asked questions ### What is the maximum length? 20 seconds per job. ### What format is returned? WAV audio. ### Can I add a sound effect to a video in the same request? Yes, with `"sound_effect": {"prompt": "...", "duration_seconds": 8}` in `POST /v1/videos`. --- # Upscale images and videos **Any finished image or video job can be upscaled into a sharper, larger version with `POST /v1/jobs/{job_id}/upscale`.** The result is a new job of type `image_upscale` or `video_upscale` whose `source_job_id` names the original; the original job is never changed. A video keeps its own sound, frames and frame rate. ## Sizes | Source | Factors | Example | Largest result | |---|---|---|---| | Image job | `2`, `4` | 1024 × 1024 → 2048 × 2048 (2x) or 4096 × 4096 (4x) | 4096 px on the long side, 16.8 megapixels | | Video job | `2`, `2.25`, `4` | 832 × 480 → 1664 × 960 (2x) or 1872 × 1080 (2.25x, HD); 4x for small clips, e.g. 480 × 270 → 1920 × 1080 | 3 megapixels per frame (for example 2304 × 1296); clips up to 15 s, up to 30 frames a second | A factor that would go past these limits is refused with `400 invalid_request` and a reason. [`GET /v1/jobs/{job_id}/upscale-options`](#check-the-options-first) tells you in advance which factors a job allows and what each costs. ## Check the options first ```bash curl https://bobabanana.com/api/v1/jobs/x_8d21c0f4a9b3/upscale-options \ -H "Authorization: Bearer $BOBABANANA_API_KEY" ``` ```json { "object": "upscale_options", "job_id": "x_8d21c0f4a9b3", "media": "video", "width": 832, "height": 480, "seconds": 5.0, "available": true, "reason": "", "notice": "", "estimate_seconds": 330, "options": [ {"factor": 2.0, "available": true, "reason": "", "width": 1664, "height": 960, "credits": 60}, {"factor": 2.25, "available": true, "reason": "", "width": 1872, "height": 1080, "credits": 60}, {"factor": 4.0, "available": true, "reason": "", "width": 3328, "height": 1920, "credits": 150} ] } ``` ## Upscale a job ```bash curl -X POST https://bobabanana.com/api/v1/jobs/x_8d21c0f4a9b3/upscale \ -H "Authorization: Bearer $BOBABANANA_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: upscale-x_8d21c0f4a9b3-2.25" \ -d '{"factor": 2.25, "max_credits": 60, "webhook_url": "https://example.com/hooks/bobabanana"}' ``` The answer is `202 Accepted` with the new job: ```json { "id": "x_51f0aa93c2d7", "object": "job", "type": "video_upscale", "status": "queued", "source_job_id": "x_8d21c0f4a9b3", "output_size": {"width": 1872, "height": 1080}, "input": {"source_job_id": "x_8d21c0f4a9b3", "factor": 2.25}, "output": {}, "cost": {"credits_estimate": 60, "credits_charged": 0, "credits_released": 0, "status": "held"} } ``` Poll it with [`GET /v1/jobs/{id}`](https://bobabanana.com/docs/api/jobs/) or wait for its [webhook](https://bobabanana.com/docs/api/webhooks/). When it succeeds, `output.image` (PNG) or `output.video` (MP4 with the original sound) holds the result. | Body field | Type | Notes | |---|---|---| | `factor` | number | `2` or `4` for an image job; `2`, `2.25` or `4` for a video job. Default `2` | | `max_credits` | integer | Refuse (`400 cost_above_max`) if the upscale would cost more | | `webhook_url` | string | `https://` URL for the signed result notification | | `metadata` | object | Up to 16 string keys echoed back on the job | | `name` | string | Label shown in the studio | The `Idempotency-Key` header works as for every create request. ## When upscaling cannot start yet Upscaling is sometimes not available straight away. The job is still accepted and held its price; it starts as soon as it can, and until then it carries a `notice`: `"Upscale isn't available right now. Your upscale will start as soon as it can."` `estimate_seconds` on the options includes that start-up time. You can [cancel](https://bobabanana.com/docs/api/jobs/) a waiting job at no cost. ## Prices | Price key | What | Credits | |---|---|---| | `upscale_image` | One image at 2x or 4x | 30 | | `upscale_video` | A video whose upscaled frame is at most 2.2 megapixels (HD, e.g. 2x or 2.25x of 480p) | 30 + 6 per second | | `upscale_video_4k` | A larger video result (e.g. 4x of 480p, or 2x / 2.25x of 720p) | 30 + 24 per second | Seconds are counted per started second of the source clip. The credits are held when the job is accepted, charged when it succeeds and given back in full when it fails or is canceled. [`GET /v1/prices`](https://bobabanana.com/docs/api/credits/) always shows the prices in force. ## Errors | Status | Code | When | |---|---|---| | 400 | `invalid_request` | The job is not finished, is not an image or video, the factor is not allowed for it, the video is longer than 15 s, or your workspace has not switched on "Make work quickly at busy times" (the message names what to change) | | 400 | `cost_above_max` | The upscale costs more than `max_credits` | | 402 | `insufficient_credits` | Not enough credits for the hold | | 404 | `job_not_found` | No such job for this API key | See [Errors](https://bobabanana.com/docs/api/errors/) for the error object. --- # Uploading reference images and voice samples **Every image or audio input to the BobaBanana API can be given in three ways: a `file_id` from `POST /v1/files`, a public `https://` URL, or base64 data.** Uploading once and reusing the `file_id` is fastest when the same reference appears in many requests. ## Upload a file ```bash curl https://bobabanana.com/api/v1/files \ -H "Authorization: Bearer $BOBABANANA_API_KEY" \ -F "file=@portrait.jpg" ``` ```json {"id": "file_3f9c2a1b7d4e", "object": "file", "type": "image", "name": "portrait.jpg", "bytes": 802113, "created": 1795660000, "width": 1024, "height": 1280, "warnings": []} ``` Audio uploads return `duration` (seconds) instead of `width`/`height`, and `warnings` such as "Background noise detected". `GET /v1/files/{id}` returns the same record plus a signed `url`. `DELETE /v1/files/{id}` deletes an upload; it is refused with `409 file_in_use` while an unfinished job uses it. Uploads count toward your workspace's storage. An upload that no job uses is deleted after 24 hours (`expires_at`); once a job uses it, it is kept. ## Media inputs Anywhere the docs say *media input*, you may send any of these: | Form | Example | |---|---| | File ID string | `"file_3f9c2a1b7d4e"` | | URL string | `"https://example.com/sofa.jpg"` | | Data URI string | `"data:image/png;base64,iVBORw0..."` | | Object | `{"file_id": "file_3f9c2a1b7d4e", "label": "a mustard yellow sofa"}` | | Object with URL | `{"url": "https://example.com/sofa.jpg", "label": "..."}` | | Object with base64 | `{"data": "iVBORw0...", "label": "..."}` | Use exactly one of `file_id`, `url` or `data` in an object. `label` matters for `reference_images`: it tells the model what the picture shows. ## Supported formats and limits | Kind | Formats | Max size | Notes | |---|---|---|---| | Images | PNG, JPG, WEBP, GIF, BMP | 25 MB | Scaled to at most 2048 px; EXIF rotation applied | | Audio | WAV, MP3, M4A, OGG, FLAC, WEBM, AAC, OPUS | 60 MB | Converted to mono WAV | | Voice samples | as audio | 60 MB | 2 to 60 s accepted, 5 to 30 s recommended | ## Rules for URL inputs 1. **https only.** `http://` URLs are refused. 1. **30 seconds in total** for all URL inputs of one request, and at most 2 downloads at once per workspace (`429 too_many_downloads`). 2. **Public addresses only.** URLs that resolve to private or local networks are refused. 3. **No redirects are followed.** Link to the final file. 4. **The URL must return the file directly** with HTTP 200, not an HTML page. BobaBanana result links (`output.*.url`) are valid inputs, which makes chaining easy: image job → video job. ## Frequently asked questions ### How long are uploaded files kept? An upload that no job uses is deleted after 24 hours. Once a job uses it, it is kept until you delete it with `DELETE /v1/files/{id}`. Result download links expire after 24 hours; request the job again for a fresh link. ### Can another API key use my file ID? Keys of the same workspace can; keys of other workspaces cannot, and get `404 file_not_found`. ### How long can a download take? Each request has 30 seconds in total to download all of its URL inputs. A slow server counts against that budget even if it keeps sending data. Inline `data` can be about 25 MB; upload larger files first. ### Why was my URL refused? It was not `https`, it pointed to a private address, it redirected, or it did not return HTTP 200. Download it yourself and upload it, or send it as base64. --- # Jobs, status polling and long-polling **Every generation request (`/v1/images`, `/v1/videos`, `/v1/speech`, `/v1/sound-effects`) returns `202 Accepted` with a job object straight away; the work happens in the background.** You find out it is done by polling, by long-polling with `?wait=30`, or with a [webhook](https://bobabanana.com/docs/api/webhooks/). ## Job statuses | Status | Meaning | Final? | |---|---|---| | `queued` | Waiting its turn in the studio | no | | `running` | At least one step is being made | no | | `succeeded` | Finished; results are in `output` | yes | | `failed` | Could not be made; see `error` | yes | | `canceled` | Canceled by you | yes | ## The job object ```json { "id": "x_8d21c0f4a9b3", "object": "job", "type": "video", "status": "running", "created": 1795660000, "finished": null, "eta_seconds": 380, "poll_after_seconds": 30, "input": {"prompt": "...", "duration_seconds": 5, "aspect_ratio": "9:16", "reference_images": [{"file_id": "file_a1", "label": "..."}]}, "output": {}, "error": null, "cost": {"credits_estimate": 30, "credits_charged": 0, "credits_released": 0, "status": "held"}, "webhook": {"status": "pending", "attempts": 0, "last_status": null}, "metadata": {"order_id": "1234"} } ``` | Field | Description | |---|---| | `type` | `image`, `video`, `speech`, `sound_effect`, or `image_upscale` / `video_upscale` for an [upscale](https://bobabanana.com/docs/api/upscale/) (which also carries `source_job_id` and `output_size`) | | `eta_seconds` | Estimated seconds until done, from recent measured job times (an estimate, not a promise) | | `poll_after_seconds` | A sensible delay before polling again | | `input` | The request as stored, with inline inputs replaced by their file IDs | | `output` | `image`, `video`, `speech`, `sound_effect`: each `{"url", "content_type"}` | | `error` | `{"code", "message", "steps"}` when failed or canceled | | `warnings` | Present when a side step failed but the main result was made | | `cost` | Credits reserved, charged and released for this job ([credits](https://bobabanana.com/docs/api/credits/)) | | `webhook` | `{"status", "attempts", "last_status"}` when the job has a `webhook_url`, else `null` | ## Long-polling: the simplest way to wait ```bash curl "https://bobabanana.com/api/v1/jobs/x_8d21c0f4a9b3?wait=30" -H "Authorization: Bearer $BOBABANANA_API_KEY" ``` The request returns as soon as the job reaches a final status, or after `wait` seconds (maximum 30) with the current state. Loop until the status is final. This is ideal for AI agents and scripts: no webhook server needed and no wasted polls. ## Other job endpoints | Endpoint | Description | |---|---| | `GET /v1/jobs` | Newest first. Filters: `status`, `type`, `limit` (1-100), `before` (the `next_cursor` of the previous page) | | `POST /v1/jobs/{id}/cancel` | Cancel a queued or running job; delivered steps are charged, the rest released | | `DELETE /v1/jobs/{id}` | Delete a finished job and its result files. `409 job_active` while it is unfinished: cancel it first | | `POST /v1/jobs/{id}/webhook/replay` | Send a finished job's webhook again ([webhooks](https://bobabanana.com/docs/api/webhooks/)) | ### Paging through jobs A list returns `{"object": "list", "data": [...], "has_more": true, "next_cursor": "x_..."}`. Pass `next_cursor` as `?before=` to get the next page; filters apply to every page, so pages never skip or repeat a job. An unknown cursor gets `400 invalid_cursor`. Deleting a job removes it from lists and frees its storage, but it still counts toward the key's daily limit, and what it was charged is not refunded. ## Idempotency keys: safe retries Send an `Idempotency-Key` header (up to 255 characters) with any create request. If a network error makes you retry, the same key within 24 hours returns the original job instead of creating a duplicate. | Situation | Result | |---|---| | Same key, same endpoint and body, first request finished | The original job | | Same key while the first request is still being processed | `409 idempotency_in_progress`; retry after `Retry-After` | | Same key with a different endpoint or body | `422 idempotency_key_reused`; use a new key | | The first request failed (for example `402`) | The key is free again; the retry runs normally | Keys are per API key: two keys may use the same value. ```bash curl https://bobabanana.com/api/v1/images -H "Idempotency-Key: order-1234-hero" ... ``` ## Best practices for waiting on jobs 1. **Prefer webhooks** for servers, **long-polling** for scripts and agents. 2. **Respect `poll_after_seconds`** if you poll without `wait`. 3. **Retry creates with an `Idempotency-Key`**, never blindly. 4. **Download results promptly**; links last 24 hours. 5. **Use `metadata`** to tie jobs to your own records. ## Frequently asked questions ### Why is my job still queued? Jobs run in order in the BobaBanana studio. Check `eta_seconds` and `GET /v1/status`. ### Can I get partial results? Yes. For a video with a generated first frame, `output.image` appears as soon as the frame is ready, before the video. ### What happens if a step fails? If the main result cannot be made the job is `failed` with `error.steps` naming the step. If only a side step failed (for example a sound effect), the job succeeds with `warnings`. --- # Webhooks: get notified when a job finishes **Add `"webhook_url": "https://your-server/hooks/bobabanana"` to any create request and BobaBanana sends one signed `POST` to that URL when the job succeeds, fails or is canceled.** No polling needed. ## The webhook event ```http POST /hooks/bobabanana Content-Type: application/json BobaBanana-Signature: t=1795660420,v1=5f2b7c... ``` ```json { "id": "evt_a81c2e0d9f11", "object": "event", "type": "job.succeeded", "created": 1795660420, "data": { "id": "x_8d21c0f4a9b3", "object": "job", "type": "video", "status": "succeeded", "output": {"video": {"url": "...", "content_type": "video/mp4"}} } } ``` Event types: `job.succeeded`, `job.failed`, `job.canceled`. `data` is the same [job object](https://bobabanana.com/docs/api/jobs/) that `GET /v1/jobs/{id}` returns. ## Verify the signature Each key has a **webhook signing secret** (`whsec_...`, in Settings → API keys). The signature is `HMAC-SHA256(secret, "{t}.{raw request body}")` in hex. ```python import hmac, hashlib, time def verify(raw_body: bytes, header: str, secret: str, tolerance=300) -> bool: parts = dict(p.split("=", 1) for p in header.split(",")) expected = hmac.new(secret.encode(), parts["t"].encode() + b"." + raw_body, hashlib.sha256).hexdigest() return hmac.compare_digest(expected, parts["v1"]) and abs(time.time() - int(parts["t"])) < tolerance ``` ```javascript import crypto from "node:crypto"; export function verify(rawBody, header, secret, tolerance = 300) { const parts = Object.fromEntries(header.split(",").map((p) => p.split("="))); const expected = crypto.createHmac("sha256", secret).update(`${parts.t}.${rawBody}`).digest("hex"); const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < tolerance; return fresh && expected.length === parts.v1?.length && crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(parts.v1)); } ``` Always verify against the **raw** body bytes, before parsing JSON. ## Delivery and retries 1. Your endpoint must answer with a **2xx status within 10 seconds**. 2. On failure BobaBanana retries **after 10 seconds, 1 minute, 5 minutes, 30 minutes and 2 hours** (6 attempts in total), then gives up. Deliveries are stored, so a retry is never lost when BobaBanana restarts. 3. Webhook URLs must be **https** and resolve to a **public** address. 4. Treat delivery as **at least once**: use the event's `id` to ignore duplicates. 5. If the API key is revoked or the workspace is suspended, pending deliveries are not sent. The job object shows the delivery: `"webhook": {"status": "pending" | "delivered" | "failed" | "suppressed", "attempts": 2, "last_status": 502}`. ## Replaying a webhook `POST /v1/jobs/{id}/webhook/replay` sends a finished job's event again from the first attempt, with fresh download links and the **same event `id`**. Use it after fixing your endpoint. It returns the `webhook` object; a job created without `webhook_url` gets `409 no_webhook`, and an unfinished job `409 job_active`. ## Webhook best practices - **Acknowledge fast, work later:** return `200` and process the job in a background queue. - **Fetch fresh links when needed:** result URLs in the event expire after 24 hours; `GET /v1/jobs/{id}` gives new ones. - **Keep long-polling as a fallback** for jobs whose webhook you might have missed. ## Frequently asked questions ### Is there one webhook URL per account? No. You choose the URL per request, so different jobs can notify different endpoints. ### Can I test webhooks locally? Use a public https tunnel to your machine. Local and private addresses are refused. --- # Library assets: reuse characters, products, places and voices by @handle **Assets are approved, reusable subjects in a BobaBanana workspace (human and non-human characters, objects and products, places, composite scenes and voices), each with a unique `@handle`.** Put a handle in `assets` (images and videos) or `voice` (speech and videos) and BobaBanana brings in that asset's approved reference pictures or voice. ## Asset kinds | `kind` | What it is | Use it in | |---|---|---| | `human` | A consistent person, with head and full-body views | `assets` | | `nonhuman` | Animal, creature, mascot, robot | `assets` | | `object` | Product, furniture, vehicle, prop | `assets` | | `place` | Room, building, landscape | `assets` | | `scene` | A composed scene of several assets | `assets` | | `custom` | Anything else visual | `assets` | | `voice` | A cloned or designed voice | `voice` | Assets are created and approved in the BobaBanana studio; the API reads and uses them. ## List assets ```bash curl "https://bobabanana.com/api/v1/assets?kind=human&search=maya" -H "Authorization: Bearer $BOBABANANA_API_KEY" ``` ```json {"object": "list", "data": [ {"id": "a_19be", "object": "asset", "handle": "@maya", "name": "Maya", "kind": "human", "description": "", "tags": [], "version": 3, "preview_url": "https://bobabanana.com/api/v1/files/content/...png?..."} ]} ``` | Endpoint | Description | |---|---| | `GET /v1/assets` | Filters: `kind`, `search`, `limit` (1-200) | | `GET /v1/assets/{handle}` | One asset by `@handle` or ID | | `GET /v1/voices` | Voice assets only; each has a `sample_url` to listen to | ## Use assets in requests ```json {"prompt": "@maya and @rex the robot share an umbrella on a rainy street", "assets": ["@maya", "@rex"]} ``` ```json {"text": "Good evening, and welcome.", "voice": "@narrator_deep"} ``` You can mix `assets` with uploaded `reference_images` in the same request (10 pictures in total). ## Frequently asked questions ### Why use assets instead of uploading references each time? Assets are already approved for consistency, include several views (a character brings face and body pictures), and keep every app and agent using the same version. ### Which version of an asset is used? The asset's active approved version at the time of the request. ### Can the API create or approve assets? Not yet. Create and approve them in the BobaBanana studio. --- # BobaBanana for AI agents: tools, OpenAPI and llms.txt **AI agents can call the BobaBanana API as a tool to create images, videos, speech and sound effects from references, then wait for the result with a single long-poll call.** The API was designed for agents: predictable JSON, string-or-object inputs, URL inputs, idempotency keys, and error messages that say how to fix the request. ## Machine-readable resources for agents | Resource | URL | Use | |---|---|---| | OpenAPI 3.1 spec | `https://bobabanana.com/docs/openapi.json` | Code generators, OpenAPI tool loaders, custom assistant actions | | Live OpenAPI | `https://bobabanana.com/api/v1/openapi.json` | Always matches the running API | | llms.txt | `https://bobabanana.com/docs/llms.txt` | Short index of the docs for LLMs | | llms-full.txt | `https://bobabanana.com/docs/llms-full.txt` | All docs in one Markdown file | | Markdown pages | Add `index.md` to any docs URL, e.g. `/docs/api/videos/index.md` | Clean text for retrieval | ## Why the BobaBanana API is agent-friendly 1. **One call to wait:** `GET /v1/jobs/{id}?wait=30` returns when the job is done. 2. **URLs everywhere:** inputs accept `https://` URLs, and outputs are signed URLs that need no key, so agents can chain jobs. 3. **Strings or objects:** `"reference_images": ["https://..."]` works as well as full objects. 4. **Safe retries:** the `Idempotency-Key` header prevents duplicate jobs. 5. **Actionable errors:** every error has a `code`, a human-readable `message` and the offending `param`. ## Tool definitions (JSON Schema) These definitions use the `name` / `description` / `input_schema` tool format that tool-use LLM APIs accept; for a function-calling API that expects `parameters`, put the same schema under `parameters`. ```json [ { "name": "bobabanana_generate_image", "description": "Generate an image with BobaBanana. Use reference_images (https URLs with labels) or library @handles to keep characters, products and places consistent. Returns a job; call bobabanana_wait_for_job with its id.", "input_schema": { "type": "object", "properties": { "prompt": {"type": "string", "description": "What to create"}, "reference_images": {"type": "array", "items": {"type": "object", "properties": {"url": {"type": "string"}, "label": {"type": "string"}}, "required": ["url"]}}, "assets": {"type": "array", "items": {"type": "string"}, "description": "Library handles like @maya"}, "aspect_ratio": {"type": "string", "enum": ["16:9", "9:16", "1:1", "4:3", "3:4"]} }, "required": ["prompt"] } }, { "name": "bobabanana_generate_video", "description": "Generate a video. Give image (a start frame URL) or prompt (+ references) to generate the first frame; optional last_frame to end on a picture. Or give motion_video (a 1-15 s clip whose movement is copied onto image) or extend_video (a clip of up to 15 s to continue from its last frame). Length: 2-10 s at 720p, 3-15 s at 1080p and 2160p (16:9 or 9:16); a motion transfer is as long as its clip. Optional at 720p: voice ('@handle') with script for a lip-synced talking character. Optional sound_effect (not with motion_video).", "input_schema": { "type": "object", "properties": { "image": {"type": "string", "description": "https URL of the start frame (or the subject for motion_video)"}, "prompt": {"type": "string"}, "reference_images": {"type": "array", "items": {"type": "object", "properties": {"url": {"type": "string"}, "label": {"type": "string"}}, "required": ["url"]}}, "last_frame": {"type": "string", "description": "https URL of the picture the video ends on"}, "motion_video": {"type": "string", "description": "https URL of an mp4 or mov clip, 1-15 s, whose movement is copied"}, "extend_video": {"type": "string", "description": "https URL of an mp4, mov or webm clip of up to 15 s to continue"}, "motion": {"type": "string", "description": "Camera and subject movement"}, "duration_seconds": {"type": "number", "minimum": 2, "maximum": 15, "description": "2-10 s at 720p; 3-15 s at 1080p and 2160p (10 s at most with last_frame)"}, "resolution": {"type": "string", "enum": ["720p", "1080p", "2160p"], "description": "720p is standard; 1080p and 2160p need 16:9 or 9:16 and take no voice or audio"}, "aspect_ratio": {"type": "string", "enum": ["16:9", "9:16", "1:1", "4:3", "3:4"]}, "voice": {"type": "string", "description": "Saved voice @handle (720p only)"}, "script": {"type": "string", "description": "Words the character says"} } } }, { "name": "bobabanana_wait_for_job", "description": "Wait up to 30 seconds for a BobaBanana job. Call again while status is queued or running. On succeeded, output contains url fields.", "input_schema": {"type": "object", "properties": {"job_id": {"type": "string"}}, "required": ["job_id"]} } ] ``` ## Executing the tools ```python import os, requests API = "https://bobabanana.com/api/v1" H = {"Authorization": f"Bearer {os.environ['BOBABANANA_API_KEY']}"} def run_tool(name: str, args: dict) -> dict: if name == "bobabanana_generate_image": return requests.post(f"{API}/images", headers=H, json=args, timeout=60).json() if name == "bobabanana_generate_video": return requests.post(f"{API}/videos", headers=H, json=args, timeout=60).json() if name == "bobabanana_wait_for_job": return requests.get(f"{API}/jobs/{args['job_id']}", headers=H, params={"wait": 30}, timeout=45).json() raise ValueError(name) ``` Return the JSON to the model as the tool result. The model sees `status`, `eta_seconds` and, when done, `output.*.url`. ## A system prompt snippet for agents ```text You can create media with BobaBanana tools. Jobs are asynchronous: after a generate call, call bobabanana_wait_for_job with the returned id until status is succeeded, failed or canceled. Videos take several minutes; tell the user the eta_seconds while waiting. To keep a subject consistent, pass the same reference_images (with labels) or @handles every time. To animate a picture you generated, pass its output.image.url as the video's image. ``` ## Agent workflow recipes 1. **Storyboard to video:** generate 3 to 6 images with the same references, then animate each with `/v1/videos` using `image`. 2. **Product ad:** product photo as reference → lifestyle image → 6 s video with a `sound_effect`. 3. **Talking spokesperson:** portrait + saved `@voice` + script → lip-synced 9:16 clip. 4. **Podcast promo:** `/v1/speech` for the line, then `/v1/videos` with that speech URL as `audio`. ## Frequently asked questions ### Can a custom chat assistant use the BobaBanana API? Yes. If it supports OpenAPI actions, import `https://bobabanana.com/docs/openapi.json` as an action and set Bearer authentication with your key. ### Can an LLM agent with tool use call the BobaBanana API? Yes. Give it the tool definitions above, and run the calls in your code. ### Is there an MCP server? Not yet. The tool definitions above wrap the REST API in the meantime. ### How should an agent handle errors? Read `error.message` and `error.param`, fix the request, and retry. For `429` and `503`, wait for the `Retry-After` header. --- # Error codes, rate limits and retries **BobaBanana API errors always use the same JSON shape with a stable `code`, a readable `message`, the `param` at fault when there is one, and a link to this page.** ```json {"error": {"code": "voice_consent_required", "message": "Set voice_consent to true to confirm the voice is yours or you have the speaker's explicit permission to clone it.", "param": "voice_consent", "docs": "https://bobabanana.com/docs/api/errors/"}} ``` ## HTTP status codes | Status | Meaning | |---|---| | `200` / `201` / `202` | Success / file uploaded / job accepted | | `400` | The request is invalid; fix it before retrying | | `401` | Missing or invalid API key | | `402` | Not enough credits for this job | | `403` | The workspace is suspended, or a download link is invalid or expired. A plain-text `error code: 1010` means the request carried Python `urllib`'s default User-Agent: send your own, e.g. `my-app/1.0` | | `404` | Job, file, asset or endpoint not found in your workspace | | `405` | The method is not allowed on this endpoint | | `409` | Conflicts with the current state: an asset without a version, an unfinished job, an idempotency key in use | | `413` | The request body is too large | | `422` | A field has the wrong type or is out of range, invalid JSON, or an idempotency key reused | | `429` | A limit was reached; see `Retry-After` | | `500` | Something went wrong on our side; retry later with an `Idempotency-Key` | | `503` | That kind of generation is not available right now; see `Retry-After` | | `507` | Your workspace's storage is full | ## Error codes | Code | Status | How to fix | |---|---|---| | `missing_api_key` | 401 | Send `Authorization: Bearer bb_...` | | `invalid_api_key` | 401 | Check the key; it may be revoked | | `invalid_request` | 400/422 | Read `message` and `param` | | `invalid_json` | 422 | The body is not valid JSON | | `not_found` / `method_not_allowed` | 404 / 405 | Check the path and method against the [OpenAPI spec](https://bobabanana.com/docs/openapi.json) | | `insufficient_credits` | 402 | `required` and `available` say how many credits are missing; see [credits](https://bobabanana.com/docs/api/credits/) | | `cost_above_max` | 400 | The job would cost more than `max_credits`; `credits_estimate` says how much | | `workspace_suspended` | 403 | Contact support@dmxmedia.com | | `idempotency_in_progress` | 409 | The first request with this key is still running, or its reservation was lost to a concurrent request with the same key; retry after `Retry-After` | | `idempotency_key_reused` | 422 | The key was used for a different request; use a new key | | `job_active` | 409 | Cancel the job before deleting it, or wait for it to finish | | `no_webhook` | 409 | The job has no `webhook_url` to replay | | `webhook_pending` | 409 | A replay was asked for while the job's webhook is still being delivered; replay it once that delivery has finished or failed | | `file_in_use` | 409 | Delete the file after the job that uses it has finished | | `invalid_cursor` | 400 | Pass `next_cursor` from the previous page as `before` | | `fetch_timeout` | 400 | A URL input took longer than the 30 s budget; upload the file instead | | `too_many_downloads` | 429 | Two downloads are already running for your workspace | | `network_busy` | 429 | Every URL download worker on our side is busy; retry after `Retry-After`, or upload the file instead | | `too_many_files` | 429 | Delete uploads you no longer need | | `queue_full` | 429 | Your workspace has too many waiting jobs; wait for some to finish | | `storage_quota_exceeded` | 507 | Delete files or jobs you no longer need | | `invalid_url` | 400 | Use a public `https://` URL | | `fetch_failed` | 400 | The URL did not return the file with HTTP 200 | | `file_too_large` | 400 | Images up to 25 MB, audio up to 60 MB | | `invalid_image` / `invalid_audio` / `unsupported_file` | 400 | Use a supported format | | `invalid_base64` | 400 | Check the `data` field | | `wrong_file_type` | 400 | An audio file was given where an image is needed, or the reverse | | `file_not_found` | 404 | The file ID does not exist in your workspace, or it expired | | `too_many_references` | 400 | At most 10 pictures; a character asset counts as two | | `asset_not_found` | 404 | Check the handle with `GET /v1/assets` | | `wrong_asset_kind` | 400 | Voices go in `voice`; pictures in `assets` | | `asset_not_ready` | 409 | Approve a version of the asset in the studio | | `voice_consent_required` | 400 | Set `voice_consent: true` for uploaded voice samples | | `invalid_voice_sample` | 400 | Use 5 to 30 seconds of one clear speaker | | `invalid_metadata` | 400 | Up to 16 keys; keys 40 and values 500 characters | | `job_not_found` | 404 | The job ID belongs to another key or was deleted | | `link_expired` | 403 | Fetch the job again for a fresh URL | | `daily_limit_reached` | 429 | Wait, or ask the workspace owner to raise the limit | | `too_many_active_jobs` | 429 | Wait for running jobs to finish | | `motion_unavailable` | 400 | Motion transfer cannot be made for the workspace now; the message says why ("Make work quickly at busy times" or "Make work that shows people quickly at busy times" off in Settings (premium rendering of a motion transfer always needs both), the monthly premium spending limit) | | `motion_scenes` | 400 | The motion clip has cuts and not every scene can be made: more than 6 scenes (`reason: too_many`) or a scene under 1 second (`too_short`); with `first_shot_only` a first shot under 1 second (`first_too_short`). `scenes`, `scene_seconds` and `first_shot_ok` say what was found; send `first_shot_only: true` to make the first shot alone ([clips with cuts](https://bobabanana.com/docs/api/videos/#clips-with-cuts)) | | `engine_unavailable` | 503 | Retry after `Retry-After` seconds | | `storage_full` | 507 | The service's disk is full; retry later | Job failures (as opposed to request errors) appear inside the job: `"status": "failed", "error": {"code": "render_failed", "message": "...", "steps": {...}}`. ## When to retry 1. **Do not retry `400`, `401`, `404`, `409` or `422` unchanged.** Fix the request first. 2. **Retry `429` and `503` after the `Retry-After` header.** 3. **Retry network errors and `5xx` with backoff and an `Idempotency-Key`**, so a retried create cannot run twice. 4. **A failed job can be resubmitted** as a new request; changing the prompt or references often helps. ## Confirming your password in the studio Sensitive studio actions (creating an API key, changing your email or password, two-step sign-in, admin changes) ask you to confirm your password. Each confirmation counts, including successful ones: after 5 in 10 minutes the studio answers `429 too_many_attempts` until the window ends. Wrong passwords also count towards the account lockout. --- # Credits, prices and job costs **Every BobaBanana API job is paid for with your workspace's credits.** The credits a job will need are reserved when the job is accepted, charged for each step that is delivered, and given back for steps that fail or are canceled. A request that fails completely costs nothing. ## How a job is paid for 1. **Accepted:** the job's estimate is reserved (held) from your balance. If the workspace cannot cover it, the request is refused with `402 insufficient_credits` and nothing is created. 2. **Finished:** each delivered step is charged at the price it was reserved at; anything not delivered is released. 3. **Failed:** every reserved credit is released. 4. **Canceled by you:** steps already delivered are charged, the rest are released. Every job object carries its cost: ```json "cost": {"credits_estimate": 30, "credits_charged": 24, "credits_released": 6, "status": "partly_charged"} ``` | `cost.status` | Meaning | |---|---| | `held` | The job is unfinished; its estimate is reserved | | `charged` | Every step was delivered and charged | | `partly_charged` | Some steps were delivered, the rest released | | `released` | Nothing was delivered, nothing was charged | | `exempt` | The workspace is not billed per job | ## Prices `GET /v1/prices` returns the price table in force now. A job's cost is `base_credits`, plus `per_second_credits` for each started second of video or sound, plus `per_100_chars_credits` for each started 100 characters of speech. A row with `"pricing": "live_quote"` (`video_1080`, `video_2160`, `video_motion`) is priced from premium rendering's live price when the job is accepted: its credits are the most it costs at the regular rate, and the job's `cost.credits_estimate` is the price held. A video whose last frame uses premium rendering can also cost more than its `video_frames` row: the estimate shows it. ```bash curl https://bobabanana.com/api/v1/prices -H "Authorization: Bearer $BOBABANANA_API_KEY" ``` ```json {"object": "list", "data": [{"key": "image", "base_credits": 4, "per_second_credits": 0, "per_100_chars_credits": 0, "pricing": "fixed"}, {"key": "video", "base_credits": 6, "per_second_credits": 2, "per_100_chars_credits": 0, "pricing": "fixed"}, {"key": "video_2160", "base_credits": 0, "per_second_credits": 95, "per_100_chars_credits": 0, "pricing": "live_quote"}]} ``` | Key | Used for | |---|---| | `image` | `POST /v1/images`, and the first frame of a video made from a prompt | | `video` | A plain video clip without a voice: from `image`, or from a prompt with no references | | `video_voice` | A video clip with a cloned or saved voice | | `video_ref`, `video_voice_ref` | A video clip whose first frame uses `reference_images` or `assets` (without / with a voice) | | `video_frames`, `video_voice_frames` | A video clip with a `last_frame` (without / with a voice) | | `video_1080`, `video_2160` | A `1080p` or `2160p` video clip (live-quoted) | | `video_motion` | A [motion transfer](https://bobabanana.com/docs/api/videos/#motion-transfer), priced from the length of your clip (live-quoted; clips of 3 s or less cost more per second; the row is the most a clip costs); each pose-matched picture (three, or one for a clip under 2 s) is an `image` on top. A clip with cuts costs 1.5 times as much (each scene is made on its own and joined), or the normal price with `first_shot_only` | | `speech` | `POST /v1/speech`, and the speech step of a talking video | | `sound_effect` | `POST /v1/sound-effects`, and the sound step of a video | | `transcribe` | Transcribing a voice sample sent without its transcript | | `upscale_image` | An [image upscale](https://bobabanana.com/docs/api/upscale/) at 2x or 4x | | `upscale_video`, `upscale_video_4k` | A [video upscale](https://bobabanana.com/docs/api/upscale/): up to 2.2 megapixels a frame (HD), or larger; per second of the clip | Prices can change; a job always costs what was quoted when it was accepted. ## Balance ```bash curl https://bobabanana.com/api/v1/balance -H "Authorization: Bearer $BOBABANANA_API_KEY" ``` ```json {"object": "balance", "credits_available": 476, "credits_held": 24, "billing_mode": "credits"} ``` `credits_available` is the balance minus what unfinished jobs hold. It is what new jobs can use. ## Capping a job's cost Send `max_credits` with any create request to refuse it if it would cost more: ```json {"prompt": "a lighthouse at dusk", "duration_seconds": 10, "max_credits": 30} ``` If the estimate is higher, the request fails with `400 cost_above_max` and the error carries `credits_estimate`. Nothing is reserved. ## At zero credits New jobs get `402 insufficient_credits` with `required` and `available`: ```json {"error": {"code": "insufficient_credits", "message": "Needs 24 credits, you have 10.", "required": 24, "available": 10, "docs": "https://bobabanana.com/docs/api/errors/"}} ``` Jobs already queued or running are not affected. Credits are added by the workspace owner in the studio (**Credits**). There is no automatic top-up. ## Frequently asked questions ### Does a failed job cost anything? No. Credits for steps that were not delivered are always released. ### Does deleting a job give credits back? No. Deleting removes the job record and its results; what was charged stays charged, and the job still counts toward the key's daily limit. ### Do retries with an Idempotency-Key cost twice? No. A retry with the same key returns the original job and reserves nothing new.