SAM 3.1 Image
Image editing
Starting price $0.02 / request
Meta's SAM 3 Image finds the objects you name or point at in a photo and returns a mask for each one.
sam-3/imageQuote the input, start the generation with the quote, then poll the job. Set RAYWAKE_API_KEY first; see Authentication.
# 1. Price the exact input (quotes are valid for up to 10 minutes)
curl -s https://api.raywake.com/v1/quotes \
-H "Authorization: Bearer $RAYWAKE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sam-3/image",
"input": {
"image_url": "https://example.com/input.png",
"prompt": "the dog on the sofa"
}
}'
# 2. Start the generation with the quote_id from step 1
curl -s https://api.raywake.com/v1/generate \
-H "Authorization: Bearer $RAYWAKE_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"model": "sam-3/image", "quote_id": "QUOTE_ID", "input": {"image_url":"https://example.com/input.png","prompt":"the dog on the sofa"}}'
# 3. Poll until the status is terminal
curl -s https://api.raywake.com/v1/jobs/JOB_ID \
-H "Authorization: Bearer $RAYWAKE_API_KEY"| Name | Type | Description |
|---|---|---|
image_urlrequired | string (image URL) | URL of the image to be segmented |
prompt | string | Text prompt for segmentation |
text_prompt | string | [DEPRECATED] Use 'prompt' instead. Kept for backward compatibility. |
point_prompts | array of objects | List of point prompts |
box_prompts | array of objects | Box prompt coordinates (x_min, y_min, x_max, y_max). Multiple boxes supported - use object_id to group boxes for the same object or leave empty for separate objects. |
apply_mask | boolean | Apply the mask on the image. |
sync_mode | boolean | If True, the media will be returned as a data URI. |
output_format | string (enum) | The format of the generated image. |
return_multiple_masks | boolean | If True, upload and return multiple generated masks as defined by `max_masks`. |
max_masks | number (enum) | Maximum number of masks to return when `return_multiple_masks` is enabled. |
include_scores | boolean | Whether to include mask confidence scores. |
include_boxes | boolean | Whether to include bounding boxes for each mask (when available). |
A succeeded job lists its results under outputs, stored on our side. See Jobs for every field.
"outputs": [
{ "type": "image", "url": "https://…", "mime_type": "image/png", "thumbnail_url": "https://…" }
]The exact charge for your input comes from a quote. How charges settle
Fields marked * are required. Review the price before generating.
Upload an image and say what to select, such as "wheel" or "the dog on the sofa". You can also mark the object with points or boxes instead of words, or combine both to refine one object.
The result is a mask image, applied over the photo or on its own, in PNG, JPEG or WebP. On request it also returns several masks, a confidence score and a bounding box for each mask.
Compare each mask with the source at the edges and around overlapping objects. A confidence score is a selection aid, not proof that every pixel is correct.