[Integrations](https://spiral.ai/integrations) › [Gemini](https://spiral.ai/integrations/gemini) › [EVF-SAM2](https://spiral.ai/integrations/gemini/evf-sam2)

# How to Use EVF-SAM2 in Gemini

EVF-SAM2 turns an English description into a selection mask for an existing image. Use it to isolate a named object or select hair and background regions with semantic segmentation for later editing.

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

## Prompts to try with EVF-SAM2 in Gemini

- Use EVF-SAM2 on this photo to select the red cup beside the plate. Return the selection mask so I can review it.
- Use EVF-SAM2 on this portrait to select hair using semantic segmentation. Show the mask before I use it for a color change.
- Use EVF-SAM2 on this product photo to select the handbag on the right. Prepare a mask for a later background edit.
- Use EVF-SAM2 on this table photo to select the plate and exclude the fork. Show me the resulting mask.
- Use EVF-SAM2 on this beach photo to select the sea using semantic segmentation. Return a mask for a separate color adjustment.

## How to set up EVF-SAM2 in Gemini

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

### Use the Gemini connector

1. **Open Connected Apps**: On your computer, go to gemini.google.com. At the bottom, click Settings › Connected Apps. If you don't see Connected Apps, click Personal Intelligence first, then Connected Apps.

2. **Add Spiral as a custom app**: Under Custom apps, click Add a custom app and paste this MCP server URL:

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

3. **Sign in to Spiral and approve**: Follow the on-screen instructions. Spiral opens: sign in, pick the organization and click Authorize. No API key.

### Use the Spiral skill

1. **Send Gemini 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 EVF-SAM2**: 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/evf-sam",
    "input": {
      "prompt": "Cat in the middle of the image",
      "image_url": "https://storage.googleapis.com/falserverless/web-examples/evf-sam2/evfsam2-cat.png"
    }
  }'
```

Then paste one of the prompts above: Gemini finds EVF-SAM2 on Spiral, shows the price and runs it.

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

## EVF-SAM2 tools and prices

- [EVF-SAM2 Segmentation](https://spiral.ai/tools/fal/fal-ai/evf-sam) (fal): $0.0065 per run at the default inputs.

## Settings you can ask for

| Setting | Allowed values | Default | Description |
| --- | --- | --- | --- |
| negative_prompt |  | — | Areas to exclude from segmentation (will be subtracted from prompt results) |
| semantic_type |  | false | Enable semantic level segmentation for body parts, background or multi objects |
| mask_only |  | true | Output only the binary mask instead of masked image |
| use_grounding_dino |  | false | Use GroundingDINO instead of SAM for segmentation |
| revert_mask |  | false | Invert the mask (background becomes foreground and vice versa) |
| blur_mask | 0 to 50 | 0 | Apply Gaussian blur to the mask. Value determines kernel size (must be odd number) |

## What can you do with EVF-SAM2 in Gemini?

Select a specific object or region in a photo by describing it in ordinary English. Use EVF-SAM2 to prepare a mask for an edit and inspect the selection before proceeding.

### Product selections for recoloring

Use EVF-SAM2 to mask a specific shoe, bag, or chair in a product photo, then pass the selection to an editing tool.

### Background replacement preparation

Use EVF-SAM2 with semantic segmentation to select a photo's background before replacing it in a separate editing step.

### Hair color previews

Use EVF-SAM2 with semantic segmentation to select hair for a color preview. Inspect the selection before applying the edit.

### One object in a crowded photo

Use EVF-SAM2 to select a target by its location or relationship to another object, such as the cup beside a plate.

### Draft annotation masks

Use EVF-SAM2 to propose object masks from English descriptions, then have an annotator review them before adding them to a dataset.

### Landscape editing selections

Use EVF-SAM2 with semantic segmentation to select a region such as the sea for a later color adjustment.

## Overview

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

## EVF-SAM2 in other agents

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

## More Gemini guides

- [Dodge Burn](https://spiral.ai/integrations/gemini/dodge-burn)
- [Expression Change](https://spiral.ai/integrations/gemini/expression-change)
- [Dissolve](https://spiral.ai/integrations/gemini/dissolve)
- [FASHN Virtual Try-On v1.5](https://spiral.ai/integrations/gemini/fashn-virtual-try-on-v1-5)
- [DDColor](https://spiral.ai/integrations/gemini/ddcolor)
- [FASHN Virtual Try-On v1.6](https://spiral.ai/integrations/gemini/fashn-virtual-try-on-v1-6)

## Questions about EVF-SAM2 in Gemini

**Can Gemini use EVF-SAM2?**

Yes. Add Spiral to Gemini as an MCP server, and Gemini can find and run EVF-SAM2 like any built-in tool.

**How much does EVF-SAM2 cost in Gemini?**

$0.0065 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 Gemini plan is separate.

**Do I need a fal account to use EVF-SAM2 in Gemini?**

No. Spiral runs EVF-SAM2 on its own fal account. You sign in to Spiral once and never paste a key.

**How long does it take to set up EVF-SAM2 in Gemini?**

About two minutes: open Connected Apps, then add Spiral as a custom app, then sign in to Spiral and approve.

**Does Gemini wait while EVF-SAM2 runs?**

EVF-SAM2 runs in the background. Gemini starts the run, checks on it and gives you the image when it's ready.

**What is EVF-SAM2 useful for?**

Use EVF-SAM2 to select a region in an existing image by describing it. The resulting mask can serve as the selection for a later edit, such as changing a product's color or replacing a background.

**How do I select one object when several look alike?**

Name the object and add a visible detail or location, such as 'the red cup beside the plate.' EVF-SAM supports spatial descriptions, so a relationship to another object can help distinguish your target.

**Which language should I use for EVF-SAM2 prompts?**

Use English. The official demo specifies English-only support, so translate other languages before submitting the target description.

**Can EVF-SAM2 select hair or a background region?**

Yes. Use semantic segmentation for body parts, background regions, or multiple objects, then describe the region you want.

**How do I exclude something from a selection?**

Describe the region to keep in the positive description and the unwanted region in the negative description. EVF-SAM2 subtracts the negative selection from the positive result.

