TryItOn
Guides

Try-On Python Quickstart

Run a virtual try-on in Python using the official tryiton SDK: submit a job, wait for completion, and read the output image URLs.

This quickstart uses the official tryiton Python SDK to:

  1. Submit a try-on to the /tryon/clothes endpoint.
  2. Wait for the job to finish (the SDK polls /status/<id> for you).
  3. Read the output image URLs.

Install

pip install tryiton

Requires Python 3.8 or later. See all libraries on the SDKs page.

Minimal example

This example uses URLs for the model and garment images. You can also pass a base64 data URL (data:image/png;base64,...) for either image.

import os
from tryiton import TryItOn, TryItOnError

client = TryItOn(api_key=os.environ["TRYITON_API_KEY"])

try:
    # 1. Submit the try-on
    job_id = client.try_on_clothes(
        model_image="https://example.com/model.jpg",
        garment_image="https://example.com/garment.jpg",
        category="clothing",
        subcategory="tops",
    )
    print("Job started:", job_id)

    # 2. Wait for completion (polls status until done)
    output = client.wait_for_result(job_id)

    # 3. Read the result image URLs (valid for 72 hours)
    print("Result:", output[0])
except TryItOnError as err:
    print(f"Failed ({err.status} {err.error_name}): {err}")

The same pattern works for the other models — call client.try_on_hairstyle(...) or client.try_on_tattoo(...) instead. See Hairstyle and Tattoo.

Prefer to poll yourself? Call client.get_status(job_id) in a loop instead of wait_for_result.

On this page