# TryOn-API.com — Full API Reference (for LLMs) > TryOn-API.com is the "OpenRouter for virtual try-on": one OpenAI-compatible API gateway in > front of many virtual try-on and image-generation models. Send one request, in one schema, > with one API key, and TryOn-API routes it to the chosen provider (Kling, Google Gemini, > OpenAI, or FAL). Billing is unified: every request is priced in credits drawn from a single > balance, regardless of which provider served it. Canonical site: https://tryon-api.com API base URL: https://tryon-api.com/api/v1 ------------------------------------------------------------------------------ ## 1. Concepts ------------------------------------------------------------------------------ - **Unified gateway.** You integrate once against an OpenAI-compatible surface. Switching models is a one-line `model` change; no new SDK, no per-provider billing accounts. - **Two kinds of models:** - `dedicated-tryon` — purpose-built apparel virtual try-on (e.g. Kling Kolors). Takes a person image + garment image and returns the person wearing the garment. - `generative-image` — general image models (Gemini, gpt-image-1, FLUX Kontext) repurposed for try-on via prompt + reference images. More flexible, often faster. - **Credits.** Each model has a fixed credit price per successful request. One balance covers all providers. Check it with `GET /api/v1/credits`. - **Execution modes.** - `sync` — the response contains the image directly. - `submit-poll` — the request returns a job id; poll until the result is ready (used by slower dedicated try-on models such as Kling). ------------------------------------------------------------------------------ ## 2. Authentication ------------------------------------------------------------------------------ All `/api/v1/*` endpoints require a bearer token: Authorization: Bearer tryon_... Create and manage keys in the console (https://tryon-api.com/keys.html) or via `POST /api/v1/keys`. Keep keys server-side; never embed them in client code shipped to users. ------------------------------------------------------------------------------ ## 3. Endpoints ------------------------------------------------------------------------------ ### 3.1 POST /api/v1/chat/completions (OpenAI-compatible, primary route) Drop-in compatible with the OpenAI / OpenRouter chat completions API. Set `modalities: ["image"]` and attach images with a `tryon_role` of `"person"` or `"garment"`. Request: POST https://tryon-api.com/api/v1/chat/completions Authorization: Bearer tryon_... Content-Type: application/json { "model": "kling/kolors-v1-5", "modalities": ["image"], "stream": false, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "put the garment on the person" }, { "type": "image_url", "image_url": { "url": "data:image/png;base64,..." }, "tryon_role": "person" }, { "type": "image_url", "image_url": { "url": "data:image/png;base64,..." }, "tryon_role": "garment" } ]} ] } `image_url.url` may be a `data:` URL (base64) or a publicly reachable https URL. Response (non-streaming): { "id": "chatcmpl-...", "model": "kling/kolors-v1-5", "choices": [ { "index": 0, "finish_reason": "stop", "message": { "role": "assistant", "content": "", "images": [ { "type": "image_url", "image_url": { "url": "https://.../result.png" } } ] } } ] } Read the result with: `res.choices[0].message.images[0].image_url.url`. Streaming: set `"stream": true` to receive Server-Sent Events (SSE) with incremental progress chunks, terminated by a `data: [DONE]` line — same framing as OpenAI streaming. ### 3.2 GET /api/v1/models Lists every available model with capabilities and credit pricing. No body required. GET https://tryon-api.com/api/v1/models Authorization: Bearer tryon_... Returns a JSON list; each entry includes the slug, provider, kind (`dedicated-tryon` | `generative-image`), display name, description, capabilities (categories, max person/garment images, mask support, prompt override, fast mode), execution mode, expected latency, and credit price. ### 3.3 POST /api/v1/tryon (native multipart) A simpler, non-chat route: upload a person image and a garment image directly. POST https://tryon-api.com/api/v1/tryon Authorization: Bearer tryon_... Content-Type: multipart/form-data fields: model: kling/kolors-v1-5 person_images: garment_images: prompt: put the garment on the person (optional; for prompt-override models) fast_mode: true|false (optional; fast mode where supported) - For `sync` models the response contains the result image. - For `submit-poll` models (e.g. Kling) the response contains a job id. ### 3.4 GET /api/v1/tryon/{id} Poll an async try-on job by id. Returns status (e.g. pending/processing/succeeded/failed) and, when complete, the result image URL. There is also a WebSocket variant at `GET /api/v1/tryon/{id}/ws` for live progress. ### 3.5 GET /api/v1/credits Returns the current unified credit balance for the authenticated account. ### 3.6 GET /api/v1/keys · POST /api/v1/keys List existing API keys, or create a new one (optionally named). Newly created secrets are shown once at creation time. ### 3.7 GET /api/v1/usage · GET /api/v1/generation Usage and per-generation records for the authenticated account. ------------------------------------------------------------------------------ ## 4. Models catalog (slugs, kinds, pricing, latency) ------------------------------------------------------------------------------ ### kling/kolors-v1-5 — Kling Kolors Virtual Try-On v1.5 - Provider: Kling Kind: dedicated-tryon - Categories: apparel - Execution: submit-poll (~30–60s, expected ~45s) - Price: 1 credit per request - Notes: dedicated, high-fidelity apparel try-on. 1 person + 1 garment image. Supports fast mode. No mask, no prompt override. ### google/gemini-2.5-flash-image — Gemini 2.5 Flash Image - Provider: Google Kind: generative-image - Categories: apparel, footwear, accessory - Execution: sync (~5–15s, expected ~12s) - Price: 1 credit per request - Notes: general image model repurposed for try-on via prompt. Supports prompt override and fast mode. No mask. ### openai/gpt-image-1 — OpenAI gpt-image-1 - Provider: OpenAI Kind: generative-image - Categories: apparel, footwear, accessory - Execution: sync (~10–25s, expected ~18s) - Price: 2 credits per request - Notes: general image model (Edits API) repurposed for try-on. Supports mask, prompt override and fast mode. ### fal/flux-kontext — FAL FLUX.1 Kontext (multi) - Provider: FAL Kind: generative-image - Categories: apparel, footwear, accessory - Execution: sync (~10–20s, expected ~15s) - Price: 1 credit per request - Notes: FLUX Kontext multi-image, repurposed for try-on via prompt. Supports prompt override and fast mode. No mask. ------------------------------------------------------------------------------ ## 5. Migration: from OpenAI / OpenRouter ------------------------------------------------------------------------------ Because the chat completions route is OpenAI-compatible, migrating is three changes: ```js import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://tryon-api.com/api/v1", // 1. base URL apiKey: process.env.TRYON_API_KEY, // 2. your TryOn-API key }); const res = await client.chat.completions.create({ model: "kling/kolors-v1-5", // 3. a try-on model modalities: ["image"], messages: [{ role: "user", content: [ { type: "text", text: "put the garment on the person" }, { type: "image_url", image_url: { url: personDataUrl }, tryon_role: "person" }, { type: "image_url", image_url: { url: garmentDataUrl }, tryon_role: "garment" }, ]}], }); const imageUrl = res.choices[0].message.images[0].image_url.url; ``` Curl equivalent: ```sh curl https://tryon-api.com/api/v1/chat/completions \ -H "Authorization: Bearer $TRYON_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "fal/flux-kontext", "modalities": ["image"], "messages": [{ "role": "user", "content": [ { "type": "text", "text": "put the garment on the person" }, { "type": "image_url", "image_url": { "url": "https://example.com/person.jpg" }, "tryon_role": "person" }, { "type": "image_url", "image_url": { "url": "https://example.com/garment.jpg" }, "tryon_role": "garment" } ]}] }' ``` ------------------------------------------------------------------------------ ## 6. FAQ ------------------------------------------------------------------------------ Q: What is TryOn-API.com? A: A unified, OpenAI-compatible API gateway for virtual try-on — "OpenRouter for try-on". One key and one schema route to Kling, Gemini, gpt-image-1 and FLUX, with unified credit billing. Q: Is it OpenAI-compatible? A: Yes. The `/api/v1/chat/completions` route follows the OpenAI/OpenRouter schema, including streaming SSE and `modalities:["image"]`. Existing OpenAI SDKs work by changing the base URL. Q: Which models are supported? A: kling/kolors-v1-5, google/gemini-2.5-flash-image, openai/gpt-image-1, fal/flux-kontext. See `GET /api/v1/models` for the live list. Q: How is pricing calculated? A: Per successful request, in credits, from a single unified balance. Most models cost 1 credit; gpt-image-1 costs 2. Check balance at `GET /api/v1/credits`. Q: How fast is a try-on? A: Generative-image models typically return in ~5–25s (sync). Dedicated Kling try-on runs ~30–60s via submit + poll. Q: How do I migrate from OpenRouter or OpenAI? A: Change the base URL to https://tryon-api.com/api/v1, use your TryOn-API key, and pick a try-on model slug. See section 5. Q: Sync vs async? A: Sync models return the image in the response. Async (submit-poll) models return a job id; poll `GET /api/v1/tryon/{id}` (or subscribe to the `/ws` variant) until it completes.