Face swap in one API call
All guides

Guide · 5 min read

Face swap in one API call

Source image plus a face image. Same faceswap tool the product uses.

POST /v2/jobs with model goonify/faceswap. image_url is the scene. face_image_url is the identity. Both must be HTTPS. Upload first with POST /v2/files if the files are not public yet.

The job follows the same lifecycle as every other v2 job: queued, processing, completed. Cancel a queued job to refund. Sandbox keys return example media so you can wire the flow before you spend.

A swapped still on the CDN.

Steps

  1. 1

    Upload the scene and the face if they are not public HTTPS.

  2. 2

    POST /v2/jobs with goonify/faceswap, image_url, and face_image_url.

  3. 3

    Poll or wait for the webhook.

  4. 4

    Download the swapped still.

Install the SDK

pip install "goonify @ git+https://github.com/Goonify/goonify.git#subdirectory=sdks/python"

Modelgoonify/faceswap

from goonify import Goonify

client = Goonify()

job = client.run(
    "goonify/faceswap",
    input={
        "image_url": "https://cdn.goonify.ai/examples/input.jpg",
        "face_image_url": "https://cdn.goonify.ai/examples/input.jpg",
    },
)
print(job.output["url"])

What it looks like

Run it with a sandbox key

Sandbox keys return example media and spend nothing. Switch to a live key when you are ready.

Next recipes