POST
/
images
/
generations
Image Generation
curl --request POST \
  --url https://api.siliconflow.com/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "Qwen/Qwen-Image",
  "prompt": "an island near sea, with seagulls, moon shining over the sea, light house, boats int he background, fish flying over the sea",
  "image_size": "<string>",
  "num_inference_steps": 20,
  "image": "data:image/png;base64, XXX"
}'
{
  "images": [
    {
      "url": "<string>"
    }
  ],
  "timings": {
    "inference": 123
  },
  "seed": 123
}

Authorizations

Authorization
string
header
required

Use the following format for authentication: Bearer <your api key>

Body

application/json
model
enum<string>
required

Corresponding Model Name. To better enhance service quality, we will make periodic changes to the models provided by this service, including but not limited to model on/offlining and adjustments to model service capabilities. We will notify you of such changes through appropriate means such as announcements or message pushes where feasible.

Available options:
Qwen/Qwen-Image,
Qwen/Qwen-Image-Edit
prompt
string
required
Example:

"an island near sea, with seagulls, moon shining over the sea, light house, boats int he background, fish flying over the sea"

negative_prompt
string

negative prompt

image_size
string

Image resolution in "widthxheight" format (Required). To ensure optimal quality, using the recommended values for your model is strongly advised. Recommended Values:
- "1328x1328" (1:1) - "1664x928" (16:9) - "928x1664" (9:16) - "1472x1140" (4:3) - "1140x1472" (3:4) - "1584x1056" (3:2) - "1056x1584" (2:3)

batch_size
integer
default:1

number of output images

Required range: 1 <= x <= 4
seed
integer
Required range: 0 <= x <= 9999999999
num_inference_steps
integer
default:20

number of inference steps

Required range: 1 <= x <= 100
guidance_scale
number
default:7.5

This value is used to control the degree of match between the generated image and the given prompt. The higher the value, the more the generated image will tend to strictly match the text prompt. The lower the value, the more creative and diverse the generated image will be, potentially containing more unexpected elements.

Required range: 0 <= x <= 20
cfg
number

CFG (Classifier-Free Guidance) is a technique that adjusts how closely generated outputs follow input prompts by balancing precision and creativity. This field is only applicable to Qwen/Qwen-Image models.For text generation scenarios, the CFG value must be greater than 1. The official configuration uses 50 steps with CFG 4.0. When CFG is set too small, it becomes nearly impossible to generate text.

Required range: 0.1 <= x <= 20
image
string

The image that needs to be uploaded should be converted into base64 format like "data:image/png;base64, XXX"

Example:

"data:image/png;base64, XXX"

Response

200

images
object[]
timings
object
seed
integer