Segment objects
Get object masks for an image from point, box or text prompts.
Send at least one prompt. Text prompts return a mask for every instance of the concept, each labelled with the text it answers.
Authorization
AuthorizationheaderrequiredBearer sk-orb-v1-…, your API key, or a free test key (sk-orb-test-…; no account? get one withPOST /sandbox/keys).
Request body
JSON, with Content-Type: application/json.
modelstringrequiredThe segmentation model to run, e.g.
meta/sam-3. The live models for this endpoint are listed below.imagestringrequiredThe image, base64 JPEG or PNG (a
data:URL works too). Under 4 MB of base64.pointsnumber[][]Up to 32
[x, y]pixel positions on the object.boxesnumber[][]Up to 32 boxes, each
[x0, y0, x1, y1]in pixels.textstring | string[]What to find, e.g.
"red cup", or up to 16 phrases. For models that take text (e.g. SAM 3).
Response
idstringUnique id of this call, e.g.
seg_48213. It matches the call in your Activity dashboard.modelstringThe model that answered.
backendstring"http": the real model ran on a GPU."simulated": stand-in output of the same shape, as test keys get.sandboxbooleantruewhen the call was made with a test key: the output is simulated, nothing ran on a GPU and nothing was charged. Absent otherwise.masksobject[]One per object found.
Show 5 child attributes
scorenumberConfidence, 0–1.
boxnumber[4]The mask's bounding box,
[x0, y0, x1, y1]in pixels.areaintegerMask area in pixels.
rleobjectThe mask as uncompressed COCO RLE:
{ size: [height, width], counts }, column-major (the formatpycocotoolsdecodes).textstringFor text prompts: the phrase this mask answers.
usageobjectWhat the call cost.
Show 2 child attributes
cost_usdnumberCharged to your credits, in US dollars.
latency_msintegerTime the model took, in milliseconds.
Errors
The errors every endpoint shares: invalid input, keys, credits and cold starts. See Errors.
Models
7 live models for /segment. Each page has a ready-made request.