Skip to main content

API Reference

Complete API reference for OpenTryOn modules. Current package: v0.0.9.

Models are also available through the unified CLI, MCP server, and (for upstream media HTTP) OpenAPI / Postman snapshots:

Preprocessing API​

segment_garment​

Segment garments from images using U2Net model.

from tryon.preprocessing import segment_garment

segment_garment(
inputs_dir: str,
outputs_dir: str,
cls: str = "all"
)

Parameters:

  • inputs_dir (str): Directory containing input garment images
  • outputs_dir (str): Directory to save segmented masks
  • cls (str): Garment class. Options: "upper", "lower", "dress", "all"

Returns: None (saves masks to output directory)


extract_garment​

Extract garments from images and prepare for virtual try-on.

from tryon.preprocessing import extract_garment

extract_garment(
inputs_dir: str,
outputs_dir: str,
cls: str = "all",
resize_to_width: Optional[int] = None
)

Parameters:

  • inputs_dir (str): Directory containing input garment images
  • outputs_dir (str): Directory to save extracted garments
  • cls (str): Garment class
  • resize_to_width (int, optional): Resize output width

Returns: None (saves extracted garments)


segment_human​

Segment human subjects from images.

from tryon.preprocessing import segment_human

segment_human(
image_path: str,
output_dir: str
)

Parameters:

  • image_path (str): Path to input human image
  • output_dir (str): Directory to save segmented mask

Returns: None (saves mask as PNG)


extract_garment (Single Image)​

Extract garment from a single PIL Image object.

from tryon.preprocessing.extract_garment_new import extract_garment
from PIL import Image

garments = extract_garment(
image: Image.Image,
cls: str = "all",
resize_to_width: Optional[int] = None,
net: Optional[torch.nn.Module] = None,
device: Optional[torch.device] = None
)

Parameters:

  • image (PIL.Image): Input image object
  • cls (str): Garment class
  • resize_to_width (int, optional): Resize output width
  • net (torch.nn.Module, optional): Pre-loaded U2Net model
  • device (torch.device, optional): Device to run inference on

Returns: Dict[str, PIL.Image] - Dictionary mapping garment class names to PIL Image objects


TryOnDiffusion API​

Diffusion​

Main diffusion model class.

from tryondiffusion.diffusion import Diffusion

diffusion = Diffusion(
device: torch.device,
pose_embed_dim: int,
time_steps: int = 256,
beta_start: float = 1e-4,
beta_end: float = 0.02,
unet_dim: int = 64,
noise_input_channel: int = 3,
beta_ema: float = 0.995
)

Methods:

  • sample(use_ema: bool, conditional_inputs: tuple) -> torch.Tensor
  • fit(args) - Start training
  • prepare(args) - Prepare data and optimizer

See TryOnDiffusion Documentation for details.


Virtual Try-On API Adapters​

SegmindVTONAdapter​

Adapter for Segmind Try-On Diffusion API for virtual try-on generation.

from tryon.api import SegmindVTONAdapter

adapter = SegmindVTONAdapter(api_key="your_api_key")

images = adapter.generate_and_decode(
model_image="person.jpg",
cloth_image="garment.jpg",
category="Upper body"
)

Parameters:

  • api_key (str, optional): Segmind API key. Defaults to SEGMIND_API_KEY environment variable

Methods:

  • generate(model_image, cloth_image, category, ...) - Generate virtual try-on images
  • generate_and_decode(model_image, cloth_image, category, ...) - Generate and decode to PIL Images

See Segmind API Documentation for complete details.


KlingAIVTONAdapter​

Adapter for Kling AI Kolors Virtual Try-On API with asynchronous processing.

from tryon.api import KlingAIVTONAdapter

adapter = KlingAIVTONAdapter(api_key="your_api_key", secret_key="your_secret_key")

images = adapter.generate_and_decode(
source_image="person.jpg",
reference_image="garment.jpg",
model="kolors-virtual-try-on-v1-5"
)

Parameters:

  • api_key (str, optional): Kling AI API key. Defaults to KLING_AI_API_KEY environment variable
  • secret_key (str, optional): Kling AI secret key. Defaults to KLING_AI_SECRET_KEY environment variable
  • base_url (str, optional): Base URL for API. Defaults to KLING_AI_BASE_URL or Singapore endpoint

Methods:

  • generate(source_image, reference_image, model, ...) - Generate virtual try-on images (returns URLs)
  • generate_and_decode(source_image, reference_image, model, ...) - Generate and decode to PIL Images
  • query_task_status(task_id) - Query task status
  • poll_task_until_complete(task_id, ...) - Poll task until completion

