[Integrations](https://spiral.ai/integrations) › [Grok](https://spiral.ai/integrations/grok) › [SAM 3.1 Image](https://spiral.ai/integrations/grok/sam-3-1-image)

# How to Use SAM 3.1 Image in Grok

SAM 3.1 Image extracts object masks from photos using short descriptions, points, or boxes. Use it for product cutouts, editing selections, and draft annotations.

|  |  |
| --- | --- |
| Model | SAM 3.1 Image |
| Available through | fal |
| Category | Image |
| Price | $0.013 per run at the default inputs. |
| Returns | image |
| Runs | In the background |
| Setup | About 2 minutes, no API key |

## Prompts to try with SAM 3.1 Image in Grok

- Use SAM 3.1 Image to select the "red backpack" in this photo. Show the mask over the original so I can check the outline.
- Use SAM 3.1 Image to select "chair" in this room photo. Return separate selections and help me check whether any chairs were missed.
- Use SAM 3.1 Image to select the jacket in this portrait. Prepare its mask for a separate color edit.
- Use SAM 3.1 Image to isolate the lamp inside the box I marked on this photo. Show the selection before preparing a cutout.
- Use SAM 3.1 Image to select "screen" in this photo. Show every returned selection so I can review the areas for a later blur step.

## How to set up SAM 3.1 Image in Grok

Pick the way that suits you. Each takes about two minutes.

### Use the Grok connector

1. **Add a custom connector**: In Grok open Settings › Connect Apps, then Add a custom connector. Name it Spiral, paste this URL, leave Headers empty and click Add MCP.

```text
https://api.spiral.ai/mcp
```

2. **Sign in to Spiral and approve**: Grok opens Spiral: sign in, pick the organization and click Authorize. Spiral gives the connection its own API key; Grok never sees it, and you can remove the connection under Settings › Connected apps.

3. **Check that it is connected**: Connect Apps › Custom shows Spiral as Connected. It works in every Grok chat and Grok bot.

### Use the Spiral skill

1. **Send Grok this message**: Your agent reads Spiral's skill and sets itself up.

```
set up https://spiral.ai/SKILL.md
```

2. **Sign in or paste a key**: Approve Spiral in the browser, or give the agent a key from the console.

### Use the Spiral CLI

1. **Install and sign in**: Installs the Spiral CLI, signs you in and adds its skill to your coding agents.

```bash
npx -y spiral-cli@latest init
```

### Call the Spiral API

1. **Create an API key**: In the console, under API keys.

2. **Run SAM 3.1 Image**: One request; the result comes back by polling or a webhook.

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "fal",
    "model": "fal-ai/sam-3-1/image",
    "input": {
      "image_url": "https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/notebooks/images/truck.jpg"
    }
  }'
