## Basic model info - Model name: meta/meta sam-3 - Model description: Meta Segment Anything Model 3 segments prompted objects in images and videos, returning rendered masks or compact RLE data. - Endpoint name: video-rle ## Model schema The model schema is defined in the OpenAPI schema: [OpenAPI Schema](https://oapi.sunra.ai/main/meta/sam-3/a5de3f0ac9fefd6e6d291f0105d486b4f8b7970e.json) ### Model input schema The model input schema is: ```json { "additionalProperties": false, "properties": { "prompt": { "default": "", "title": "Prompt", "type": "string" }, "video_url": { "anyOf": [ { "format": "uri", "maxLength": 2083, "minLength": 1, "type": "string" }, { "type": "string" } ], "description": "Video to segment; at most 10 seconds and 240 counted input frames.", "title": "Video Url" }, "apply_mask": { "default": false, "title": "Apply Mask", "type": "boolean" }, "boundingbox_zip": { "default": false, "title": "Boundingbox Zip", "type": "boolean" }, "box_prompts": { "items": { "additionalProperties": false, "properties": { "object_id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Object Id" }, "x_max": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "X Max" }, "x_min": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "X Min" }, "y_max": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Y Max" }, "y_min": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Y Min" } }, "title": "BoxPrompt", "type": "object" }, "title": "Box Prompts", "type": "array" }, "detection_threshold": { "default": 0.5, "maximum": 1, "minimum": 0.01, "title": "Detection Threshold", "type": "number" }, "frame_index": { "default": 0, "title": "Frame Index", "type": "integer" }, "mask_url": { "anyOf": [ { "format": "uri", "maxLength": 2083, "minLength": 1, "type": "string" }, { "type": "string" }, { "type": "null" } ], "title": "Mask Url" }, "point_prompts": { "items": { "additionalProperties": false, "properties": { "label": { "anyOf": [ { "enum": [ 0, 1 ], "type": "integer" }, { "type": "null" } ], "title": "Label" }, "object_id": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Object Id" }, "x": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "X" }, "y": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "title": "Y" } }, "title": "PointPrompt", "type": "object" }, "title": "Point Prompts", "type": "array" } }, "required": [ "video_url" ], "title": "Sam3VideoRleInput", "type": "object" } ``` ### Model output schema The model output schema is: ```json { "anyOf": [ { "additionalProperties": false, "properties": { "boxes": { "title": "Boxes" }, "image": { "anyOf": [ { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" }, { "type": "null" } ] }, "masks": { "items": { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" }, "title": "Masks", "type": "array" }, "metadata": { "title": "Metadata" }, "scores": { "title": "Scores" } }, "required": [ "masks" ], "title": "ImageOutput", "type": "object" }, { "additionalProperties": false, "properties": { "boundingbox_frames_zip": { "anyOf": [ { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" }, { "type": "null" } ] }, "boxes": { "title": "Boxes" }, "metadata": { "title": "Metadata" }, "objects": { "title": "Objects" }, "rle": { "description": "Complete inline RLE data for small results. Exactly one of rle and rle_json is returned; large results use rle_json and are never truncated.", "title": "Rle" }, "rle_json": { "anyOf": [ { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" }, { "type": "null" } ], "description": "JSON asset containing the complete rle, boxes, metadata, scores, and objects values for large results. Its content_type is application/json. Exactly one of rle and rle_json is returned." }, "rle_summary": { "anyOf": [ { "additionalProperties": false, "properties": { "delivery": { "const": "file", "description": "The complete structured RLE result is stored in rle_json.", "title": "Delivery", "type": "string" }, "json_bytes": { "description": "Exact UTF-8 byte size of the JSON artifact.", "minimum": 1, "title": "Json Bytes", "type": "integer" }, "object_entries": { "description": "Top-level object-track entry count.", "minimum": 0, "title": "Object Entries", "type": "integer" }, "rle_entries": { "description": "Top-level RLE entry count.", "minimum": 0, "title": "Rle Entries", "type": "integer" } }, "required": [ "delivery", "json_bytes", "rle_entries", "object_entries" ], "title": "RleSummary", "type": "object" }, { "type": "null" } ], "description": "Delivery metadata present exactly when rle_json is returned." }, "scores": { "title": "Scores" }, "units": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "title": "Units" } }, "title": "RleOutput", "type": "object" }, { "additionalProperties": false, "properties": { "boundingbox_frames_zip": { "anyOf": [ { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" }, { "type": "null" } ] }, "units": { "anyOf": [ { "type": "number" }, { "type": "null" } ], "title": "Units" }, "video": { "properties": { "content_type": { "description": "The mime type of the file.", "title": "Content Type", "type": "string" }, "file_name": { "description": "The name of the file. It will be auto-generated if not provided.", "title": "File Name", "type": "string" }, "file_size": { "description": "The size of the file in bytes.", "title": "File Size", "type": "integer" }, "url": { "description": "The URL where the file can be downloaded from.", "title": "Url", "type": "string" } }, "required": [ "content_type", "file_name", "file_size", "url" ], "title": "SunraFile", "type": "object" } }, "required": [ "video" ], "title": "VideoOutput", "type": "object" } ], "title": "Response Get Request Result Requests Request Id Get" } ``` ## Example inputs and outputs Use the following example inputs and outputs to understand the model. ### Input example ```json { "prompt": "", "video_url": "", "apply_mask": false, "boundingbox_zip": false, "box_prompts": [ ], "detection_threshold": 0.5, "frame_index": 0, "mask_url": null, "point_prompts": [ ] } ``` ### Output example ```json { } ``` ## Model code examples ### JavaScript ```javascript import { sunra } from "@sunra/client"; const result = await sunra.subscribe("meta/sam-3/video-rle", { input: { video_url: '', prompt: '', mask_url: null, detection_threshold: 0.5, box_prompts: [], boundingbox_zip: false, apply_mask: false, frame_index: 0, point_prompts: [] }, logs: true, onQueueUpdate: (update) => { console.log(`Status Update: ${update.status}, Request ID: ${update.request_id}`); }, }); console.log(result.data); console.log(result.requestId); ``` ### Python ```python import sunra_client result = sunra_client.subscribe( "meta/sam-3/video-rle", arguments={ "video_url": "", "prompt": "", "mask_url": None, "detection_threshold": 0.5, "box_prompts": [], "boundingbox_zip": False, "apply_mask": False, "frame_index": 0, "point_prompts": [] }, with_logs=True, on_enqueue=print, on_queue_update=print, ) print(result) ``` ### Java ```java import ai.sunra.client.*; import java.util.Map; import com.google.gson.JsonObject; var client = SunraClient.withEnvCredentials(); var response = client.subscribe( "meta/sam-3/video-rle", SubscribeOptions.builder() .input(Map.of( "video_url", "", "prompt", "", "mask_url", null, "detection_threshold", 0.5, "box_prompts", , "boundingbox_zip", false, "apply_mask", false, "frame_index", 0, "point_prompts", )) .resultType(JsonObject.class) .onQueueUpdate(update -> System.out.printf( "\nStatus Update: %s, Request ID: %s%n", update.getStatus(), update.getRequestId() )) .logs(true) .build() ); System.out.println("Completed!"); System.out.println(response.getData()); ``` ### Kotlin ```kotlin import ai.sunra.client.kt.* import com.google.gson.JsonObject val client = createSunraClient() val response = client.subscribe( endpointId = "meta/sam-3/video-rle", input = mapOf( "video_url" to "", "prompt" to "", "mask_url" to null, "detection_threshold" to 0.5, "box_prompts" to , "boundingbox_zip" to false, "apply_mask" to false, "frame_index" to 0, "point_prompts" to ), options = ai.sunra.client.kt.SubscribeOptions(logs = true), onUpdate = { update -> println("\nStatus Update: ${update.status}, Request ID: ${update.requestId}") } ) println("Completed!") println(response.data) ``` ### Curl ```bash curl --request POST \ --url https://api.sunra.ai/v1/queue/meta/sam-3/video-rle \ --header "Authorization: Key $SUNRA_KEY" \ --header "Content-Type: application/json" \ --data '{"video_url":"","prompt":"","mask_url":null,"detection_threshold":0.5,"box_prompts":[],"boundingbox_zip":false,"apply_mask":false,"frame_index":0,"point_prompts":[]}' ``` ## Model readme > SAM 3 segments objects from text, point, or box prompts. Image and video endpoints return rendered masks; the RLE variants expose compact masks for downstream processing. > > Videos are limited to 10 seconds and 240 counted input frames. Video billing uses one unit per started block of 16 input frames.