See Kling AI API Documentation for complete details.


GoogleVTONAdapter​

Dedicated Vertex AI Virtual Try-On (virtual-try-on-001). Person + product images; not Gemini API / Nano Banana.

from tryon.api import GoogleVTONAdapter

adapter = GoogleVTONAdapter() # GOOGLE_CLOUD_PROJECT + ADC

images = adapter.generate_and_decode(
person="person.jpg",
garment="sweater.jpg",
number_of_images=1,
)

Parameters:

  • project (str, optional): GCP project. Defaults to GOOGLE_CLOUD_PROJECT
  • location (str, optional): Vertex location. Defaults to GOOGLE_CLOUD_LOCATION or global

Methods:

  • generate_and_decode(person, garment, ...) - Generate and decode to PIL Images

See Google Virtual Try-On for auth, CLI, and MCP.


OutfitAnyonePlusAdapter​

Dedicated Alibaba DashScope try-on (aitryon-plus). Beijing-region key. Not Qwen-Image composition.

from tryon.api import OutfitAnyonePlusAdapter

adapter = OutfitAnyonePlusAdapter() # DASHSCOPE_API_KEY (Beijing)

images = adapter.generate_and_decode(
person="person.jpg",
garment="top.jpeg",
)

Parameters:

  • api_key (str, optional): Defaults to DASHSCOPE_API_KEY
  • base_url (str, optional): Defaults to OUTFITANYONE_BASE_URL or China DashScope

Methods:

  • generate_and_decode(person, garment, top_garment=..., bottom_garment=..., restore_face=True, resolution=-1)

See OutfitAnyone-Plus for auth, CLI, and MCP.


PhotoroomVTONAdapter​

Photoroom Image Editing API — shopper Virtual Try-On and catalog Virtual Model (POST /v2/edit).

from tryon.api import PhotoroomVTONAdapter

adapter = PhotoroomVTONAdapter() # PHOTOROOM_API_KEY
worn = adapter.generate_and_decode(person="selfie.jpg", garment="dress.jpg")
catalog = adapter.generate_virtual_model(garment="flatlay.jpg", preset_model="avery")

Parameters:

  • api_key (str, optional): Defaults to PHOTOROOM_API_KEY
  • base_url (str, optional): Defaults to PHOTOROOM_BASE_URL or https://image-api.photoroom.com

Methods:

  • generate_and_decode(person, garment, mode="try-on", ...)
  • generate_virtual_model(garment, ...)

See Photoroom for auth, CLI, and MCP.


LeffaAdapter / CatVTONAdapter​

Dedicated local virtual try-on (GPU, pip install opentryon[local]). Not composition I2I.

from tryon.models import LeffaAdapter, CatVTONAdapter

LeffaAdapter().generate_and_decode("person.jpg", "garment.jpg")
CatVTONAdapter().generate_and_decode("person.jpg", "garment.jpg")

See Leffa and CatVTON. CatVTON weights are CC BY-NC-SA 4.0.


AmazonNovaCanvasVTONAdapter​

Adapter for Amazon Nova Canvas Virtual Try-On through AWS Bedrock.

from tryon.api import AmazonNovaCanvasVTONAdapter

adapter = AmazonNovaCanvasVTONAdapter(region="us-east-1")

images = adapter.generate_and_decode(
source_image="person.jpg",
reference_image="garment.jpg",
mask_type="GARMENT",
garment_class="UPPER_BODY"
)

Parameters:

  • region (str, optional): AWS region. Defaults to AMAZON_NOVA_REGION or 'us-east-1'

Methods:

  • generate(source_image, reference_image, mask_type, garment_class, ...) - Generate virtual try-on images
  • generate_and_decode(source_image, reference_image, mask_type, garment_class, ...) - Generate and decode to PIL Images

See Nova Canvas API Documentation for complete details.


PImageTryOnAdapter​

Adapter for Pruna AI's P-Image-Try-On API -- multi-garment virtual try-on (up to 11 garment reference images in one call). Lives under tryon.api.vton and shares tryon.api.pruna.client.PrunaClient with the newer P-Image / P-Video adapters in tryon.api.pruna.

from tryon.api.vton import PImageTryOnAdapter

adapter = PImageTryOnAdapter(api_key="your_api_key")

images = adapter.generate_and_decode(
person_image="person.jpg",
garment_images=["top.jpg", "bottoms.jpg"],
)

Parameters:

  • api_key (str, optional): Pruna API key. Defaults to PRUNA_API_KEY environment variable