```

Then paste one of the prompts above: Grok finds SAM 3.1 Image on Spiral, shows the price and runs it.

Setup guide in the docs: https://spiral.ai/docs/quickstarts/grok

## SAM 3.1 Image tools and prices

- [Sam 3 1 · Image to Image](https://spiral.ai/tools/fal/fal-ai/sam-3-1/image) (fal): $0.013 per run at the default inputs.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| prompt |  | wheel | Text prompt for segmentation |
| point_prompts |  | [] | List of point prompts |
| box_prompts |  | [] | 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 |  | true | Apply the mask on the image. |
| output_format | jpeg, png, webp | png | The format of the generated image. |
| return_multiple_masks |  | false | If True, upload and return multiple generated masks as defined by `max_masks`. |

## What can you do with SAM 3.1 Image in Grok?

Turn a shared photo into selections for cutouts, edits, or object review. A chat app can help choose a short description and show the resulting masks against the original image.

### Product cutout preparation

Select a shoe, bag, or other product in a photo, then use its mask to prepare a cutout. Inspect the selection before placing it on a new background.

### Selective photo edits

Extract a mask for a jacket, chair, or car so an image editor can apply a color or exposure change to that object.

### Draft segmentation annotations

Generate object masks for a labeled image dataset. Have an annotator correct the selections before accepting them as training labels.

### Object crop preparation

Locate objects in a photo and use their bounding boxes to prepare individual crops for a catalog or review sheet.

### Count review

Request separate selections for a visible category, such as chairs or bottles. Compare the masks with the photo to produce a reviewed count.

### Redaction preparation

Select visible screens or license plates to prepare masks for a separate blur or pixelation step. Review the full photo for missed regions before sharing.

## Overview

- [fal](https://spiral.ai/providers/fal)
- [All Grok guides](https://spiral.ai/integrations/grok)

## SAM 3.1 Image in other agents

- [Amp](https://spiral.ai/integrations/amp/sam-3-1-image)
- [ChatGPT](https://spiral.ai/integrations/chatgpt/sam-3-1-image)
- [Claude](https://spiral.ai/integrations/claude-desktop/sam-3-1-image)
- [Claude Code](https://spiral.ai/integrations/claude-code/sam-3-1-image)
- [Cline](https://spiral.ai/integrations/cline/sam-3-1-image)
- [Codex](https://spiral.ai/integrations/codex/sam-3-1-image)
- [Cursor](https://spiral.ai/integrations/cursor/sam-3-1-image)
- [Devin](https://spiral.ai/integrations/devin/sam-3-1-image)
- [dots](https://spiral.ai/integrations/dots/sam-3-1-image)
- [Factory Droid](https://spiral.ai/integrations/factory-droid/sam-3-1-image)
- [Gemini](https://spiral.ai/integrations/gemini/sam-3-1-image)
- [Gemini CLI](https://spiral.ai/integrations/gemini-cli/sam-3-1-image)
- [Google Antigravity](https://spiral.ai/integrations/antigravity/sam-3-1-image)
- [goose](https://spiral.ai/integrations/goose/sam-3-1-image)
- [Grok Build](https://spiral.ai/integrations/grok-build/sam-3-1-image)
- [Hermes](https://spiral.ai/integrations/hermes/sam-3-1-image)
- [Instinct](https://spiral.ai/integrations/instinct/sam-3-1-image)
- [Manus](https://spiral.ai/integrations/manus/sam-3-1-image)
- [Muse](https://spiral.ai/integrations/muse/sam-3-1-image)
- [Muse Code](https://spiral.ai/integrations/muse-code/sam-3-1-image)
- [n8n](https://spiral.ai/integrations/n8n/sam-3-1-image)
- [Notion](https://spiral.ai/integrations/notion/sam-3-1-image)
- [OpenClaw](https://spiral.ai/integrations/openclaw/sam-3-1-image)
- [opencode](https://spiral.ai/integrations/opencode/sam-3-1-image)
- [Perplexity](https://spiral.ai/integrations/perplexity/sam-3-1-image)
- [Raycast](https://spiral.ai/integrations/raycast/sam-3-1-image)
- [VS Code](https://spiral.ai/integrations/vscode/sam-3-1-image)
- [Windsurf](https://spiral.ai/integrations/windsurf/sam-3-1-image)
- [Zapier](https://spiral.ai/integrations/zapier/sam-3-1-image)

## More Grok guides

- [SAM 3 Image](https://spiral.ai/integrations/grok/sam-3-image)
- [SAM 3.1 Image to RLE](https://spiral.ai/integrations/grok/sam-3-1-image-to-rle)
- [RunDiffusion Photo Flux](https://spiral.ai/integrations/grok/rundiffusion-photo-flux)
- [Sana](https://spiral.ai/integrations/grok/sana)
- [Rembg Enhance](https://spiral.ai/integrations/grok/rembg-enhance)
- [Sana 1.5 1.6B](https://spiral.ai/integrations/grok/sana-1-5-1-6b)

## Questions about SAM 3.1 Image in Grok

**Can Grok use SAM 3.1 Image?**

Yes. Add Spiral to Grok as an MCP server, and Grok can find and run SAM 3.1 Image like any built-in tool.

**How much does SAM 3.1 Image cost in Grok?**

$0.013 per run at the default inputs. You pay from your Spiral balance as you go, with no subscription, and a failed run is not charged. Your Grok plan is separate.

**Do I need a fal account to use SAM 3.1 Image in Grok?**

No. Spiral runs SAM 3.1 Image on its own fal account. You sign in to Spiral once and never paste a key.

**How long does it take to set up SAM 3.1 Image in Grok?**

About two minutes: add a custom connector, then sign in to Spiral and approve, then check that it is connected.

**Does Grok wait while SAM 3.1 Image runs?**

SAM 3.1 Image runs in the background. Grok starts the run, checks on it and gives you the image when it's ready.

**What is SAM 3.1 Image useful for?**

Use it to select objects in existing photos. The resulting masks can support product cutouts, selective edits, and draft image annotations.

**How should I describe the object I want?**

Start with a short phrase such as "red backpack" or "car wheel." Meta documents limitations with longer instructions involving complex spatial relationships, so use a point or box to clarify the target.

**Can SAM 3.1 select several objects of the same type?**

Concept segmentation targets all matching instances, such as the chairs in a room. Review the returned masks before using them as a count or completed annotation.

**What size are the segmentation masks?**

Meta's reference implementation resizes binary masks to the original image dimensions. Use those dimensions when aligning a mask with the source photo.

**Can I correct a selection with points?**

Yes. Points associated with the same object refine its selection; use them when the text description leaves the target ambiguous.

