Evf Sam

Usage-based pricing
ae_evf_sam

Create a mask or cutout for objects or areas in an image using a text description, with options to refine the mask.

SegmentationImage
Usage-based pricing

Pricing

The charge per call is (max(6 × billable usage, 0)) AE credits. All applicable conditions are combined to calculate the total.

Requests with a negative prompt incur twice the billable usage.

Parameters

Optional parameters use the platform defaults when omitted.

ParameterTypeRequiredDescriptionDefault
request_bodyobjectYesNo parameter description.—
request_body.promptstringYesThe prompt to generate segmentation from.—
request_body.blur_maskintegerNoApply Gaussian blur to the mask. Value determines kernel size (must be odd number)0
request_body.image_urlstringYesURL of the input image—
request_body.mask_onlybooleanNoOutput only the binary mask instead of masked imagetrue
request_body.fill_holesbooleanNoFill holes in the mask using morphological operationsfalse
request_body.expand_maskintegerNoExpand/dilate the mask by specified pixels0
request_body.revert_maskbooleanNoInvert the mask (background becomes foreground and vice versa)false
request_body.semantic_typebooleanNoEnable semantic level segmentation for body parts, background or multi objectsfalse
request_body.negative_promptstring | unknownNoAreas to exclude from segmentation (will be subtracted from prompt results)—
request_body.use_grounding_dinobooleanNoUse GroundingDINO instead of SAM for segmentationfalse

Invocation example

Copy the request and explore its response example.

POST/agent-api/v1/tool/executeX-Api-Key

Submit first, then query with the returned task_id until the task completes.

Request coderequest.sh
curl --request POST \
  --url 'https://agentearth.ai/agent-api/v1/tool/execute?tool_name=ae_evf_sam' \
  --header "X-Api-Key: $AGENTEARTH_API_KEY" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "params": {
    "request_body": {
      "fill_holes": true,
      "image_url": "https://agentearth.ai/fileserver/file/a0267fff-74ae-466b-a9b8-a578e25f2c67.png",
      "mask_only": true,
      "prompt": "humanoid robot"
    }
  }
}'
Response exampleresponse.json
JSON
{
  "description": "task accepted; poll the result via query_tool with this task_id",
  "query_tool": "ae_get_result",
  "status": "created",
  "task_id": "d5721224-bcd9-46e3-91b4-05cb821f9e52"
}