Methods:

  • generate(person_image, garment_images, ...) - Generate a virtual try-on result (returns a URL)
  • generate_and_decode(person_image, garment_images, ...) - Generate and decode to PIL Images

See Pruna AI Documentation for complete details (also covers PImageAdapter, PImageIdeogramAdapter, PImageEditAdapter, PImageUpscaleAdapter, PVideoAdapter, PVideo2ProAdapter, PVideoReplaceAdapter, PVideoAvatarAdapter, PVideoAnimateAdapter). Dedicated page: P-Image-Ideogram.


FashnVTONAdapter​

Adapter for FASHN AI virtual try-on (tryon-max and tryon-v1.6). Lives under tryon.api.vton (use-case directory) rather than a dedicated tryon.api.fashn package.

from tryon.api.vton import FashnVTONAdapter

adapter = FashnVTONAdapter(api_key="your_api_key")

images = adapter.generate_and_decode(
model_image="person.jpg",
product_image="garment.jpg",
model_name="tryon-max",
resolution="2k",
)

Parameters:

  • api_key (str, optional): FASHN API key. Defaults to FASHN_API_KEY

Methods:

  • generate(model_image, product_image, model_name, ...) - Run try-on (returns URLs / data URIs)
  • generate_and_decode(model_image, product_image, model_name, ...) - Generate and decode to PIL Images

See FASHN AI Virtual Try-On Documentation for complete details.


Image Generation API Adapters​

NanoBananaAdapter​

Adapter for Gemini 2.5 Flash Image (Nano Banana) - fast and efficient image generation.

from tryon.api.nano_banana import NanoBananaAdapter

adapter = NanoBananaAdapter(api_key="your_api_key")

images = adapter.generate_text_to_image(
prompt="A nano banana dish in a fancy restaurant",
aspect_ratio="16:9"
)

Parameters:

  • api_key (str, optional): Google Gemini API key. Defaults to GEMINI_API_KEY environment variable

Methods:

  • generate_text_to_image(prompt, aspect_ratio, ...) - Generate images from text
  • generate_image_edit(image, prompt, aspect_ratio, ...) - Edit images with text prompts
  • generate_multi_image(images, prompt, aspect_ratio, ...) - Compose multiple images
  • generate_batch(prompts, aspect_ratio, ...) - Batch generation

See Nano Banana API Documentation for complete details.


NanoBananaProAdapter​

Adapter for Gemini 3 Pro Image Preview (Nano Banana Pro) - advanced image generation with 4K support.

from tryon.api.nano_banana import NanoBananaProAdapter

adapter = NanoBananaProAdapter(api_key="your_api_key")

images = adapter.generate_text_to_image(
prompt="A professional nano banana dish",
resolution="4K",
aspect_ratio="16:9",
use_search_grounding=True
)

Parameters:

  • api_key (str, optional): Google Gemini API key. Defaults to GEMINI_API_KEY environment variable

Methods:

  • generate_text_to_image(prompt, resolution, aspect_ratio, use_search_grounding, ...) - Generate images from text
  • generate_image_edit(image, prompt, resolution, aspect_ratio, ...) - Edit images with text prompts
  • generate_multi_image(images, prompt, resolution, aspect_ratio, ...) - Compose multiple images
  • generate_batch(prompts, resolution, aspect_ratio, ...) - Batch generation

See Nano Banana API Documentation for complete details.


NanoBanana2LiteAdapter​

Adapter for Gemini 3.1 Flash-Lite Image (Nano Banana 2 Lite) -- Google's fastest and cheapest Gemini image tier (1K resolution only). Also exposes generate_virtual_tryon(), a lightweight try-on convenience method built on multi-image composition (not the highest-fidelity option -- see the note in Nano Banana API Documentation).

from tryon.api.nano_banana import NanoBanana2LiteAdapter

adapter = NanoBanana2LiteAdapter(api_key="your_api_key")

images = adapter.generate_text_to_image(
prompt="A fashion model wearing a summer collection",
aspect_ratio="16:9",
)

# Lightweight virtual try-on
images = adapter.generate_virtual_tryon(
person="person.jpg",
garment="jacket.jpg",
garment_description="olive green bomber jacket",
)

Parameters:

  • api_key (str, optional): Google Gemini API key. Defaults to GEMINI_API_KEY environment variable

Methods:

  • generate_text_to_image(prompt, aspect_ratio, ...) - Generate images from text (1K only)
  • generate_image_edit(image, prompt, aspect_ratio, ...) - Edit images with text prompts
  • generate_multi_image(images, prompt, aspect_ratio, ...) - Compose multiple images
  • generate_virtual_tryon(person, garment, garment_description, ...) - Lightweight virtual try-on
  • generate_batch(prompts, aspect_ratio, ...) - Batch generation

