IPAdapter Style Transfer Serverless API

Style & Composition Transfer with Stable Diffusion IP Adapter

~16.65s
~$0.026
 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

POSThttps://api.segmind.com/v1/style-transfer

Parameters

style_imagerequired
string (uri)

Copy the style from this image

Default: "https://segmind-inference-io.s3.amazonaws.com/sample_images/40548cb9-ae1f-4caa-969d-382c913a74ef.webp"
heightoptional
integer

Height of the output image (ignored if structure image given)

Default: 1024
modeloptional
string

An enumeration.

Default: "fast"
Allowed values :
"fast""high-quality""realistic""cinematic""animated"
negative_promptoptional
string

Things you do not want to see in your image

Default: ""
number_of_imagesoptional
integer

Number of images to generate

Default: 1Range: 1 - 10
output_formatoptional
string

An enumeration.

Default: "webp"
Allowed values :
"webp""jpg""png"
output_qualityoptional
integer

Quality of the output images, from 0 to 100. 100 is best quality, 0 is lowest quality.

Default: 80Range: 0 - 100
promptoptional
string

Prompt for the image

Default: "A panda running on a jogging track"
seedoptional
integer

Set a seed for reproducibility. Random by default.

Default: null
structure_denoising_strengthoptional
number

How much of the original image (and colors) to preserve (0 is all, 1 is none, 0.65 is a good balance)

Default: 0.65Range: 0 - 1
structure_depth_strengthoptional
number

Strength of the depth controlnet

Default: 1Range: 0 - 2
structure_imageoptional
string (uri)

An optional image to copy structure from. Output images will use the same aspect ratio.

Default: null
widthoptional
integer

Width of the output image (ignored if structure image given)

Default: 1024

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