Skip to content

Segment Anything Model 3

Integrate

Model id sam-3/image
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/sam-3/image?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

This request: ≈$0.005 5 API credits Run it on this page

Get API key
Meta Image Editing #segmentation#mask#real-time

Text-, point- or box-prompted image segmentation returning mask images, with optional scores and boxes

Meta · Image

Your first result goes here

Build a request below and run it with your API key. Outputs are copied to our storage, kept forever or 7 days for free.

Build a request

Controls are generated from the model schema. The code and the price update as you change them.

default wheel

Text instruction guiding segmentation.

•required image_url
Drop a file, or

URL pointing to the image for segmentation.

Advanced text_prompt · output_format · max_masks · apply_mask · return_multiple_masks · include_scores · include_boxes · point_prompts · box_prompts

[DEPRECATED] Legacy input retained for backward compatibility; use 'prompt' in its place.

output_format default png

File format for the resulting image.

default 3

Upper limit on returned masks when `return_multiple_masks` is enabled.

default []

Collection of point-based prompts.

default []

Box prompts whose object_id determines grouping: matching IDs associate boxes with one object, while empty IDs represent separate objects. Multiple boxes may be supplied, each using coordinates (x_min, y_min, x_max, y_max).

POST /run/sam-3/image?wait=20 quote → $0.005
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/sam-3/image?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

Run this request

Your key stays in this browser: it is sent only to the Doitong API and saved (localStorage) only if you tick Remember. Get an API key

About Segment Anything Model 3

Segments an image with SAM 3 from a text `prompt`, `point_prompts` or `box_prompts`. With `return_multiple_masks` enabled it returns up to `max_masks` masks (1 to 32). Optional confidence scores and bounding boxes can be included. Output format is jpeg, png or webp.

Parameters

Send either the canonical name or the native name, not both. Canonical names

NameType DefaultAllowed Description
image_urlrequired image
Typeurl · image
URL pointing to the image for segmentation.
promptoptional
Typestring
Defaultwheel
Text instruction guiding segmentation.
text_promptoptional
Typestring | null
[DEPRECATED] Legacy input retained for backward compatibility; use 'prompt' in its place.
point_promptsoptional
Typeobject[]
Default[]
Collection of point-based prompts.
point_prompts[].xoptional
Typeinteger | null
Prompt position along the X axis.
point_prompts[].yoptional
Typeinteger | null
Prompt position along the Y axis.
point_prompts[].labeloptional
Typeenum
01
Foreground/background label: 1 indicates foreground; 0 indicates background.
point_prompts[].object_idoptional
Typeinteger | null
Optional identifier grouping prompts that refine a single object. If text is also supplied as a prompt, this identifier determines which detected object those points refine.
point_prompts[].frame_indexoptional
Typeinteger | null
Index identifying the frame for interaction.
box_promptsoptional
Typeobject[]
Default[]
Box prompts whose object_id determines grouping: matching IDs associate boxes with one object, while empty IDs represent separate objects. Multiple boxes may be supplied, each using coordinates (x_min, y_min, x_max, y_max).
box_prompts[].x_minoptional
Typeinteger | null
Minimum x-coordinate for the box.
box_prompts[].y_minoptional
Typeinteger | null
Minimum y-coordinate for the box.
box_prompts[].x_maxoptional
Typeinteger | null
Maximum X coordinate for the box.
box_prompts[].y_maxoptional
Typeinteger | null
Maximum Y coordinate for the box.
box_prompts[].object_idoptional
Typeinteger | null
Optional identifier grouping boxes that refine a single object.
box_prompts[].frame_indexoptional
Typeinteger | null
Index identifying the frame for interaction.
apply_maskoptional
Typeboolean
Defaulttrue
Controls whether the image has the mask applied.
output_formatoptional
Typeenum
Defaultpng
jpegpngwebp
File format for the resulting image.
return_multiple_masksoptional
Typeboolean
Defaultfalse
Multiple-mask return option: enabling it uses `max_masks` to determine how many generated masks to upload and include in the response.
max_masksoptional
Typeinteger
Default3
1 – 32
Upper limit on returned masks when `return_multiple_masks` is enabled.
include_scoresoptional
Typeboolean
Defaultfalse
Controls inclusion of confidence scores for masks.
include_boxesoptional
Typeboolean
Defaultfalse
Controls inclusion of a bounding box for each mask, if available.
required Canonical name, also accepted

File parameters take a public https:// URL, a data: URI up to 10 MB, or the file_url of an upload. Files

Output

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "sam-3/image",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 5,
    "usd": "0.005",
    "charged": 5,
    "refunded": 0
  },
  "input": {
    "image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  },
  "output": {
    "image": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_name": "0-output.jpeg",
      "file_size": 1843200,
      "width": 1024,
      "height": 768
    },
    "masks": [
      {
        "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
        "content_type": "image/jpeg",
        "file_name": "0-output.jpeg",
        "file_size": 1843200,
        "width": 1024,
        "height": 768
      }
    ],
    "metadata": [
      {
        "index": 1,
        "score": 1.0,
        "box": [
          1.0
        ]
      }
    ],
    "scores": [
      1.0
    ],
    "boxes": [
      [
        1.0
      ]
    ]
  },
  "outputs": [
    {
      "type": "image",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_size": 1843200,
      "width": 1024,
      "height": 768,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
Your files, your choiceEvery outputs[].url is a copy on our storage: kept forever (paid per GB-month) or 7 days for free, by your account setting or ?storage=.
Same shape on every modeltype, url, content_type, width, height and duration, for images, video and audio alike. output is the model’s own result object.
Fields of output
image
object {url, content_type, file_name, file_size, width, height} | nullPreview showing the primary segmentation mask.
masks
array of object {url, content_type, file_name, file_size, width, height}Images containing segmentation masks.
metadata
array of object {index, score, box} | nullMetadata for each mask, including its score and box.
scores
array of number | nullConfidence score for each mask, provided when requested.
boxes
array of array of number | nullNormalized boxes for each mask, expressed as [cx, cy, w, h], if requested.

More models: Image Editing

For AI agents: this page as Markdown is at https://doitong.com/en-US/developers/models/sam-3/image.md. All models and guides: https://doitong.com/developers/llms.txt