SAM 2 API

Also written: Segment Anything 2, sam2

Promptable image and video segmentation model with streaming memory. It is widely used in robot pipelines to segment and track target objects across frames.

Live$0.10 per 1,000 callsGet an API key

Call SAM 2

Send one request with your API key. The response comes back in the same call. See the API reference for every field.

import os, requests res = requests.post(  "https://api.openrobotics.dev/v1/segment",  headers={"Authorization": f"Bearer {os.environ['OPENROBOTICS_API_KEY']}"},  json={    "model": "meta/sam-2",    "image": "<base64 JPEG or PNG>",    "points": [[320, 240]],  },).json()res["masks"][0]["rle"]  # COCO RLE mask

GPUs start on demand. If SAM 2 hasn't been called for a while, the first request returns 503 with a Retry-After header while it boots (usually a few minutes, never billed).

Guides about SAM 2

SAM 2 explained: image masks, video memory, and RLE
Learn how SAM 2 segments images and videos, what the single-image API actually supports, and how to decode COCO RLE with tested offline Python.
SAM 3: Segment Anything with Concepts, explained
What SAM 3 is, how concept prompts differ from SAM 2's clicks, what SAM 3D Body and SAM 3D Objects add, the SAM License, and how to call SAM 3 by API.
Physical AI explained: the open model stack for robots
What physical AI (embodied AI) means, the five kinds of models a robot uses, from perception to VLAs and world models, and open examples of each.
Embodied AI: what it is, the model stack and benchmarks
What embodied AI means, how it differs from physical AI, the models an embodied agent runs (perception to world models), key benchmarks and companies.

SAM 2 FAQ

How do I run SAM 2 without my own GPU?
Call POST /v1/segment on the OpenRobotics API with "model": "meta/sam-2". We run SAM 2 on cloud GPUs that start on demand, so there is nothing to install or host.
How much does the SAM 2 API cost?
$0.10 per 1,000 calls, billed only for successful calls. Pay with prepaid credits or monthly pay-as-you-go.
What license does SAM 2 use?
The weights we serve (facebook/sam2.1-hiera-small) are released under Apache-2.0. Check the license for your use case.
Is SAM 2 open source?
SAM 2's weights are publicly available under Apache-2.0. OpenRobotics serves them behind an API so you can use the model without hosting it.

Run SAM 2 with one API call

Create a key, send POST /v1/segment with "model": "meta/sam-2", and pay $0.10 per 1,000 calls.

Get an API keyRead the /v1/segment referenceBrowse segmentation models