Rate Limits & Concurrency
Rate limits and concurrency for the virtual try-on API: requests per minute per IP and per account, how credit holds cap parallel jobs, and how to back off.
The virtual try-on API applies two kinds of limits. Rate limits cap how many requests you send per time window.
Concurrency caps how much work can run at once, measured in held credits. Both return 429 with a different
error.name, and you handle them differently.
Rate limits
| Scope | Endpoints | Limit | Counted per |
|---|---|---|---|
| All requests | Every /api/v1 endpoint, including /health | 300 requests / minute | IP address |
| Photo try-ons | POST /tryon/fashion, /tryon/hairstyle and /tryon/tattoo combined | 10 requests / minute | Account |
| Live garments | POST /live/garments | 120 requests / minute | Account |
| Live sessions | POST /live/sessions | 300 requests / hour | Account |
| Live heartbeat | POST /live/sessions/{id}/heartbeat (browser) | 90 requests / minute | IP address |
| Live garment switch | POST /live/sessions/{id}/garments/{garmentId} (browser) | 30 requests / minute | IP address |
| Live end | POST /live/sessions/{id}/end (browser) | 120 requests / minute | IP address |
Things to know:
- The photo try-on limit is per account, not per key. Creating more keys doesn't raise it. Try-ons made on the same account in the TryItOn app and the storefront widget count toward the same 10 per minute.
- The 300/minute IP limit is shared by every request from that IP, polling included. Several workers behind one NAT address share one budget.
- Over a limit you get
429witherror.name: "RateLimitExceeded". The API doesn't send aRetry-Afterheader or rate-limit headers.
Concurrency
Every running job and live session holds credits until it ends: a photo try-on holds num_samples credits, a
live session holds 1. While 5 or more credits are held on your account, new photo try-ons and new live sessions
are refused with 429 ConcurrencyLimitExceeded.
The check looks at what's already held, not at the size of the new request. A worked example on an account with plenty of credits:
| Step | Request | Held before | Result | Held after |
|---|---|---|---|---|
| 1 | Fashion try-on, num_samples: 4 | 0 | Accepted | 4 |
| 2 | Hairstyle try-on, num_samples: 1 | 4 | Accepted (4 is under 5) | 5 |
| 3 | Tattoo try-on, num_samples: 1 | 5 | 429 ConcurrencyLimitExceeded | 5 |
| 4 | Step 1's job completes | — | Its 4 credits are charged or released | 1 |
| 5 | Retry step 3 | 1 | Accepted | 2 |
So with num_samples: 1 you can run up to 5 jobs at once. With num_samples: 4 you can run 2 (the second one is
accepted because 4 is under 5, which brings the total to 8 held).
Two more rules:
- Live sessions: at most 3 can run at once per account. A fourth start returns
429 LiveTryonBusy. Each running session also holds 1 credit toward the limit above. - Credits come first: if you're also short of credits, you get
429 OutOfCreditsinstead ofConcurrencyLimitExceeded.
Jobs usually finish well within a minute. A job still running after 5 minutes is failed and its hold is released, so a stuck job can't block you for long.
How to back off
RateLimitExceeded: retry with exponential backoff and jitter, capped at 60 seconds, the length of the window. Better, pace yourself: keep photo try-on submits under 10 per minute per account with a queue on your side.ConcurrencyLimitExceeded: don't retry on a timer. Wait until one of your running jobs reachescompletedorfailed, then submit the next. A local queue that keeps at most 5 one-image jobs (or 2 four-image jobs) in flight avoids the error entirely.OutOfCredits: retrying won't help. Buy credits at tryiton.now/app/billing.- Polling: poll each job every 2 seconds or slower. With many jobs in flight, the 300/minute IP limit is the one you hit first.
A retry helper for submits:
import { TryItOn, TryItOnError } from "tryiton";
const client = new TryItOn({ apiKey: process.env.TRYITON_API_KEY });
const RETRYABLE = new Set(["RateLimitExceeded", "ConcurrencyLimitExceeded"]);
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
async function submitWithBackoff(submit, maxAttempts = 6) {
for (let attempt = 1; ; attempt++) {
try {
return await submit();
} catch (err) {
const retryable = err instanceof TryItOnError && RETRYABLE.has(err.errorName);
if (!retryable || attempt === maxAttempts) throw err;
const delayMs = Math.min(60_000, 2_000 * 2 ** (attempt - 1)) + Math.random() * 1_000;
await sleep(delayMs);
}
}
}
const jobId = await submitWithBackoff(() =>
client.tryOnFashion({
modelImage: "https://example.com/model.jpg",
garmentImage: "https://example.com/shirt.jpg",
}),
);
console.log(jobId);import os
import random
import time
from tryiton import TryItOn, TryItOnError
client = TryItOn(api_key=os.environ["TRYITON_API_KEY"])
RETRYABLE = {"RateLimitExceeded", "ConcurrencyLimitExceeded"}
def submit_with_backoff(submit, max_attempts=6):
for attempt in range(1, max_attempts + 1):
try:
return submit()
except TryItOnError as err:
if err.error_name not in RETRYABLE or attempt == max_attempts:
raise
delay = min(60.0, 2.0 * 2 ** (attempt - 1)) + random.random()
time.sleep(delay)
job_id = submit_with_backoff(
lambda: client.try_on_fashion(
model_image="https://example.com/model.jpg",
garment_image="https://example.com/shirt.jpg",
)
)
print(job_id)If your production traffic needs higher limits, contact contact@tryiton.now.
Related
Credits & Pricing
How virtual try-on API pricing works: 1 credit per output image for clothing, hairstyle and tattoo try-on, per-second live billing, holds and refunds.
Image Guidelines
How to get the best virtual try-on results: accepted image formats and limits, photo tips for clothing, hairstyle, tattoo and live try-on, and common failures.