See Nano Banana API Documentation for complete details.


Flux2ProAdapter​

Adapter for FLUX.2 [PRO] - high-quality image generation with standard controls.

from tryon.api import Flux2ProAdapter

adapter = Flux2ProAdapter(api_key="your_api_key")

images = adapter.generate_text_to_image(
prompt="A professional fashion model wearing elegant evening wear",
width=1024,
height=1024,
seed=42
)

Parameters:

  • api_key (str, optional): BFL API key. Defaults to BFL_API_KEY environment variable

Methods:

  • generate_text_to_image(prompt, width, height, seed, safety_tolerance, output_format, ...) - Generate images from text
  • generate_image_edit(prompt, input_image, width, height, seed, ...) - Edit images with text prompts
  • generate_multi_image(prompt, images, width, height, seed, ...) - Compose multiple images (up to 8)

See FLUX.2 API Documentation for complete details.


Flux3ImageAdapter​

Adapter for FLUX 3 Image — unified generate/edit on POST /v1/flux-3-image.

from tryon.api import Flux3ImageAdapter

adapter = Flux3ImageAdapter()

images = adapter.generate_text_to_image(
prompt="Editorial fashion still",
aspect_ratio="3:4",
resolution="2k",
grounding=True,
)

Parameters:

  • api_key (str, optional): BFL API key. Defaults to BFL_API_KEY

Methods:

  • generate_text_to_image(prompt, aspect_ratio, resolution, safety_tolerance, grounding, ...) — Text-only generation
  • generate_image_edit(prompt, input_image, reference_images, ...) — Edit or restyle with references
  • generate_multi_image(prompt, images, ...) — Compose from multiple references (up to 10)

Registry id: flux3-image on generate and edit. See FLUX 3 Image for CLI and MCP notes.


Flux3ImageKleinAdapter​

Adapter for FLUX 3 Image Klein — unified generate/edit on POST /v1/flux-3-image-klein (distilled sibling; no grounding; optional seed / steps / exact width×height).

from tryon.api import Flux3ImageKleinAdapter

adapter = Flux3ImageKleinAdapter()

images = adapter.generate_text_to_image(
prompt="Editorial fashion still",
aspect_ratio="3:4",
resolution="2k",
seed=0,
)

Registry id: flux3-image-klein on generate and edit. See FLUX 3 Image Klein.


Flux3ImageKleinLocalAdapter​

Local FLUX 3 Image Klein via Diffusers ModularPipeline (default black-forest-labs/flux-3-image-klein).

Registry id: flux3-image-klein-local on generate and edit. See FLUX 3 Image Klein (local).


Flux3VideoAdapter​

Adapter for FLUX 3 Video — POST /v1/flux-3-video (t2v, i2v keyframes, v2v, draft_enhance).

from tryon.api import Flux3VideoAdapter

adapter = Flux3VideoAdapter()
video_bytes = adapter.generate_text_to_video(
prompt="Runway walk under soft key light",
duration=8,
resolution="fhd",
)

Methods:

  • generate_text_to_video(...) — t2v; pass video= for v2v or draft_cache= for draft enhance
  • generate_image_to_video(image, prompt, end_image=..., ...) — i2v keyframes
  • enhance_draft(draft_cache, ...) — full-quality render after --draft

Registry id: flux3-video on video-generate. See FLUX 3 Video.

Flux3MaxVideoAdapter​

Adapter for FLUX 3 Max — same POST /v1/flux-3-video contract with version=max (fastest FLUX 3 video tier).

from tryon.api import Flux3MaxVideoAdapter

adapter = Flux3MaxVideoAdapter()
mp4 = adapter.generate_text_to_video(
prompt="Runway walk under soft key light",
aspect_ratio="9:16",
duration=10,
resolution="fhd",
)

Registry id: flux3-max on video-generate. See FLUX 3 Max.


Flux2FlexAdapter​

Adapter for FLUX.2 [FLEX] - flexible image generation with advanced controls.

from tryon.api import Flux2FlexAdapter

adapter = Flux2FlexAdapter(api_key="your_api_key")

images = adapter.generate_text_to_image(
prompt="A stylish fashion model wearing elegant evening wear",
width=1024,
height=1024,
guidance=7.5, # Higher = more adherence to prompt (1.5-10)
steps=50, # More steps = higher quality
prompt_upsampling=True,
seed=42
)

Parameters:

  • api_key (str, optional): BFL API key. Defaults to BFL_API_KEY environment variable

