API Reference
Edit/process image (OpenAI SDK)
Process images using the OpenAI SDK client.images.edit() method. The model parameter determines which AI processing is applied. Use extra_body for model-specific fields that are not part of the standard OpenAI image edit signature.
Setup
from openai import OpenAI
client = OpenAI(api_key='sk-snap-xxx', base_url='https://api.snapedit.app/v1')Supported Models
Removal
| Model | Description | prompt | mask | Extra params | Credit |
|---|---|---|---|---|---|
snapedit/remove-bg | Remove background | not used | - | optional output_type | 1 |
snapedit/remove-bg-graphic | Remove background for graphics | not used | - | optional output_type | 1 |
snapedit/remove-logo | Remove logo (auto-detect) | not used | optional | optional erase_mode (lite or default) | 3 (lite), 6 (default) |
snapedit/remove-object | Remove object by mask | not used | required | optional erase_mode | 2-17 |
snapedit/remove-text | Remove text by mask | not used | required | optional erase_mode | 2-17 |
snapedit/remove-wire | Remove wires by mask | not used | required | - | 2 |
snapedit/remove-reflection | Remove reflections | not used | - | - | 12 |
snapedit/clean-mirror | Clean mirror artifacts | not used | - | - | 12 |
Enhance & Restore Images
| Model | Description | prompt | Extra params | Credit |
|---|---|---|---|---|
snapedit/enhance-2x | Upscale 2x | not used | - | 4 |
snapedit/enhance-4x | Upscale 4x | not used | - | 7 |
snapedit/enhance-pro-2x | Pro upscale 2x | not used | - | 12 |
snapedit/enhance-pro-4x | Pro upscale 4x | not used | - | 19 |
snapedit/enhance-art-2x | Upscale art/anime 2x | not used | - | 2 |
snapedit/enhance-art-4x | Upscale art/anime 4x | not used | - | 2 |
snapedit/restore | Restore old photo | not used | - | 1 |
snapedit/restore-pro | Restore (Qwen AI) | not used | - | 12 |
snapedit/colorize | Colorize B&W photo | not used | - | 1 |
snapedit/colorize-pro | Colorize (Qwen AI) | not used | - | 12 |
snapedit/light-restore | Fix lighting issues | not used | - | 12 |
snapedit/backlit-fix | Fix backlit photos | not used | - | 12 |
snapedit/night-flash | Add flash-style lighting | not used | - | 12 |
Generation from Image
| Model | Description | prompt | Extra params | Credit |
|---|---|---|---|---|
snapedit/headshot | Professional headshot | outfit/style description | - | 12 |
snapedit/sticker | Cartoon/sticker | style description | - | 12 |
snapedit/generate-background | Generate a new background | background prompt | - | 7 |
snapedit/qwen-edit | General AI edit | editing instruction | optional mode (editing default, inpaint with mask) | 12 |
snapedit/qwen-edit-multi | Multi-image edit | editing instruction | input_image_1, optional input_image_2, optional mode | 17-22 |
Style-based (prompt = style_id)
| Model | Description | prompt | Extra params | Credit |
|---|---|---|---|---|
snapedit/hairstyle | Transform hairstyle | style_id from list | - | 3 |
snapedit/transfer-makeup | Apply makeup style | style_id from list | - | 3 |
snapedit/art | Transform to AI art | style_id from list | - | 4 |
Detection (returns JSON, not image)
| Model | Description | prompt | Extra params | Credit |
|---|---|---|---|---|
snapedit/detect-objects | Detect removable objects | not used | - | 1 |
snapedit/detect-text | Detect text regions | not used | - | 1 |
snapedit/detect-wires | Detect wires/cables | not used | - | 1 |
snapedit/ai-detect | Detect AI-generated image | not used | - | 2 |
Utility
| Model | Description | prompt | mask | Extra params | Credit |
|---|---|---|---|---|---|
snapedit/retouch-skin | Skin retouching | not used | - | - | 2 |
snapedit/outpaint | Expand image | not used | required | - | 8 |
snapedit/pose-suggest | Pose suggestion | not used | - | num_models, gender | 9 |
Examples
Remove background:
result = client.images.edit(
model='snapedit/remove-bg',
image=open('photo.png', 'rb'),
prompt=''
)
print(result.data[0].url)Enhance 4x:
result = client.images.edit(
model='snapedit/enhance-4x',
image=open('photo.png', 'rb'),
prompt=''
)Headshot generation:
result = client.images.edit(
model='snapedit/headshot',
image=open('face.png', 'rb'),
prompt='Professional studio headshot with soft lighting'
)Hairstyle (prompt = style_id):
result = client.images.edit(
model='snapedit/hairstyle',
image=open('face.png', 'rb'),
prompt='bobcut' # style_id from styles list
)Pose suggest (extra params via extra_body):
result = client.images.edit(
model='snapedit/pose-suggest',
image=open('scene.png', 'rb'),
prompt='',
extra_body={'num_models': 3, 'gender': 'female'}
)Multi-image edit (extra images via extra_body):
result = client.images.edit(
model='snapedit/qwen-edit-multi',
image=open('img1.png', 'rb'),
prompt='Combine the two people in a park',
extra_body={'input_image_1': 'https://example.com/img2.png'}
)Detect objects (returns JSON):
result = client.images.edit(
model='snapedit/detect-objects',
image=open('photo.png', 'rb'),
prompt=''
)
print(result.model_dump()) # raw detection JSONpost
/v1/images/edits (OpenAI SDK)Authorization — This endpoint requires an API key. Pass it in the api-key header on every request. Learn more
Parameters
| Name | Type | Status | Description |
|---|---|---|---|
model | string | Required | Model to use. See supported models table above. |
image | file | Required | Input image file. |
prompt | string | Optional | Depends on model: editing instruction, style_id, or empty string. See table above. |
mask | file | Optional | Mask image. Required for: remove-object, remove-text, remove-wire, outpaint. |
input_image_1 | file | Optional | Second input image for snapedit/qwen-edit-multi. |
input_image_2 | file | Optional | Optional third input image for snapedit/qwen-edit-multi. |
output_type | string | Optional | Remove Background output type for snapedit/remove-bg and snapedit/remove-bg-graphic. foregroundmask (default: foreground) |
erase_mode | string | Optional | Quality mode. For snapedit/remove-logo, use lite or default. For snapedit/remove-object and snapedit/remove-text, use normal, super, or ultra.litedefaultnormalsuperultra |
mode | string | Optional | Edit mode for snapedit/qwen-edit and snapedit/qwen-edit-multi. editinginpaint (default: editing) |
Responses
Image processed successfully (or detection JSON for detect-* models)SingleImageResponse
| Field | Type | Description |
|---|---|---|
created | integer | Unix timestamp of when the response was created |
data | object[] | |
url | string | URL to download the result image |
curl -X POST "https://api.snapedit.app/v1/images/edits (OpenAI SDK)" \
-H "api-key: YOUR_API_KEY" \
-F "model=value" \
-F "image=@./image.jpg" \
-F "mask=@./image.png" \
-F "input_image_1=@./image.jpg" \
-F "input_image_2=@./image.jpg" \
-F "output_type=foreground" \
-F "erase_mode=lite" \
-F "mode=editing"Response
{
"created": 1745827200,
"data": [
{
"url": "https://outputs.snapedit.app/outputs/abc123.png"
}
]
}