fashn-logo
FASHNAI

Product to Model

Powered by best-in-class image editing AI, the Product to Model endpoint transforms product images into people wearing those products. It supports dual-mode operation: standard product-to-model (generates new person) and try-on mode (adds product to existing person).

This endpoint is designed specifically for wearable fashion items such as clothing, shoes, hats, jewelry, bags, and accessories.

Model Specifications
  • Model Name: product-to-model
  • Lifecycle: preview
  • Dual-Mode Operation: Product-only or Product + Model images
  • Processing Time: 20s–120s (see below)
  • Output Formats: PNG, JPEG
  • Delivery Methods: URL or Base64 encoding
  • Credits: 1-5 per output image depending on resolution and generation_mode (+3 per output image with face_reference)

Request

Generate product-to-model images by submitting your product and optional model images to the universal /v1/run endpoint:

POSThttps://api.fashn.ai/v1/run

Request Examples

curl -X POST https://api.fashn.ai/v1/run \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{
           "model_name": "product-to-model",
           "inputs": {
             "product_image": "http://example.com/path/to/product.jpg",
             "model_image": "http://example.com/path/to/person.jpg",
             "prompt": "professional office setting",
             "output_format": "png",
             "return_base64": false
           }
         }'

Response

Returns a prediction ID for status polling:

{
  "id": "123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1",
  "error": null
}

Request Parameters

product_image
Required
image URL | base64

URL or base64 encoded image of the product to be worn. Supports clothing, accessories, shoes, and other wearable fashion items.

image_promptimage URL | base64

Optional URL or base64 encoded inspiration image that guides pose, environment, and lighting while keeping the product centered in the final output.

Default: None

model_imageimage URL | base64

URL or base64 encoded image of the person to wear the product. When provided, enables try-on mode. When omitted, generates a new person wearing the product.

Cannot be combined with other image inputs (image_prompt, face_reference, or background_reference).

Default: None

face_referenceimage URL | base64

Optional face identity reference to guide who the generated person should look like. When provided, the pipeline refines identity to match the reference while keeping product fidelity.

Default: None

face_reference_mode'match_base' | 'match_reference'

Controls how the identity from face_reference influences pose and expression.

-match_reference favors the reference face’s pose and expression for maximum resemblance.

-match_base gives more weight to the prompt (or system default prompt if omitted) when generating the person's pose and expression.

Default: match_reference

promptstring

Additional instructions for person appearance (when model_image is not provided), styling preferences or background.

Examples: "man with tattoos", "tucked-in", "open jacket", "rolled-up sleeves", "studio background".

Default: None

aspect_ratiostring

Desired aspect ratio for the output image. If omitted, the generation inherits the aspect ratio from the most specific image supplied (model_imagebackground_referenceimage_promptproduct_image). Provide an explicit ratio to override that default even when using these image references.

Supported ratios: "1:1", "3:4", "4:3", "9:16", "16:9", "2:3", "3:2", "4:5", "5:4"

Default: Aspect ratio of the most specific image supplied

resolution'1k' | '2k' | '4k'

Output resolution tier. '1k' produces ~1 megapixel output, '2k' ~4 megapixels, and '4k' ~16 megapixels. Exact output dimensions depend on this tier and the image aspect ratio.

Default: '1k'

generation_mode'fast' | 'balanced' | 'quality'

Sets the generation quality level. 'quality' produces the most detailed and realistic output but takes longer to process and costs more credits. 'fast' prioritizes speed and lower cost. If omitted, FASHN selects generation_mode automatically. For product-to-model, omitted generation_mode is currently billed as 'fast' at 1k and as 'quality' at 2k or 4k.

background_referenceimage URL | base64

Background image used as the backdrop for generation. Ensures location consistency across generations. If a person appears in the image, they will be ignored and only the background will be used.

Default: None

seedinteger

Seed for reproducible results. Must be between 0 and 2^32-1.

Default: 42

num_imagesinteger

Number of images to generate in a single request. Must be between 1 and 4. Additional images consume more compute (and credits) and can increase processing time.

Default: 1

output_formatstring

Output image format.

  • "png" - PNG format, original quality
  • "jpeg" - JPEG format, smaller file size

Default: "png"

return_base64boolean

When set to true, the API will return the generated image as a base64-encoded string instead of a CDN URL. The base64 string will be prefixed data:image/png;base64,....

This option offers enhanced privacy as user-generated outputs are not stored on our servers when return_base64 is enabled.

Default: false

Credit Cost

generation_mode \ resolution1k2k4k
fast123
balanced234
quality345

Additional pricing rules:

  • face_reference adds +3 credits per output image.
  • num_images multiplies the total cost by the number of outputs requested.
  • If generation_mode is omitted, automatic pricing applies.

Processing Time

Processing time depends on both resolution and generation_mode. The fastest configuration (fast + 1k) typically completes in under 20 seconds, while the most intensive (quality + 4k) can take up to 120 seconds. Actual latency may vary with current server load.

Response Polling

After submitting your request, poll the status endpoint using the returned prediction ID. See API Fundamentals for complete polling details.

Successful Response

When your product-to-model generation completes successfully, the status endpoint will return:

{
  "id": "123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1",
  "status": "completed",
  "output": [
    "https://cdn.fashn.ai/123a87r9-4129-4bb3-be18-9c9fb5bd7fc1-u1/output_0.png"
  ],
  "error": null
}

Runtime Errors

Runtime errors for Product to Model use the shared set in Error Handling.

On this page