Skip to content

Moondream3 Preview [Segment]

Integrate

Model id moondream3-preview/segment
# 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/moondream3-preview/segment?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",
    "object": "fox"
  }'

# 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.003 3 API credits Run it on this page

Get API key
Moondream Image Editing Reference inputs #mask#segmentation

Segments a named object in an image, returning a mask, bounding box and SVG path

Moondream · 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.

•required image_url
Drop a file, or

URL pointing to the image for processing.

•required

Target object for segmentation within the image.

Advanced preview · spatial_references · settings

Spatial guidance for segmentation, supplied as a list of Point objects whose members are x and y, or as a list of coordinate arrays. Each array must contain either 2 floats (x,y) or 4 floats (x1,y1,x2,y2).

Segmentation model settings that control sampling.

POST /run/moondream3-preview/segment?wait=20 quote → $0.003
# 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/moondream3-preview/segment?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",
    "object": "fox"
  }'

# 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 Moondream3 Preview [Segment]

Segments the object given in `object` within the image at `image_url`. The result can include a mask image, a bounding box and SVG path data; these are null if nothing is detected. `spatial_references` can supply points to guide the segmentation, and `settings` adjusts sampling. Set `preview` to get a binary mask.

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 processing.
objectrequired
Typestring
Target object for segmentation within the image.
spatial_referencesoptional
Typeany[]
Spatial guidance for segmentation, supplied as a list of Point objects whose members are x and y, or as a list of coordinate arrays. Each array must contain either 2 floats (x,y) or 4 floats (x1,y1,x2,y2).
settingsoptional
Typeobject
Segmentation model settings that control sampling.
settings.temperatureoptional
Typenumber
Default1
0 – 1
Sampling temperature sets the balance between focused, deterministic output at low settings and greater randomness at high settings.
settings.top_poptional
Typenumber
Default1
0 – 1
Probability mass for nucleus sampling, ranging from 0 to 1.
settings.max_tokensoptional
Typeinteger | null
≥ 1
Upper limit on generated tokens.
previewoptional
Typeboolean
Defaultfalse
Whether to return the image's binary mask along with an output preview.
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": "moondream3-preview/segment",
  "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": 3,
    "usd": "0.003",
    "charged": 3,
    "refunded": 0
  },
  "input": {
    "image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg",
    "object": "fox"
  },
  "output": {
    "finish_reason": "stop",
    "usage_info": {
      "input_tokens": 1,
      "output_tokens": 1,
      "prefill_time_ms": 1.0,
      "decode_time_ms": 1.0,
      "ttft_ms": 1.0
    },
    "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
    },
    "path": "M.657,.996C.610,.984,.529,.938,.447,.875C.411,.848,.363,.815,.341,.802C.188,.714,.093,.623,.038,.511C.011,.455,.000,.406,.000,.340C.000,.269,.006,.234,.025,.186C.051,.123,.092,.079,.161,.042C.240,-0.000,.355,-0.011,.433,.017C.462,.027,.535,.066,.571,.091C.701,.180,.807,.265,.850,.311C.911,.379,.962,.468,.984,.545C.995,.585,.997,.601,.997,.664C.997,.765,.984,.811,.935,.879C.878,.958,.796,1.001,.705,1.000C.685,.999,.664,.998,.657,.996z",
    "bbox": {
      "x_min": 1.0,
      "y_min": 1.0,
      "x_max": 1.0,
      "y_max": 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
finish_reason
stringReason that output generation ended.
usage_info
object {input_tokens, output_tokens, prefill_time_ms, decode_time_ms, ttft_ms}Request usage details.
image
object {url, content_type, file_name, file_size, width, height} | nullSegmentation preview result: null if preview generation was not requested or object detection found nothing; otherwise, an image containing the mask.
path
string | nullSVG path data returned when a segmentation mask is detected; otherwise, null.
bbox
object {x_min, y_min, x_max, y_max} | nullBounding box returned for a detected, segmented object; otherwise, null.

More models: Image Editing

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