Methods:

  • generate_text_to_image(prompt, width, height, seed, guidance, steps, prompt_upsampling, ...) - Generate images from text with advanced controls
  • generate_image_edit(prompt, input_image, width, height, seed, guidance, steps, ...) - Edit images with advanced controls
  • generate_multi_image(prompt, images, width, height, seed, guidance, steps, ...) - Compose multiple images with advanced controls

See FLUX.2 API Documentation for complete details.


GPTImageAdapter​

OpenAI Images API. Constructor / --model gpt-image default is GPT-Image-1.5. ChatGPT Images 2.5 is --model gpt-image-2.5 (Flare) and --model gpt-image-2.5-sunburst. Same OPENAI_API_KEY.

from tryon.api.openAI.image_adapter import GPTImageAdapter

adapter = GPTImageAdapter(model_version="gpt-image-2.5") # Flare
images = adapter.generate_text_to_image("editorial still, linen trench")

See GPT Image for sizes, quality (xhigh / max on 2.5), and edit / mask usage.


Video Generation API Adapters​

Also available via the CLI/MCP registry:

AdapterCLI modelDocs
SeedanceAdapterseedanceSeedance & Seedream
LumaRay32Adapterluma-ray-3.2Luma Ray 3.2
KlingVideoAdapterkling-v3 / kling-v3-omni / kling-v2-5-turboKling Video
GrokImagineVideoAdaptergrok-imagine-videoGrok Imagine
LTXVideoAdapterltx-2.5-apiLTX-2.5 API
HailuoVideoAdapterhailuo-2.3Hailuo
MiniMaxH3Adapterminimax-h3 / minimax-h3-maxMiniMax H3
FalH3MaxAdapterfal-h3-max / fal-h3-max-lipsync / fal-h3-max-relightMiniMax H3 Max (Fal)
PVideo2ProAdapterp-video-2-proPruna AI
WanVideoAdapterwan-api / wan-3.0Wan
RunwayVideoAdapterrunway-gen4.5Runway Gen-4.5
Cosmos3VideoAdaptercosmos3NVIDIA NIM
VeoAdapterveoVeo 3.1
SoraVideoAdapter (deprecated — API removed 2026-09-24) / LumaAIVideoAdaptersora / luma-videoexisting pages

Local twins: Cosmos3LocalAdapter (cosmos3-local), LTX25Adapter (ltx-2.5), MiniMaxH3LocalAdapter (minimax-h3-local), Wan22Adapter (wan-2.2). Wan 3.0 is API-only.

Image counterparts: SeedreamAdapter (seedream), IdeogramAdapter (ideogram), RecraftAdapter (recraft-v3 generate/edit/bg-remove), PImageIdeogramAdapter (p-image-ideogram), GrokImagineImageAdapter (grok-imagine-image), MuseImageAdapter (muse-image). Muse Video has no API yet — see Muse Video. Dedicated page: Recraft V3.

GeminiOmniAdapter​

Adapter for Gemini Omni 1.2 Flash (gemini-omni-1.2-flash; 1.1 selectable) -- multimodal video generation, conversational editing and clip extension via the Interactions API.

from tryon.api.omni import GeminiOmniAdapter

adapter = GeminiOmniAdapter(api_key="your_api_key")

video = adapter.generate_text_to_video(
prompt="A fashion model walking a runway",
aspect_ratio="9:16",
)

Parameters:

  • api_key (str, optional): Google Gemini API key. Defaults to GEMINI_API_KEY
  • model (str, optional): Defaults to gemini-omni-1.2-flash; gemini-omni-1.1-flash also accepted

Methods:

  • generate_text_to_video(prompt, aspect_ratio, resolution, previous_interaction_id, video, duration, ...) - Text-to-video (or edit / extend turn); duration 3-15s
  • generate_image_to_video(image, prompt, aspect_ratio, reference_images, ...) - Image-to-video
  • edit_video(prompt, previous_interaction_id, ...) - Conversational edit of a prior clip
  • extend_video(video, prompt, ...) - Extend an existing clip by 3-10s

See Gemini Omni 1.2 Flash Documentation for complete details.


Multimodal Understanding API Adapters​

KimiUnderstandAdapter​

Adapter for Moonshot AI's Kimi K2.6, K2.7 Code, and K3 models -- general-purpose, natively multimodal image and video understanding (not limited to fashion).

from tryon.api import KimiUnderstandAdapter

adapter = KimiUnderstandAdapter() # kimi-k2.6 by default

result = adapter.understand_image(
"garment.jpg",
prompt="Describe this outfit: color, pattern, style, fit, and material."
)
print(result["text"])

