AI Providers
Try-on generation is abstracted behind a provider interface so KIE.AI and fal.ai are interchangeable.
Interface
lib/server/try-on-provider.ts defines TryOnProviderClient:
type TryOnProviderClient = {
generateTryOn(input): Promise<TryOnResult>; // synchronous (polls)
createTryOnTask(input & { callBackUrl? }): Promise<TryOnTaskCreation>; // async
getTaskSnapshot(taskId): Promise<TryOnTaskSnapshot>; // poll provider directly
};createTryOnProviderClient({ provider, modelOverride }) returns the KIE or fal client
(lib/server/try-on-provider-client.ts). Default provider is kie.ai.
KIE.AI (lib/server/kie-ai-client.ts)
- Uses
KIE_API_KEY,KIE_API_BASE_URL,KIE_UPLOAD_BASE_URL,KIE_MODEL. createTryOnTaskresolves both images viaresolveInputImage— data URLs are uploaded to the provider, http URLs are passed through. So the person image can be a data URL and the garment a public URL.getTaskSnapshotpolls the KIE task;generateTryOnwraps create+poll with retries.KIE_ALLOW_MOCK_FALLBACKreturns a mock result when the key is missing or on provider error (useful for local/dev).
fal.ai (lib/server/fal-ai-client.ts)
- Alternative provider; selected per store via
stores.generation_provider='fal.ai'with modelnano-banana-2.
Per-store model selection
store.generation_provider + store.generation_model choose the client/model. Operators
can change a store’s model from the admin dashboard.
Prompts
The garment/person inputs plus product metadata feed buildTryOnPrompt (category, product
name/type) to steer the generation.