BobaBanana API

POST /v1/videos/estimate: price a motion transfer

POST /v1/videos/estimate is the endpoint to price a motion transfer before you send it. Takes the same body as POST /v1/videos with motion_video. Finds the clip's cuts and answers what the job would hold now, how many scenes the clip has, how many would be made and the price multiplier. Nothing is queued, held or stored.

View as Markdown

At a glance

Endpoint
POST /v1/videos/estimate
Base URL
https://bobabanana.com/api/v1
Auth
Authorization: Bearer bb_...
Success
200
Safe to retry
no

Request#

Headers#

Headers
Header Required Description
Authorization yes Bearer bb_...: your API key (or send X-API-Key: bb_...)
Content-Type yes application/json

Body (JSON)#

Body (JSON)
Field Type Required Default Limits Description
webhook_url string no 0 to 500 characters https:// URL that receives a signed POST when the job finishes
metadata object of string no at most 16 keys Up to 16 keys (40 characters each) with string values (500 characters each), echoed back on the job and its webhook
name string no 0 to 80 characters Label shown in the BobaBanana studio
max_credits integer no at least 0 Refuse the job (400 cost_above_max, nothing held) if it would cost more than this
dry_run boolean no false true: answer 200 with what the job would cost (credits_estimate) and make nothing: nothing is queued, held or stored, and no Idempotency-Key is used
prompt string no 0 to 1500 characters The scene. Used to make the first frame when no image is given, and as the motion prompt when motion is empty.
image string or Media no Start frame to animate. If omitted, a first frame is generated from prompt + references.
last_frame string or Media no Last frame: the video moves from the first frame to this picture. Priced as a first + last frame video.
extend_video string or Media no Extend a clip: an mp4, mov or webm video of 15 seconds at most (url, or data up to about 25 MB). Its last frame becomes the start frame. Instead of image; priced as plain video unless last_frame is given.
motion_video string or Media no Motion transfer: a clip whose motion, performance and camera move are copied onto the subject in 'image' (or one asset in 'assets'). An mp4 or mov (H.264 or H.265), 1-15 seconds, 23.976-60 fps, each side at least 256 px, at most 50 MB (url, or data up to about 25 MB). The video is as long as the clip; duration_seconds is ignored. Made in the studio when it can be made in time, else with premium rendering; check cost.credits_estimate (the most it costs) or send max_credits.
match_pose boolean no true Motion transfer only: first redraw the subject in the poses, framing and shape of the clip's opening, middle and closing frames (the opening frame only for clips under 2 s; one opening-frame picture when the studio makes it; each a picture step at the picture price), and guide the video with those pictures. false sends the subject as it is (then only premium rendering can make it).
keep_sound boolean no true Motion transfer only: put the clip's own sound on the result when the clip has sound.
first_shot_only boolean no false Motion transfer only: when the clip has cuts (several scenes), make only its first shot, at the normal price of a clip that long. Without it every scene is made and joined under the clip's own sound, at 1.5x the normal price (see POST /v1/videos/estimate).
reference_images list of string or Media no at most 10 items
assets list of string no at most 10 items
motion string no 0 to 400 characters How things move, e.g. 'slow push-in, she turns and smiles'
duration_seconds number no 5 2 to 15 2-10 s at 720p; 3-15 s at 1080p and 2160p (10 s at most with last_frame)
aspect_ratio one of 16:9, 9:16, 1:1, 4:3, 3:4 no "16:9"
resolution one of 720p, 1080p, 2160p no "720p" 720p (standard), 1080p or 2160p (4K, made with premium rendering and priced from its live quote; 16:9 or 9:16; no voice or audio). Check cost.credits_estimate, or send max_credits.
voice string or VoiceSample no Voice to speak the script: '@handle' of a saved voice, or a sample to clone
voice_consent boolean no false Required with an uploaded voice sample
script string no 0 to 600 characters Words the character says, lip-synced
audio string or Media no Pre-recorded speech or soundtrack that drives the clip (instead of voice + script)
sound_effect SoundEffect no

Example request#

Price a motion transfer:

curl
curl https://bobabanana.com/api/v1/videos/estimate \
  -H "Authorization: Bearer $BOBABANANA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": {
      "url": "https://example.com/maya.png"
    },
    "motion_video": {
      "url": "https://example.com/dance.mp4"
    }
  }'
Python
import os

import requests

r = requests.post(
    "https://bobabanana.com/api/v1/videos/estimate",
    headers={"Authorization": f"Bearer {os.environ['BOBABANANA_API_KEY']}"},
    json={
        "image": {
            "url": "https://example.com/maya.png",
        },
        "motion_video": {
            "url": "https://example.com/dance.mp4",
        },
    },
    timeout=60,
)
r.raise_for_status()
print(r.json())
JavaScript
const res = await fetch("https://bobabanana.com/api/v1/videos/estimate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BOBABANANA_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "image": {
      "url": "https://example.com/maya.png"
    },
    "motion_video": {
      "url": "https://example.com/dance.mp4"
    }
  }),
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
console.log(await res.json());

More request bodies#

Only the first shot of a clip with cuts (first_shot_only):

{
  "assets": [
    "@maya"
  ],
  "motion_video": {
    "url": "https://example.com/trailer.mp4"
  },
  "first_shot_only": true
}

Response#

200 (VideoEstimate): Successful Response

{
  "object": "estimate",
  "credits_estimate": 150,
  "duration_seconds": 9,
  "scenes": 3,
  "scenes_made": 3,
  "scene_seconds": [
    3.2,
    2.5,
    3.3
  ],
  "price_multiplier": 1.5,
  "normal_credits": 100,
  "first_shot_only": false,
  "reason": "This clip has 3 scenes"
}

Errors#

Errors use the error object. The codes this endpoint can return (what to do about each is in Error codes):

Errors
Status Code Meaning
400 bad_request The Content-Length header is not a number.
400 fetch_failed Downloading a URL input failed or returned an HTTP error.
400 fetch_timeout Downloading a URL input took too long.
400 file_too_large A file or inline data is over its size limit.
400 invalid_base64 data is not valid base64.
400 invalid_request A field is missing, has the wrong type or breaks a rule. param names the field. Type and range problems found while reading the body are 422 with the same code.
400 invalid_url The URL is not https://, its host cannot be found, or it points to a private address.
400 invalid_video The video could not be read, or it breaks a clip rule (length, frame rate, size).
400 motion_scenes The motion clip has more scenes than can be made, or a scene is too short.
400 motion_unavailable A motion transfer cannot be made for this request right now.
400 unsupported_file The file is not a supported image, audio or video format.
401 invalid_api_key The key is wrong, revoked or belongs to no workspace.
401 missing_api_key No API key was sent.
403 workspace_suspended The workspace that owns the key is suspended.
413 too_large The request body is over the limit for this endpoint (JSON bodies 100 MB, uploads 64 MB).
422 invalid_json The body is not valid JSON.
429 network_busy Every download slot is busy. Retry-After: 5 s.
429 too_many_attempts Too many requests with wrong keys came from your address. Retry-After is set.
429 too_many_downloads Two URL inputs are already being downloaded for this workspace. Retry-After: 10 s.
500 internal_error Something went wrong on our side.
503 maintenance BobaBanana is being updated; changes are paused for a few minutes. Reads still work. Retry-After is set.