SnapEditDocs
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.

Setup

from openai import OpenAI
client = OpenAI(api_key='sk-snap-xxx', base_url='https://api.snapapi.ai/v1')

Supported Models

Removal

ModelDescriptionpromptmaskCredit
snapapi/remove-bgRemove backgroundnot used-1
snapapi/remove-logoRemove logo (auto-detect)not usedoptional5
snapapi/remove-objectRemove object by masknot usedrequired3-13
snapapi/remove-textRemove text by masknot usedrequired4
snapapi/remove-wireRemove wires by masknot usedrequired4

Enhance & Restore

ModelDescriptionpromptCredit
snapapi/enhance-2xUpscale 2xnot used6
snapapi/enhance-4xUpscale 4xnot used11
snapapi/enhance-art-2xUpscale art/anime 2xnot used2
snapapi/enhance-art-4xUpscale art/anime 4xnot used4
snapapi/restoreRestore old photonot used1
snapapi/restore-proRestore (Qwen AI)not used13
snapapi/colorizeColorize B&W photonot used1
snapapi/colorize-proColorize (Qwen AI)not used13
snapapi/light-restoreFix lighting issuesnot used21

Generation from Image

ModelDescriptionpromptCredit
snapapi/headshotProfessional headshotoutfit/style description21
snapapi/stickerCartoon/stickerstyle description21
snapapi/qwen-editGeneral AI editediting instruction13
snapapi/flux-kontextFLUX Kontext editediting instruction18

Style-based (prompt = style_id)

ModelDescriptionpromptCredit
snapapi/hairstyleTransform hairstylestyle_id from list6
snapapi/transfer-makeupApply makeup stylestyle_id from list1
snapapi/artTransform to AI artstyle_id from list6

Detection (returns JSON, not image)

ModelDescriptionpromptCredit
snapapi/detect-objectsDetect removable objectsnot used1
snapapi/detect-textDetect text regionsnot used1
snapapi/detect-wiresDetect wires/cablesnot used1

Utility

ModelDescriptionpromptmaskCredit
snapapi/retouch-skinSkin retouchingnot used-2
snapapi/outpaintExpand imagenot usedrequired15
snapapi/pose-suggestPose suggestionnot used-28
snapapi/qwen-edit-multiMulti-image editediting instruction-26

Examples

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
post/v1/images/edits (OpenAI SDK)

AuthorizationThis endpoint requires an API key. Pass it in the api-key header on every request. See the quickstart

Body

NameTypeStatusDescription
model
stringRequiredModel to use. See supported models table above.
image
fileRequiredInput image file.
prompt
stringOptionalDepends on model: editing instruction, style_id, or empty string. See table above.
mask
fileOptionalMask image. Required for: remove-object, remove-text, remove-wire, outpaint.

Responses

Image processed successfully (or detection JSON for detect-* models)SingleImageResponse

NameTypeDescription
createdintegerUnix timestamp of when the response was created
dataobject[]
urlstringURL 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"
Response
{
  "created": 1745827200,
  "data": [
    {
      "url": "https://outputs.snapapi.ai/outputs/abc123.png"
    }
  ]
}