Model API

SAM 3.1 Image

SAM 3.1 finds and segments the objects you describe in an image, and handles many objects at once.

Model id

Use this in every request
sam-3-1/image

Run it

Quote 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-1/image",
  "input": {
    "image_url": "https://example.com/input.png",
    "prompt": "A red ceramic cup on a wooden table, soft morning light"
  }
}'

# 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-1/image", "quote_id": "QUOTE_ID", "input": {"image_url":"https://example.com/input.png","prompt":"A red ceramic cup on a wooden table, soft morning light"}}'

# 3. Poll until the status is terminal
curl -s https://api.raywake.com/v1/jobs/JOB_ID \
  -H "Authorization: Bearer $RAYWAKE_API_KEY"

Input

Input fields for sam-3-1/image
NameTypeDescription
image_urlrequiredstring (image URL)
URL of the image to be segmented
promptstring
Text prompt for segmentation

Default: wheel

point_promptsarray of objects
List of point prompts
box_promptsarray 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_maskboolean
Apply the mask on the image.

Default: true

sync_modeboolean
If True, the media will be returned as a data URI.

Default: false

output_formatstring (enum)
The format of the generated image.

Default: png

One of: jpeg, png, webp

return_multiple_masksboolean
If True, upload and return multiple generated masks as defined by `max_masks`.

Default: false

max_masksnumber (enum)
Maximum number of masks to return when `return_multiple_masks` is enabled.

Default: 3

One of: 3

include_scoresboolean
Whether to include mask confidence scores.

Default: false

include_boxesboolean
Whether to include bounding boxes for each mask (when available).

Default: false

Output

A succeeded job lists its results under outputs, stored on our side. See Jobs for every field.

Job excerpt
"outputs": [
  { "type": "image", "url": "https://…", "mime_type": "image/png", "thumbnail_url": "https://…" }
]

Pricing

  • 1 request$0.02/ request

The exact charge for your input comes from a quote. How charges settle