Sam3 Video Serverless API

SAM 3 Video excels in real-time video segmentation and tracking of diverse objects using natural language and prompts.

~114.67s
~$0.13
 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

POSThttps://api.segmind.com/v1/sam3-video

Parameters

videorequired
string (uri)

Upload a video of up to 5 minutes in duration. Choose clear, well-lit videos for best results.

boxes_inputoptional
string

Provide bounding boxes for tracking. Use: [[50, 50, 200, 200]] to track one region.

Default: null
obj_idsoptional
integer

Assign unique IDs for objects. Single object: 1, multiple: [1, 2].

Default: 1
point_labels_inputoptional
string

Set labels for points: 1 for foreground. For dual labels, use: [[1, 0]].

Default: null
points_inputoptional
string

Identify points to track specific objects. Example: [[100, 200], [150, 250]] for multiple points.

Default: null
return_overlayoptional
boolean

Check to receive colored overlay. Uncheck for binary mask return.

Default: true
text_promptoptional
string

Specify an object to segment automatically; e.g., 'car'. Leave empty for manual selection.

Default: null

Response Type

Returns: Video

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out