material-transfer Serverless API

Transfer a material from an image to a subject

~164.03s
POST /v2/material-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    "material-transfer",
 9    steps=6,
10    prompt="marble sculpture",
11    max_width=1920,
12    max_height=1920,
13    output_format="webp",
14    subject_image="https://segmind-sd-models.s3.amazonaws.com/display_images/bird.png",
15    guidance_scale=2,
16    material_image="https://segmind-sd-models.s3.amazonaws.com/display_images/ruby.png",
17    output_quality=80,
18    material_strength="medium",
19    return_intermediate_images=False,
20)
21print(result["status"])                      # COMPLETED
22print(result.get("output"))                  # model output (e.g. media URL)
23print(result["metrics"]["inference_time"])   # server compute seconds
24
25# --- Or submit + poll manually (track request_id, control the cadence) ---
26from segmind import SegmindClient, InferenceFailed, InferenceTimeout
27
28client = SegmindClient()                      # reads SEGMIND_API_KEY
29payload = {
30    "steps": 6,
31    "prompt": "marble sculpture",
32    "max_width": 1920,
33    "max_height": 1920,
34    "output_format": "webp",
35    "subject_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/bird.png",
36    "guidance_scale": 2,
37    "material_image": "https://segmind-sd-models.s3.amazonaws.com/display_images/ruby.png",
38    "output_quality": 80,
39    "material_strength": "medium",
40    "return_intermediate_images": False,
41}
42job = client.submit_async("material-transfer", **payload)
43print(job.request_id)                         # available immediately
44try:
45    result = job.wait(timeout=600, interval=1.0)
46except InferenceTimeout as e:
47    print("still running:", e.request_id)
48except InferenceFailed as e:
49    print("failed:", e.detail)

API Endpoint

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

Parameters

material_imagerequired
string (uri)

Material to transfer to the input image

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/ruby.png"
subject_imagerequired
string (uri)

Subject image to transfer the material to

Default: "https://segmind-sd-models.s3.amazonaws.com/display_images/bird.png"
guidance_scaleoptional
number

Guidance scale for the diffusion process

Default: 2Range: 1 - 10
material_strengthoptional
string

An enumeration.

Default: "medium"
Allowed values :
"medium""strong"
max_heightoptional
integer

Max height of the output image

Default: 1920
max_widthoptional
integer

Max width of the output image

Default: 1920
negative_promptoptional
string

What you do not want to see in the image

Default: ""
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

Use a prompt that describe the image when the material is applied

Default: "marble sculpture"
return_intermediate_imagesoptional
boolean

Return intermediate images like mask, and annotated images. Useful for debugging.

Default: false
seedoptional
integer

Set a seed for reproducibility. Random by default.

Default: null
stepsoptional
integer

Number of steps. 6 steps gives good results, but try increasing to 15 or 20 if you need more detail

Default: 6

Response 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. 1
    POST /v2/material-transfer

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • 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.

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