Generate images from a user-provided prompt.Documentation Index
Fetch the complete documentation index at: https://platform.stepfun.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Endpoint
POST https://api.stepfun.ai/v1/images/generations
Request parameters
-
modelstringrequired
The model name to use. Currently supported:step-image-edit-2
-
promptstringrequired
Text description of the image. Maximum length: 512 characters. -
sizestringoptional
The size of the generated image. Default1024x1024.step-image-edit-2(format isheight x width, notwidth x height):- Square: 1024x1024
- Rectangular: 768x1360, 896x1184, 1360x768, 1184x896
-
nintoptional
Number of images to generate. Currently only one image per request is supported. -
response_formatstringoptional
Format of the returned image. Supported:b64_jsonorurl. Defaulturl. -
seedintoptional
Random seed.step-image-edit-2: range[0, 2147483647]. If not provided, the server randomly generates a seed.
-
stepsintoptional
Number of generation steps.step-image-edit-2: range[1, 50]. Default 8.
-
cfg_scalefloatoptional
Classifier-free guidance scale.step-image-edit-2: must be >= 1.0, range[1.0, 10.0]. Default 1.0.
-
negative_promptstringoptional
Negative prompt. Up to 512 characters, default"". Whencfg_scale = 1.0, the current implementation does not pass the negative prompt to the underlying model. -
text_modebooloptional
Optimization strategy for text-rendering scenarios. DefaultFalse, enable as needed.
Response
createdint
Timestamp of when the image was created (seconds).dataobject array
Array of generated image objects.seedint
The seed used during generation. Same seeds produce similar images.finish_reasonstring
Reason for completion.successindicates successful generation;content_filteredindicates successful generation but stopped due to content filtering.b64_jsonstring
Base64-encoded image. Returned whenresponse_formatisb64_json.urlstring
Image download URL. Returned whenresponse_formatisurl. The URL has a limited validity period (currently 2 hours); download and save the image to your own storage to avoid relying on this link.
Example
- curl