IPAdapter Style Transfer Serverless API
Style & Composition Transfer with Stable Diffusion IP Adapter
1import requests
2import json
3
4url = "https://api.segmind.com/v1/style-transfer"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "model": "fast",
12 "width": 1024,
13 "height": 1024,
14 "prompt": "A panda running on a jogging track",
15 "style_image": "https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp",
16 "output_format": "webp",
17 "output_quality": 80,
18 "number_of_images": 1,
19 "structure_depth_strength": 1,
20 "structure_denoising_strength": 0.65
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26 result = response.json()
27 print(json.dumps(result, indent=2))
28else:
29 print(f"Error: {response.status_code}")
30 print(response.text) 1import requests
2import json
3
4url = "https://api.segmind.com/v1/style-transfer"
5headers = {
6 "x-api-key": "YOUR_API_KEY",
7 "Content-Type": "application/json"
8}
9
10data = {
11 "model": "fast",
12 "width": 1024,
13 "height": 1024,
14 "prompt": "A panda running on a jogging track",
15 "style_image": "https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp",
16 "output_format": "webp",
17 "output_quality": 80,
18 "number_of_images": 1,
19 "structure_depth_strength": 1,
20 "structure_denoising_strength": 0.65
21}
22
23response = requests.post(url, headers=headers, json=data)
24
25if response.status_code == 200:
26 result = response.json()
27 print(json.dumps(result, indent=2))
28else:
29 print(f"Error: {response.status_code}")
30 print(response.text)API Endpoint
https://api.segmind.com/v1/style-transferParameters
style_imagerequiredstring (uri)Copy the style from this image
"https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp"heightoptionalintegerHeight of the output image (ignored if structure image given)
1024modeloptionalstringAn enumeration.
"fast""fast""high-quality""realistic""cinematic""animated"negative_promptoptionalstringThings you do not want to see in your image
""number_of_imagesoptionalintegerNumber of images to generate
1Range: 1 - 10output_formatoptionalstringAn enumeration.
"webp""webp""jpg""png"output_qualityoptionalintegerQuality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.
80Range: 0 - 100promptoptionalstringPrompt for the image
"A panda running on a jogging track"seedoptionalintegerSet a seed for reproducibility. Random by default.
nullstructure_denoising_strengthoptionalnumberHow much of the original image (and colors) to preserve (0 is all, 1 is none, 0.65 is a good balance)
0.65Range: 0 - 1structure_depth_strengthoptionalnumberStrength of the depth controlnet
1Range: 0 - 2structure_imageoptionalstring (uri)An optional image to copy structure from. Output images will use the same aspect ratio.
nullwidthoptionalintegerWidth of the output image (ignored if structure image given)
1024Response Type
Returns: Image
Common Error Codes
The API returns standard HTTP status codes. Detailed error messages are provided in the response body.
Bad Request
Invalid parameters or request format
Unauthorized
Missing or invalid API key
Forbidden
Insufficient permissions
Not Found
Model or endpoint not found
Insufficient Credits
Not enough credits to process request
Rate Limited
Too many requests
Server Error
Internal server error
Bad Gateway
Service temporarily unavailable
Timeout
Request timed out