Segmind SegFit v1.2 Serverless API

SegFit v1.2 creates hyper-realistic virtual try-on images, transforming fashion retail engagement and conversion rates.

~51.81s
~$0.092
 1import requests
 2import json
 3
 4url = "https://api.segmind.com/v1/segfit-v1.2"
 5headers = {
 6    "x-api-key": "YOUR_API_KEY",
 7    "Content-Type": "application/json"
 8}
 9
10data = {
11    "outfit_image": "https://segmind-resources.s3.amazonaws.com/others/c63e9544-10da-45cd-81f9-725fb98ca0c0-090a11c5-4e9a-42f2-8cf7-d74de7e1ebcf.png",
12    "model_image": "https://segmind-resources.s3.amazonaws.com/others/be81a5a2-a928-47d2-927e-cdc4cf25cb96-model_1.png",
13    "model_type": "Balanced",
14    "cn_strength": 0.35,
15    "cn_end": 0.35,
16    "image_format": "png",
17    "image_quality": 90,
18    "seed": 42,
19    "base64": false
20}
21
22response = requests.post(url, headers=headers, json=data)
23
24if response.status_code == 200:
25    result = response.json()
26    print(json.dumps(result, indent=2))
27else:
28    print(f"Error: {response.status_code}")
29    print(response.text)

API Endpoint

POSThttps://api.segmind.com/v1/segfit-v1.2

Parameters

model_imagerequired
string (uri)

Image of the model for try-on. Example: front-facing, well-lit image.

outfit_imagerequired
string (uri)

Image of the outfit to be fitted. Example: a dress or suit.

base64optional
boolean

Return image as base64 string instead of URL.

Default: false
cn_endoptional
number

Endpoint for ControlNet's effect. Controls the model body shape, Higher the value, higher the control

Default: 0.35Range: 0 - 1
cn_strengthoptional
number

Strength of ControlNet's influence. Maintains the shape of the model.

Default: 0.35Range: 0 - 1
image_formatoptional
string

Output image format. 'PNG' is versatile, 'JPEG' compresses well.

Default: "png"
Allowed values :
"png""jpeg""webp"
image_qualityoptional
integer

Determine image quality (1-100). Use 100 for best detail, lower for smaller file size.

Default: 90Range: 1 - 100
model_typeoptional
string

Choose the generation model type. Use 'Speed' for fast results, 'Quality' for high detail.

Default: "balanced"
Allowed values :
"Speed""Balanced""Quality"
seedoptional
integer

Ensures reproducibility. Set to -1 for random variation.

Default: 42Range: -1 - 999999

Response Type

Returns: Image

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out