Parameters:

  • api_key (str, optional): Moonshot API key. Defaults to MOONSHOT_API_KEY environment variable
  • model (str, optional): "kimi-k2.6" (default), "kimi-k2.7-code", "kimi-k2.7-code-highspeed", "kimi-k3", "kimi-k3.1-pro", "kimi-k3.1-pro-highspeed", or "kimi-k2.5"

Methods:

  • understand_image(image, prompt, ...) - Understand one or more images
  • understand_video(video, prompt, ...) - Understand video content
  • understand(image=None, video=None, prompt=...) - Single entry point accepting either/both
  • chat(messages, tools=None, ...) - Multi-turn/tool-calling escape hatch

See Kimi API Documentation for complete details, or the open-weight Kimi-VL local model for GPU-only deployment.


GLMUnderstandAdapter​

Adapter for Zhipu's GLM-5.3-FlashX via Z.ai — general-purpose, natively multimodal image and video understanding (200 tok/s serving tier of GLM-5.3-Flash).

from tryon.api import GLMUnderstandAdapter

adapter = GLMUnderstandAdapter() # glm-5.3-flashx by default

result = adapter.understand_image(
"garment.jpg",
prompt="Describe this outfit: color, pattern, style, fit, and material."
)
print(result["text"])

Parameters:

  • api_key (str, optional): Z.ai key. Defaults to ZAI_API_KEY environment variable
  • model (str, optional): "glm-5.3-flashx" (default)
  • base_url (str, optional): Defaults to ZAI_BASE_URL or the Z.ai default

Methods:

  • understand_image(image, prompt, ...) - Understand one or more images
  • understand_video(video, prompt, ...) - Understand video content
  • understand(image=None, video=None, prompt=...) - Single entry point accepting either/both

Thinking is always on (thinking.type only supports enabled); use reasoning_effort (low / high / max) to control depth.

See GLM-5.3-FlashX Documentation for complete details.


GeminiUnderstandAdapter / GeminiTTSAdapter​

Gemini multimodal understanding (image, video, audio, PDF → text) and Gemini 3.8 Flash / Flash-Lite text-to-speech (WAV audio, 30 voices, two-speaker dialogue). Both use GEMINI_API_KEY.

Registry: gemini-3.8-flash (Flash) and gemini-4-argon (flagship reasoning, long decode, agentic video).

from tryon.api.gemini import GeminiUnderstandAdapter, GeminiTTSAdapter

text = GeminiUnderstandAdapter(model="gemini-4-argon").understand(
video="runway.mp4", prompt="Summarise the looks.", video_processing="agentic", max_tokens=131072,
)["text"]
wav = GeminiTTSAdapter().generate_speech("Welcome to the spring collection.", voice="Kore", style="warm")

See Gemini 3.8 Flash and Gemini 4 Argon.

Gemini Embedding 2 (multimodal embeddings)​

from tryon.api.gemini import GeminiEmbeddingAdapter

out = GeminiEmbeddingAdapter().embed(image=["boot1.jpg", "boot2.jpg"], query="black leather ankle boots")
print(out["scores"]) # cosine similarity per image; out["embeddings"] is an L2-normalised array

See Gemini Embedding 2 for details.

ClaudeUnderstandAdapter​

Adapter for Anthropic's Claude Haiku 5.5 (claude-haiku-5-5) — fast, low-cost text and image understanding (no video).

from tryon.api.claude import ClaudeUnderstandAdapter

adapter = ClaudeUnderstandAdapter() # reads ANTHROPIC_API_KEY
result = adapter.understand("garment.jpg", prompt="List fabric, colour and fit.", effort="low", thinking=False)
print(result["text"])

See Claude Haiku 5.5 for details.

JevAdapter​

Adapter for Typesafe AI's Jev "System One" decision model (decide service): calibrated yes/no, choice and score answers about text/JSON state.

from tryon.api.typesafe import JevAdapter

out = JevAdapter().decide(state="Red satin gown", questions={"formal": {"type": "noul", "instructions": "Formal wear?"}})

See Typesafe Jev for details. Open-weight, image-capable twins: Liquid d1. More decision models on the same schema (Perplexity Decider, Cloudflare Clef, Kev, AutoTrust JEV): Open decision models.

D3ApiAdapter / D3LocalAdapter​

Adapters for vLLM Semantic Router Decision 3.0 (decide service): multimodal System One with box and track question types (hosted + local).

from tryon.api.vllm_sr import D3ApiAdapter

