IPAdapter Style Transfer Serverless API
Style & Composition Transfer with Stable Diffusion IP Adapter
POST /v2/style-transfer · submit + poll 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "style-transfer",
9 model="fast",
10 width=1024,
11 height=1024,
12 prompt="A panda running on a jogging track",
13 style_image="https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp",
14 output_format="webp",
15 output_quality=80,
16 number_of_images=1,
17 structure_depth_strength=1,
18 structure_denoising_strength=0.65,
19)
20print(result["status"]) # COMPLETED
21print(result.get("output")) # model output (e.g. media URL)
22print(result["metrics"]["inference_time"]) # server compute seconds
23
24# --- Or submit + poll manually (track request_id, control the cadence) ---
25from segmind import SegmindClient, InferenceFailed, InferenceTimeout
26
27client = SegmindClient() # reads SEGMIND_API_KEY
28payload = {
29 "model": "fast",
30 "width": 1024,
31 "height": 1024,
32 "prompt": "A panda running on a jogging track",
33 "style_image": "https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp",
34 "output_format": "webp",
35 "output_quality": 80,
36 "number_of_images": 1,
37 "structure_depth_strength": 1,
38 "structure_denoising_strength": 0.65,
39}
40job = client.submit_async("style-transfer", **payload)
41print(job.request_id) # available immediately
42try:
43 result = job.wait(timeout=600, interval=1.0)
44except InferenceTimeout as e:
45 print("still running:", e.request_id)
46except InferenceFailed as e:
47 print("failed:", e.detail) 1# pip install "segmind>=1.1.0"
2# export SEGMIND_API_KEY="YOUR_API_KEY"
3import segmind
4
5# Async (v2): submit to the queue and block until COMPLETED.
6# run() returns the final result dict (600s deadline, 1.0s poll by default).
7result = segmind.run(
8 "style-transfer",
9 model="fast",
10 width=1024,
11 height=1024,
12 prompt="A panda running on a jogging track",
13 style_image="https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp",
14 output_format="webp",
15 output_quality=80,
16 number_of_images=1,
17 structure_depth_strength=1,
18 structure_denoising_strength=0.65,
19)
20print(result["status"]) # COMPLETED
21print(result.get("output")) # model output (e.g. media URL)
22print(result["metrics"]["inference_time"]) # server compute seconds
23
24# --- Or submit + poll manually (track request_id, control the cadence) ---
25from segmind import SegmindClient, InferenceFailed, InferenceTimeout
26
27client = SegmindClient() # reads SEGMIND_API_KEY
28payload = {
29 "model": "fast",
30 "width": 1024,
31 "height": 1024,
32 "prompt": "A panda running on a jogging track",
33 "style_image": "https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp",
34 "output_format": "webp",
35 "output_quality": 80,
36 "number_of_images": 1,
37 "structure_depth_strength": 1,
38 "structure_denoising_strength": 0.65,
39}
40job = client.submit_async("style-transfer", **payload)
41print(job.request_id) # available immediately
42try:
43 result = job.wait(timeout=600, interval=1.0)
44except InferenceTimeout as e:
45 print("still running:", e.request_id)
46except InferenceFailed as e:
47 print("failed:", e.detail)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
Asynchronous requests (v2)
Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.
- 1
POST /v2/style-transferSubmit — returns request_id, status_url, response_url
- 2
GET /v2/requests/{id}/statusPoll — until COMPLETED or FAILED
- 3
GET /v2/requests/{id}Result — final response body
Status states
- A FAILED request is served as HTTP 422 — the body still carries the error detail.
- An unknown or expired request_id returns HTTP 404.
- Results are retained for 1 hour, then expire.
- Content / RAI blocks surface as FAILED, not a separate state.
- Track completion by polling the status endpoint.
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