Sam3 Video Serverless API
SAM 3 Video excels in real-time video segmentation and tracking of diverse objects using natural language and prompts.
1import requests
2import json
3
4url = "https://api.segmind.com/v1/sam3-video"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "video": "https://segmind-inference-inputs.s3.amazonaws.com/69d83e3a-0162-4aef-8f90-efa5e1f544f2-sam3_video_sample.mp4",
12 "text_prompt": "dog",
13 "obj_ids": 1,
14 "return_overlay": false
15}
16
17response = requests.post(url, headers=headers, json=data)
18
19if response.status_code == 200:
20 result = response.json()
21 print(json.dumps(result, indent=2))
22else:
23 print(f"Error: {response.status_code}")
24 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/sam3-video"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "video": "https://segmind-inference-inputs.s3.amazonaws.com/69d83e3a-0162-4aef-8f90-efa5e1f544f2-sam3_video_sample.mp4",
12 "text_prompt": "dog",
13 "obj_ids": 1,
14 "return_overlay": false
15}
16
17response = requests.post(url, headers=headers, json=data)
18
19if response.status_code == 200:
20 result = response.json()
21 print(json.dumps(result, indent=2))
22else:
23 print(f"Error: {response.status_code}")
24 print(response.text)API Endpoint
https://api.segmind.com/v1/sam3-videoParameters
videorequiredstring (uri)Upload a video of up to 5 minutes in duration. Choose clear, well-lit videos for best results.
boxes_inputoptionalstringProvide bounding boxes for tracking. Use: [[50, 50, 200, 200]] to track one region.
nullobj_idsoptionalintegerAssign unique IDs for objects. Single object: 1, multiple: [1, 2].
1point_labels_inputoptionalstringSet labels for points: 1 for foreground. For dual labels, use: [[1, 0]].
nullpoints_inputoptionalstringIdentify points to track specific objects. Example: [[100, 200], [150, 250]] for multiple points.
nullreturn_overlayoptionalbooleanCheck to receive colored overlay. Uncheck for binary mask return.
truetext_promptoptionalstringSpecify an object to segment automatically; e.g., 'car'. Leave empty for manual selection.
nullResponse Type
Returns: Video
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out