out = D3ApiAdapter(model_id="vllm-sr/d3-turbo").decide(
state="Packshot",
image="dress.jpg",
questions={"logo": {"type": "box", "instructions": "Brand logo patch"}},
)

Registry: d3-turbo … d3-edge (API, DECISION_API_KEY); d3-*-local (Path B). See Decision 3.0 hosted and local d3.

Dream1Adapter​

Hosted Dream-1 / Dream-1-flash World Action Models on the robot-act service (dreamlabs-client, DREAM_API_KEY). Returns JSON action chunks from camera frames + robot state — not fashion media generation.

from tryon.api.dream_labs import Dream1Adapter

out = Dream1Adapter(checkpoint="dreamlabs/dream-1").get_action(
frames="frames.json",
observation="obs.json",
)

See Dream-1. No local policy weights.

DeepSeekUnderstandAdapter​

Adapter for DeepSeek's deepseek-flash — general-purpose, natively multimodal image understanding (no video). Currently the cheapest frontier-class VLM available.

from tryon.api import DeepSeekUnderstandAdapter

adapter = DeepSeekUnderstandAdapter() # deepseek-flash by default

result = adapter.understand_image(
"garment.jpg",
prompt="Describe this outfit: color, pattern, style, fit, and material."
)
print(result["text"])

Parameters:

  • api_key (str, optional): Defaults to DEEPSEEK_API_KEY environment variable
  • model (str, optional): "deepseek-flash" (default)
  • base_url (str, optional): Defaults to DEEPSEEK_BASE_URL or the DeepSeek Platform default

Methods:

  • understand_image(image, prompt, ...) - Understand one or more images
  • understand(image=..., prompt=...) - CLI / MCP entry point; raises ValueError without an image

Thinking is on by default; reasoning_effort (none / low / high / max) controls depth, where none disables it.

See DeepSeek-V4.1-Flash Documentation for complete details.


QwenUnderstandAdapter​

Adapter for Alibaba DashScope Qwen3.8-Max and Qwen3.8-Omni-Flash — native multimodal understanding (text + image + video → text on Max; text + image + audio + video → text on Omni-Flash) with thinking / reasoning_effort. OpenTryOn exposes the understand path (plus chat() for multi-turn/tools on Max).

from tryon.api import QwenUnderstandAdapter

adapter = QwenUnderstandAdapter() # qwen3.8-max by default

result = adapter.understand_image(
"garment.jpg",
prompt="Describe this outfit: color, pattern, style, fit, and material."
)
print(result["text"])

Parameters:

  • api_key (str, optional): Defaults to DASHSCOPE_API_KEY
  • model (str, optional): "qwen3.8-max" (default) or "qwen3.8-omni-flash"
  • base_url (str, optional): Defaults to QWEN_BASE_URL or the international DashScope compatible-mode URL

Methods:

  • understand_image(image, prompt, ...) - Understand one or more images
  • understand_video(video, prompt, ...) - Understand video content
  • understand(image=None, video=None, audio=None, prompt=...) - Single entry point; audio requires model="qwen3.8-omni-flash"
  • chat(messages, tools=None, ...) - Multi-turn/tool-calling escape hatch

Series capabilities (vendor): ~1M context on Max, long video, coding/agent strengths, structured output and built-in tools on DashScope. Local open counterpart: qwen3.8 (Qwen/Qwen3.8-27B).

See Qwen3.8-Max API Documentation for complete details, or the open-weight Qwen3.8 local model for GPU-only deployment.


Hy4Adapter​

Tencent Hy4 preview (770B MoE LLM) via TokenHub or a local vLLM/SGLang OpenAI server. Same class for --model hy4-preview and hy4-preview-local.

from tryon.api import Hy4Adapter

adapter = Hy4Adapter() # TOKENHUB_API_KEY
result = adapter.understand(prompt="Write a lookbook caption for a linen trench.")
print(result["text"])

See Hy4 TokenHub and Hy4 local.


BeamAdapter​

Reflection Beam 1.0 (REFLECTION_API_KEY) on understand. Text chat only. Upstream id Beam-1.0-501B-A23B. Reasoning is always on.

See Beam.


LagunaAdapter​

Poolside Laguna (POOLSIDE_API_KEY) on understand: laguna-xs.2, laguna-xs.2.1, laguna-m.1. Text chat only. Thinking on by default.

See Laguna.


TrinityAdapter​

Arcee Trinity (ARCEE_API_KEY) on understand: trinity-large (400B Preview), trinity-large-thinking, trinity-mini. trinity-nano is a local OpenAI-compatible client (TRINITY_BASE_URL). Text chat only.

