tongflow-modal-sam3

July 4, 2026 · View on GitHub

Official TongFlow plugin. Text-guided image/video matting with SAM 3 / SAM 3.1 (Meta, facebook/sam3 + facebook/sam3.1 Object Multiplex), running on a GPU via Modal.

Capabilities

  • Image editing (image-edit) — describe a concept ("the dog", "players in white") and get every instance cut out as a transparent PNG.
  • Video editing (video-edit) — track every instance of the concept through the video (SAM 3.1 Object Multiplex, ~7x faster multi-object tracking) and return a green-screen matte, original audio kept.

Credentials

Add in TongFlow Settings (gear icon, top-right):

KeyRequiredNotes
MODAL_TOKEN_IDCreate at modal.com/settings/tokens.
MODAL_TOKEN_SECRETPaired with MODAL_TOKEN_ID.
HF_TOKENThe checkpoints are gated: request access on facebook/sam3 and facebook/sam3.1, then use that account's token.

On first use the plugin deploys to your Modal account automatically and caches the build; weights are cached on a shared Modal volume.

Tuning (env, optional)

EnvDefaultNotes
SAM3_CONFIDENCE0.5Detection confidence threshold.
SAM3_MAX_VIDEO_SECONDS60Videos are trimmed to this length.
SAM3_MAX_VIDEO_WIDTH1280Videos are downscaled to at most this width.