Client API Reference

Detailed documentation for VTONClient methods and schemas.

VTON Services

client.healthCheck()

Verifies the status and availability of the SMD VTON services.

const response = await client.healthCheck();
// Returns Promise<HealthCheckResponse>

client.uploadImages(userId, files, resolution)

Uploads local or binary image files (person/model profiles, garment photos) to obtain secure public cloud storage URLs required for try-on rendering.

  • userId string: Must match the account identifier of the API key owner.
  • files UploadFile[]: Array containing file paths (Node.js only), Browser Files, Blobs, Buffers, or custom structured objects: { data: Buffer | Blob | ArrayBuffer, name: string, type?: string }.
  • resolution number (Optional): Target resolution limit. Default is 1000.
const uploadRes = await client.uploadImages('user_abc123', [
  './person.jpg',
  './tshirt.png'
]);

client.generateTryOn(request)

Triggers the virtual try-on engine pipeline (asynchronous process returned synchronously when rendering finishes).

  • request VTONRequest:
    • model_name (Required): "fast" | "medium" | "quality".
    • inputClothesImageUrls (Required): Array of garment image URLs.
    • inputPersonImageUrls (Optional): Array of reference model/person URLs.
    • prompt (Optional): Custom VTON prompt description.
    • version (Optional): Engine model version (default 1.0).
    • productId (Optional): Tracking SKU.
    • externalUserId (Optional): Unique user ID of your client base.
    • metadata (Optional): Key-value pairs dictionary.
const result = await client.generateTryOn({
  model_name: 'quality',
  inputClothesImageUrls: ['https://assets.../garment.png'],
  inputPersonImageUrls: ['https://assets.../person.jpg']
});

client.getHistory(params)

Queries historical executions logs for audit and analytics.

const history = await client.getHistory({ userId: 'user_123', limit: 10 });

User & API Key Management

The SDK also features administrative endpoints to manage users, profile details, check credits, list/revoke API keys, and track subscriptions:

  • client.getUserCredits(userId) - Fetch remaining credit balance.
  • client.registerUser(user) - Create new developer profiles.
  • client.getProfileDetails(userId) - Retrieve account details and tier info.
  • client.updateProfile(userId, profile) - Update developer profile contact info.
  • client.deleteAccount(userId) - Wipe all account assets and history.
  • client.getSubscriptionStatus(userId) - Inspect subscription plan status.
  • client.generateApiKey(userId, label) - Generate a new authentication token.
  • client.listApiKeys(userId) - Enumerate active API keys.
  • client.revokeApiKey(userId, keyId) - Revoke and disable an API key.