Sam3 Video

Sam3 Video

Playground

Try it on WaveSpeedAI!

SAM3 Video is a unified foundation model for prompt-based video segmentation. Provide text, point, box, or mask prompts and the model segments and tracks targets across frames with strong temporal consistency. Supports concept-level (“segment anything with concepts”) and multi-object masks for editing, analytics, and VFX. Ready-to-use REST inference API with fast response, no cold starts, and affordable pricing.

Features

SAM3 Video (wavespeed-ai/sam3-video) is a prompt-based video segmentation and mask-guided editing model. You provide a video plus a short text instruction (and optionally enable mask application), and the model segments/targets the requested subject(s) across frames with strong temporal consistency.

It’s a practical fit for object-focused video edits like background cleanup, removing unwanted elements, or isolating subjects for downstream compositing—especially on short-to-medium clips with clear subjects.


Key capabilities

  • Prompt-based target selection (concept prompts) Identify what to edit/segment using natural language (e.g., “the woman”, “person”, “red car”) without manually drawing masks frame-by-frame.

  • Multi-object targeting in one run Track multiple object categories by listing them in the prompt (comma-separated), producing consistent targets across frames.

  • Mask-guided region control via apply_mask Toggle whether the model applies the mask to the video output for tighter, more controllable edits.

  • Temporal consistency for video workflows Designed to keep results stable across frames, reducing flicker/drift compared with per-frame processing.

  • Editing-oriented use cases Works well for object removal and background cleanup when your prompt clearly specifies what should change and what should stay.


Parameters and how to use

  • video: (required) Input video file or a public URL.
  • prompt: (required) Text instruction for segmentation/editing. Use commas to target multiple objects (e.g., person, cloth).
  • apply_mask: Whether to apply the mask to the video (boolean). Default: true.

Prompt

Write prompts like you’re describing what to target and (if applicable) what the edit intent is.

Tips:

  • Prefer short, concrete nouns for targeting: person, woman, car, dog, shirt.
  • For multiple targets, use comma-separated labels: person, backpack, bicycle.
  • If you’re doing cleanup/removal, include keep-constraints to preserve look: “remove the person in the background, keep lighting unchanged”

Examples:

  • The woman
  • person, cloth
  • remove the person in the background, keep lighting unchanged

Media (Videos)

  • Provide video as either:

  • an uploaded file, or

  • a public URL the service can fetch.

  • Pricing/processing uses a billed duration clamp of 5–600 seconds, so very short clips are billed as 5s, and very long clips are treated as 600s.

Other parameters

  • apply_mask

  • true: apply the model’s mask to the output video (recommended when you want tighter control over the edited region).

  • false: run without applying the mask (useful when you want the model’s edits without explicit masking).

After you finish configuring the parameters, click Run, preview the result, and iterate if needed.


Pricing

Per-run cost depends on video duration (billed duration is clamped to 5–600 seconds), charged in 5-second units at $0.05 per 5s.

Billed durationCost per run
5s$0.05
10s$0.10
600s (max)$6.00

Notes

  • Best results come from stable footage with clear subject separation and minimal heavy motion blur.
  • Turn on apply_mask when you need more precise, localized control (especially in cluttered scenes).
  • If results drift or pick the wrong target, refine the prompt (more specific noun/descriptor) or reduce to fewer targets per run.

Authentication

For authentication details, please refer to the Authentication Guide.

API Endpoints

Submit Task & Query Result

set -euo pipefail

export WAVESPEED_API_KEY="your-api-key"

REQUEST_BODY=$(cat <<'JSON'
{
  "prompt": "A cinematic ocean wave at sunrise, highly detailed",
  "video": "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
  "apply_mask": true
}
JSON
)

# 1. Submit the prediction.
SUBMIT_RESPONSE=$(curl --silent --show-error --fail-with-body \
  -X POST "https://api.wavespeed.ai/api/v3/wavespeed-ai/sam3-video" \
  -H "Authorization: Bearer ${WAVESPEED_API_KEY}" \
  -H "Content-Type: application/json" \
  -d "${REQUEST_BODY}")

TASK=$(printf '%s' "${SUBMIT_RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
PREDICTION_ID=$(printf '%s' "${TASK}" | jq -r '.id // empty')
if [ -z "${PREDICTION_ID}" ]; then
  printf 'Submission response did not contain a prediction id
' >&2
  exit 1
fi
RESULT_URL=$(printf '%s' "${TASK}" | jq -r '.urls.get // empty')
if [ -z "${RESULT_URL}" ]; then RESULT_URL="https://api.wavespeed.ai/api/v3/predictions/${PREDICTION_ID}/result"; fi

# 2. Poll until the prediction finishes.
while true; do
  RESPONSE=$(curl --silent --show-error --fail-with-body \
    "${RESULT_URL}" \
    -H "Authorization: Bearer ${WAVESPEED_API_KEY}")
  RESULT=$(printf '%s' "${RESPONSE}" | jq 'if type == "object" and has("data") then .data else . end')
  STATUS=$(printf '%s' "${RESULT}" | jq -r '.status // empty')

  case "${STATUS}" in
    completed) printf '%s\n' "${RESULT}" | jq '.outputs'; break ;;
    failed|cancelled|timeout) printf '%s\n' "${RESULT}" | jq . >&2; exit 1 ;;
    created|processing) sleep 2 ;;
    *) printf 'Unexpected status: %s
' "${STATUS}" >&2; exit 1 ;;
  esac
done

Parameters

Task Submission Parameters

Request Parameters

ParameterTypeRequiredDefaultRangeDescription
promptstringYes-Text prompt for segmentation. Use commas to track multiple objects (e.g., 'person, cloth').
videostringYes-Video URL for segmented
apply_maskbooleanNotrue-Whether to apply mask to video

Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
data.idstringUnique identifier for the prediction, Task Id
data.modelstringModel ID used for the prediction
data.outputsarrayOutput values, usually URL strings; some models return text strings or structured result objects (empty when status is not completed)
data.urlsobjectObject containing related API endpoints
data.urls.getstringURL to retrieve the prediction result
data.statusstringStatus of the task: created, processing, completed, or failed
data.created_atstringISO timestamp of when the request was created (e.g., “2023-04-01T12:34:56.789Z”)
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds

Result Request Parameters

ParameterTypeRequiredDefaultDescription
idstringYes-Task ID

Result Response Parameters

ParameterTypeDescription
codeintegerHTTP status code (e.g., 200 for success)
messagestringStatus message (e.g., “success”)
dataobjectThe prediction data object containing all details
data.idstringUnique identifier for the prediction
data.modelstringModel ID used for the prediction
data.outputsarray<string | object>Array of generated outputs (empty when status is not completed). Items are usually URL strings, but may be text strings or structured result objects, depending on the model.
data.urlsobjectObject containing related API endpoints
data.urls.getstringURL to poll for the prediction result
data.statusstringStatus: created, processing, completed, or failed
data.created_atstringISO timestamp of when the request was created
data.errorstringError message (empty if no error occurred)
data.timingsobjectObject containing timing details
data.timings.inferenceintegerInference time in milliseconds
© 2026 WaveSpeedAI. All rights reserved.