Process images using the OpenAI SDK client.images.edit() method. The model parameter determines which AI processing is applied.
from openai import OpenAI
client = OpenAI(api_key='sk-snap-xxx', base_url='https://api.snapapi.ai/v1')| Model | Description | prompt | mask | Credit |
|---|---|---|---|---|
snapapi/remove-bg | Remove background | not used | - | 1 |
snapapi/remove-logo | Remove logo (auto-detect) | not used | optional | 5 |
snapapi/remove-object | Remove object by mask | not used | required | 3-13 |
snapapi/remove-text | Remove text by mask | not used | required | 4 |
snapapi/remove-wire | Remove wires by mask | not used | required | 4 |
| Model | Description | prompt | Credit |
|---|---|---|---|
snapapi/enhance-2x | Upscale 2x | not used | 6 |
snapapi/enhance-4x | Upscale 4x | not used | 11 |
snapapi/enhance-art-2x | Upscale art/anime 2x | not used | 2 |
snapapi/enhance-art-4x | Upscale art/anime 4x | not used | 4 |
snapapi/restore | Restore old photo | not used | 1 |
snapapi/restore-pro | Restore (Qwen AI) | not used | 13 |
snapapi/colorize | Colorize B&W photo | not used | 1 |
snapapi/colorize-pro | Colorize (Qwen AI) | not used | 13 |
snapapi/light-restore | Fix lighting issues | not used | 21 |
| Model | Description | prompt | Credit |
|---|---|---|---|
snapapi/headshot | Professional headshot | outfit/style description | 21 |
snapapi/sticker | Cartoon/sticker | style description | 21 |
snapapi/qwen-edit | General AI edit | editing instruction | 13 |
snapapi/flux-kontext | FLUX Kontext edit | editing instruction | 18 |
| Model | Description | prompt | Credit |
|---|---|---|---|
snapapi/hairstyle | Transform hairstyle | style_id from list | 6 |
snapapi/transfer-makeup | Apply makeup style | style_id from list | 1 |
snapapi/art | Transform to AI art | style_id from list | 6 |
| Model | Description | prompt | Credit |
|---|---|---|---|
snapapi/detect-objects | Detect removable objects | not used | 1 |
snapapi/detect-text | Detect text regions | not used | 1 |
snapapi/detect-wires | Detect wires/cables | not used | 1 |
| Model | Description | prompt | mask | Credit |
|---|---|---|---|---|
snapapi/retouch-skin | Skin retouching | not used | - | 2 |
snapapi/outpaint | Expand image | not used | required | 15 |
snapapi/pose-suggest | Pose suggestion | not used | - | 28 |
snapapi/qwen-edit-multi | Multi-image edit | editing instruction | - | 26 |
Remove background:
result = client.images.edit(
model='snapapi/remove-bg',
image=open('photo.png', 'rb'),
prompt=''
)
print(result.data[0].url)Enhance 4x:
result = client.images.edit(
model='snapapi/enhance-4x',
image=open('photo.png', 'rb'),
prompt=''
)Headshot generation:
result = client.images.edit(
model='snapapi/headshot',
image=open('face.png', 'rb'),
prompt='Professional studio headshot with soft lighting'
)Hairstyle (prompt = style_id):
result = client.images.edit(
model='snapapi/hairstyle',
image=open('face.png', 'rb'),
prompt='ponytail' # style_id from styles list
)Pose suggest (extra params via extra_body):
result = client.images.edit(
model='snapapi/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='snapapi/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='snapapi/detect-objects',
image=open('photo.png', 'rb'),
prompt=''
)
print(result.model_dump()) # raw detection JSON/v1/images/edits (OpenAI SDK)Authorization — This endpoint requires an API key. Pass it in the api-key header on every request. See the quickstart
| 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. |
Image processed successfully (or detection JSON for detect-* models)SingleImageResponse
| Name | 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.snapapi.ai/v1/images/edits (OpenAI SDK)" \
-H "api-key: YOUR_API_KEY" \
-F "model=value" \
-F "image=@./image.jpg" \
-F "mask=@./image.png"{
"created": 1745827200,
"data": [
{
"url": "https://outputs.snapapi.ai/outputs/abc123.png"
}
]
}