fashn-logo
FASHNAI

Face to Model

The Face to Model endpoint transforms face images into try-on ready upper-body avatars. It converts cropped headshots or selfies into full upper-body representations that can be used in virtual try-on applications when full-body photos are not available, while preserving facial identity.

Model Specifications
  • Model Name: face-to-model
  • Lifecycle: experimental
  • 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

Request

Transform face images into professional model shots by submitting the face image 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": "face-to-model",
           "inputs": {
             "face_image": "http://example.com/path/to/headshot.jpg",
             "output_format": "jpeg"
           }
         }'

Response

Returns a prediction ID for status polling:

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

Request Parameters

face_image
Required
image URL | base64

URL or base64 encoded image of the face to transform into an upper-body avatar. The AI will analyze facial features, hair, and skin tone to create a representation suitable for virtual try-on applications.

promptstring

Optional styling or body shape guidance for the avatar representation. Examples: "athletic build", "curvy figure", "slender frame".

If you don't provide a prompt, the body shape will be inferred from the face image.

aspect_ratiostring

Desired aspect ratio for the output image. Only vertical ratios are supported. Images will always be extended downward to fit the aspect ratio.

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

Default: 2:3

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 face-to-model, omitted generation_mode is currently billed as 'fast' at 1k and as 'quality' at 2k or 4k.

seedinteger

Sets random operations to a fixed state. Use the same seed to reproduce results with the same inputs, or different seed to force different results.

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

Specifies the output image format.

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

Default: "jpeg"

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:

  • 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 face-to-model avatar creation completes successfully, the status endpoint will return:

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

The images array contains URLs to your upper-body avatars with preserved facial identity, ready for virtual try-on applications.

Runtime Errors

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

On this page