See Trinity.


MoondreamAdapter​

Moondream Cloud (MOONDREAM_API_KEY) for moondream-3.1 and moondream-3-preview. understand is query or caption. detect is boxes, points, or an SVG path. Photon local twin: moondream-3.1-local.

See Moondream.


InceptionUnderstandAdapter​

Inception Labs Mercury 3 diffusion LLM via OpenAI-compatible v1/chat/completions (mercury-3). Text-only on the chat endpoint (1M context).

from tryon.api.inception import InceptionUnderstandAdapter

adapter = InceptionUnderstandAdapter() # INCEPTION_API_KEY
result = adapter.understand(
prompt="Write a concise fit guide for wide-leg denim.",
reasoning_effort="medium",
)
print(result["text"])

See Mercury 3.


NemotronOmniUnderstandAdapter / Cosmos3ReasonerAdapter / Cosmos3VideoAdapter​

NVIDIA NIM Path A (NVIDIA_API_KEY). Omni and Reasoner are OpenAI-compatible chat understand models; Cosmos 3 Generator is T2V/I2V infer (b64_video).

from tryon.api.nvidia import NemotronOmniUnderstandAdapter, Cosmos3VideoAdapter

print(NemotronOmniUnderstandAdapter().understand(image="garment.jpg")["text"])
mp4 = Cosmos3VideoAdapter().generate_text_to_video("runway walk at dusk")

See NVIDIA NIM.


QwenImageAdapter​

Adapter for Alibaba DashScope Qwen-Image 3.0 — text-to-image, image editing (1–3 refs), and person+garment virtual try-on. Same DASHSCOPE_API_KEY as QwenUnderstandAdapter.

from tryon.api import QwenImageAdapter

adapter = QwenImageAdapter() # qwen-image-3.0-pro by default
images = adapter.generate_text_to_image("editorial lookbook, linen trench")
tryon = adapter.generate_virtual_tryon("person.jpg", "garment.jpg")

Parameters:

  • api_key (str, optional): Defaults to DASHSCOPE_API_KEY
  • model (str, optional): "qwen-image-3.0-pro" (default), "qwen-image-3.0", "qwen-image-2.0-pro", "qwen-image-2.0"
  • base_url (str, optional): Defaults to QWEN_IMAGE_BASE_URL or the international DashScope /api/v1 host

Methods:

  • generate_text_to_image(prompt, size=None, n=1, ...) — T2I
  • generate_image_edit(image, prompt, ...) — I2I (one image or a list of 1–3)
  • generate_multi_image(images, prompt, ...) — I2I composition
  • generate_virtual_tryon(person, garment, garment_description=None, ...) — VTON wrapper

CLI: opentryon generate|edit|vton --model qwen-image. Pair with understand --model qwen3.8-max to caption a garment first. Local twin: QwenImageLocalAdapter / --model qwen-image-local (local docs).

See Qwen-Image API Documentation for complete details.


Background Removal API​

BEN2BackgroundRemoverAdapter​

Adapter for BEN2 (Background Erase Network 2) - state-of-the-art background removal for fashion and product images.

from tryon.api.ben2 import BEN2BackgroundRemoverAdapter

adapter = BEN2BackgroundRemoverAdapter()

# Single image background removal
result = adapter.remove_background("model.jpg", refine=True)
result[0].save("model_no_bg.png")

# Batch processing
results = adapter.remove_background_batch(
["model1.jpg", "model2.jpg", "model3.jpg"],
refine=True
)

Parameters:

  • weights_path (str, optional): Custom weights path. Auto-downloads from Hugging Face if not specified
  • device (str, optional): Device to use ("cuda" or "cpu"). Auto-detected if not specified

Methods:

  • remove_background(image, refine=False) - Remove background from single image
  • remove_background_batch(images, refine=False) - Remove background from multiple images
  • load_image(input_data) - Load image from path, URL, or BytesIO

Features:

  • Automatic weight download from Hugging Face
  • GPU acceleration with CUDA support
  • Foreground refinement for higher quality edges
  • Batch processing for multiple images
  • Supports file paths, URLs, BytesIO, and PIL Images

See BEN2 API Documentation for complete details.


Utility Functions​

convert_to_jpg​

Convert image to JPG format.

from tryon.preprocessing import convert_to_jpg

convert_to_jpg(
image_path: str,
output_dir: str,
size: Optional[tuple] = None
)

Parameters:

  • image_path (str): Path to input image
  • output_dir (str): Directory to save converted JPG
  • size (tuple, optional): Desired output size (width, height)

For complete API documentation, see individual module documentation.