TryItOn Python SDK — AI Virtual Try-On API
Official Python client for the TryItOn virtual try-on API. Add photoreal AI virtual try-on for clothing, accessories, hairstyles, and tattoos to your Python application with a few lines of code.
- Virtual clothing try-on and accessory try-on (eyewear, footwear, headwear, jewelry)
- Hairstyle and tattoo try-on
- Type-hinted client with a built-in job polling helper
Full API reference: docs.tryiton.now · Get an API key: tryiton.now/app/developer
Installation
pip install tryiton
Requires Python 3.8 or later.
Quickstart: run a virtual try-on
Submit a garment and a model photo, then wait for the generated result image.
import os
from tryiton import TryItOn
client = TryItOn(api_key=os.environ["TRYITON_API_KEY"])
# Submit a clothing try-on
job_id = client.try_on_fashion(
model_image="https://example.com/model.jpg",
garment_image="https://example.com/tshirt.jpg",
category="clothing",
subcategory="tops",
)
# Poll until the job completes and return the output image URL(s)
urls = client.wait_for_result(job_id)
print(urls[0]) # CDN URL, available for 72 hours
Image inputs accept a public URL or a base64 data URL (data:image/png;base64,...).
Core parameters
try_on_fashion covers clothing and accessory try-on. The most important parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
model_image |
str | Yes | URL or base64 data URL of the person. |
garment_image |
str | Yes | URL or base64 data URL of the garment or accessory. |
category |
str | No | Item type: auto, clothing, eyewear, footwear, headwear, jewelry, accessories, or others. auto detects it for you. |
subcategory |
str | No | Required for clothing (tops, bottoms, dresses), jewelry, and accessories. |
Additional options (mode and moderation_level for clothing; num_samples 1–4 and output_format png/jpeg for every try-on, including hairstyle and tattoo) are documented in the API reference.
Other endpoints
# Hairstyle try-on (see tryiton.HAIRCUTS for all supported values)
client.try_on_hairstyle(face_image=face_url, haircut="BuzzCut", hair_color="ash blonde")
# Tattoo try-on — place it with free text...
client.try_on_tattoo(body_image=body_url, design_image=design_url, placement="on the right forearm, small")
# ...or pin the exact spot with a region box (normalized 0-1, from the image's top-left)
client.try_on_tattoo(body_image=body_url, design_image=design_url, region={"x": 0.32, "y": 0.18, "w": 0.28, "h": 0.34})
# Poll a job manually, or check your credit balance
status = client.get_status(job_id) # Status(status, output, error)
credits = client.get_credits() # Credits(on_demand, subscription, purchased, reserved)
Error handling
All failures raise TryItOnError, which carries the HTTP status code and the API error name.
from tryiton import TryItOn, TryItOnError
try:
client.try_on_fashion(...)
except TryItOnError as err:
print(err.status, err.error_name, str(err)) # e.g. 429, "OutOfCredits"
Notes
- Output image URLs expire 72 hours after completion. Download any results you want to keep.
- Failed jobs are never charged.
Documentation
Full documentation, parameter reference, and guides: docs.tryiton.now
License
MIT
Release files for tryiton 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tryiton-2.0.0.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| tryiton-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.4 kB
Release files / tryiton-2.0.0.tar.gz
| Download URL | tryiton-2.0.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e98bbc7ccdb0abc3195d1eed09ed592681489eea285ceeca394d6c73608c3f7b
|
|
BLAKE2b-256 checksum How to use checksums |
cef8f6dcb86061a6fc8a5740e57798eedc283dd638816b90ffc8ad94b41fe5d6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|
Release files / tryiton-2.0.0-py3-none-any.whl
| Download URL | tryiton-2.0.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b28037a94ede84e15fbb29f58d61d74eefc50e64e6054a8c0d9c706ad44c425
|
|
BLAKE2b-256 checksum How to use checksums |
816bc284a8f1c2f4fd0c31189e9fd555332d91e78b42c5592b8175007c73ba36
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.10
|