Image edits
The step-1x-edit model is temporarily free to use.
Endpoint
POST https://api.stepfun.ai/v1/images/edits
Request parameters
-
modelstringrequired
Model name (currentlystep-1x-edit). -
imagefilerequired
Single image file. Resolution: min 64px, max 1728px, max area 1024x1024.
Formats: jpg, png, webp.
Max size: 10 MB. Aspect ratio between 1:3 and 3:1. -
promptstringrequired
Text description (max 512 characters). -
seedintoptional
Random seed (0 or omitted uses a random seed). -
stepsintoptional
Steps 1–100 (default 28). -
cfg_scalefloatoptional
Classifier-free guidance scale 1–10 (default 6). -
sizestringoptional
Approximate output size. Default512x512. Options: 512x512, 768x768, 1024x1024.
Logic:- If input image is 1:1, output follows
size. - If not 1:1, output keeps input aspect ratio with area ~
size*size.
- If input image is 1:1, output follows
-
response_formatstringoptional
Return format:b64_jsonorurl(defaulturl).
Response
createdint— Timestamp (seconds).dataobject array— Results:seedint— Seed used.finish_reasonstring—successorcontent_filtered.b64_jsonstring— Base64 image (whenresponse_format=b64_json).urlstring— Download link (whenresponse_format=url).
{
"created": 1589478378,
"data": [
{
"b64_json": "AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1",
"finish_reason": "success",
"seed": 123838
}
]
}Examples
import base64
from openai import OpenAI
client = OpenAI(api_key=STEP_API_KEY, base_url="https://api.stepfun.ai/v1")
prompt = "Turn the cat into a British Shorthair."
result = client.images.edit(
model="step-1x-edit",
image=open("cat.jpg", "rb"),
prompt=prompt,
response_format="b64_json",
extra_body={"cfg_scale": 10.0, "steps": 20, "seed": 1},
)
print(result)
image_base64 = result.data[0].b64_json
image_bytes = base64.b64decode(image_base64)
with open("cat-on-rooftop.png", "wb") as f:
f.write(image_bytes)
Last updated on