executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
background-removalRemove backgrounds from images using each::sense AI. Isolate subjects with clean edges, create transparent PNGs, replace backgrounds, and generate cutouts for products, portraits, and composites. Powered by eachlabs-bg-remover-v1 for precise edge detection. Use for: e-commerce product photos, portrait backgrounds, social media, photo compositing, transparen…
Independent GitHub snapshot · Automated classification · Original documentation governs
Remove backgrounds from images with pixel-perfect edge detection using each::sense — the intelligent AI agent that automatically selects the best model for your request.
Requires an each::labs API key. Get one at eachlabs.ai.
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Remove the background from this image completely. Return the subject on a transparent background with clean edges."},
{"type": "image_url", "image_url": {"url": "https://example.com/product-photo.jpg"}}
]
}
],
"stream": false
}'
from openai import OpenAI
client = OpenAI(
api_key="YOUR_EACHLABS_API_KEY",
base_url="https://eachsense-agent.core.eachlabs.run/v1"
)
response = client.chat.completions.create(
model="eachsense/beta",
messages=[{"role": "user", "content": "Remove the background from this image completely. Return the subject on a transparent background with clean edges."}],
# Images are included in the message content array above
)
print(response.choices[0].message.content)
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Remove the background from the first image and place the subject onto the scene shown in the second image. Match lighting and scale naturally."},
{"type": "image_url", "image_url": {"url": "https://example.com/person.jpg"}},
{"type": "image_url", "image_url": {"url": "https://example.com/new-background.jpg"}}
]
}
],
"stream": false
}'
Images are sent inside messages using the OpenAI multimodal content format. Maximum 4 images per request.
Set "stream": true for real-time SSE responses, or "stream": false for complete result in a single response. Streaming is useful for showing progress in UIs; non-streaming is simpler for scripts and automation.
| Model | Strengths | Best For |
|---|---|---|
| eachlabs-bg-remover-v1 | Precise edge detection, hair/fur handling, transparent output | Clean cutouts, product photos, portraits |
| flux-2-edit | Background replacement with natural language | Swapping to specific new backgrounds |
| flux-fill-pro | Inpainting after removal | Filling background areas with new content |
each::sense selects eachlabs-bg-remover-v1 for pure removal tasks and flux-2-edit when replacement is requested.
| Use Case | Instruction | Output |
|---|---|---|
| Transparent PNG | "Remove the background completely" | Subject on transparent background |
| White Background | "Remove background, replace with pure white" | Clean e-commerce listing |
| Solid Color | "Replace background with brand blue (#2563EB)" | Branded marketing asset |
| Gradient | "Replace with a soft gray-to-white gradient" | Professional portrait |
| Environment Swap | "Place on a tropical beach at sunset" | Lifestyle composite |
| Studio Backdrop | "Replace with a seamless gray studio backdrop" | Professional product shot |
"Remove the background completely. Keep edges sharp and clean,
especially around hair and fine details. Transparent background."
"Remove the current background and replace it with [description].
Match the lighting direction from the original photo.
Keep a natural contact shadow beneath the subject."
Control how shadows are treated:
"Remove background but keep the natural shadow beneath the product"
"Remove background and all shadows for a clean cutout"
"Remove background, add a soft artificial drop shadow on white"
Request specific edge treatment:
"Ensure hair edges are soft and natural, not hard-cut"
"Keep crisp edges around the product with no background bleed"
"Apply a very slight feather on the edges for smooth compositing"
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Remove the background from this product photo and replace it with a pure white (#FFFFFF) background. Keep a soft, natural drop shadow beneath the product for a floating effect. Crisp edges with no background artifacts."},
{"type": "image_url", "image_url": {"url": "https://example.com/sneaker-on-table.jpg"}}
]
}
],
"stream": false
}'
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Remove the background from this portrait photo. Replace with a smooth, soft-focus dark gray gradient that is lighter in the center. Keep hair edges natural and wispy, not hard-cut. Professional headshot quality."},
{"type": "image_url", "image_url": {"url": "https://example.com/office-portrait.jpg"}}
]
}
],
"stream": false
}'
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Remove the background from this image entirely. Output a transparent PNG with no background at all. Clean edges suitable for layering in a design tool like Figma or Photoshop. Remove all shadows."},
{"type": "image_url", "image_url": {"url": "https://example.com/plant-photo.jpg"}}
]
}
],
"stream": false
}'
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Remove the background and place this person on a sunlit rooftop terrace overlooking a Mediterranean coastal city. Match the warm afternoon lighting from the original photo. The person should look naturally placed in the scene with correct scale and perspective."},
{"type": "image_url", "image_url": {"url": "https://example.com/standing-person.jpg"}}
]
}
],
"stream": false
}'
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d '{
"messages": [{"role": "user", "content": [
{"type": "text", "text": "Remove the background from this photo and replace it with a bold coral-to-magenta gradient going from bottom-left to top-right. Keep the subject sharp with clean edges. This is for an Instagram post, so make it vibrant and eye-catching."},
{"type": "image_url", "image_url": {"url": "https://example.com/influencer-photo.jpg"}}
]
}
],
"stream": false
}'
# Remove backgrounds from multiple product photos
PRODUCTS=(
"https://example.com/product-1.jpg"
"https://example.com/product-2.jpg"
"https://example.com/product-3.jpg"
"https://example.com/product-4.jpg"
)
for URL in "${PRODUCTS[@]}"; do
curl -X POST https://eachsense-agent.core.eachlabs.run/v1/chat/completions \
-H "Content-Type: application/json" \
-H "X-API-Key: $EACHLABS_API_KEY" \
-d "{
\"messages\": [{\"role\": \"user\", \"content\": \"Remove the background. Replace with pure white. Keep a soft natural shadow. Clean product cutout.\"}],
\"image_urls\": [\"$URL\"],
\"stream\": false
}"
echo "---"
done
| Subject | Challenge | Tip |
|---|---|---|
| People (hair) | Fine hair strands | "Keep hair edges soft and natural" |
| Pets (fur) | Fluffy edges | "Preserve fur detail around edges" |
| Products (hard edges) | Reflections, shadows | "Crisp edges, handle reflections" |
| Plants (leaves) | Complex silhouettes | "Preserve leaf detail and gaps" |
| Transparent objects | Glass, bottles | "Handle transparent/translucent areas" |
| Complex scenes | Multiple subjects | "Isolate only the main subject in the center" |