LayerFrames is the rendering engine we built for TryOnFrames, our own consumer try-on app. Everything it does is exposed to you as an API.

Six stages run per request. You call one endpoint.
A still image, an uploaded photo, or a live webcam frame arrives over REST or WebSocket. We accept JPEG, PNG, WebP up to 12 MB, or raw RGB frames in stream mode.
68-point landmark detection, 3-axis head pose estimation, depth and occlusion mask (hair, hands, fringe), skin tone and lighting estimation.
Your SKU's measured geometry — lens width, bridge, temple length — is aligned to the detected face so the frame sits at true physical scale, not an approximate sticker.
The diffusion renderer matches scene lighting, casts nose-pad and temple shadows, applies lens tint/gradient/mirror, reflections, and prescription lens distortion.
We return pupillary distance, face width, temple-to-temple fit, and a 0–1 fit score per SKU so you can badge and rank recommendations.
A hosted CDN render URL, a base64 payload, or a streamed video track — whichever your storefront needs. Renders are cached per face-hash + SKU.
These are low-fidelity mockups of the surfaces our partners ship. Your design system, your copy — we only supply the render.

The primary surface. A 'Try on with AI' button next to Add to Cart opens a modal with the customer's camera and the current SKU already loaded.
Once a shopper has one selfie in session, every tile in the grid can render them wearing that frame — a personalized catalog with no extra captures.
Server-side renders let you email a customer wearing the frame they abandoned. This is consistently the highest-CTR remarketing asset our partners run.
The same API drives tablet kiosks for optical retail: show 400 frames without pulling a single pair off the wall.
Most teams start with the embed script and graduate to the API once they want try-on in the category grid or in email.
<!-- 1. Load once, site-wide -->
<script async src="https://cdn.layerframes.com/embed.js"
data-key="lf_pub_9c2f..."></script>
<!-- 2. Anywhere on a product page -->
<button data-layerframes-tryon
data-frame-id="frm_classic_acetate_black">
Try on with AI
</button>import { TryOnButton } from "@layerframes/react";
export function ProductPage({ sku }) {
return (
<TryOnButton
frameId={sku.layerframesId}
variant="inline"
onAddToCart={(frame) => cart.add(frame.id)}
onEvent={(e) => analytics.track(e.name, e.payload)}
/>
);
}Try-on stops being a novelty when you can prove it sells. Every session streams structured events to your warehouse or via webhook.
{
"event": "tryon.added_to_cart",
"session_id": "ses_2Zq81",
"frames_tried": 7,
"seconds_active": 96,
"converted_frame_id": "frm_aviator_gold",
"fit_score": 0.88,
"device": "ios_safari"
}