{
  "openapi": "3.1.0",
  "info": {
    "title": "SiliconFlow Image Generation API",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.siliconflow.cn/v1"
    }
  ],
  "paths": {
    "/images/generations": {
      "post": {
        "summary": "Generates an image based on a given prompt.",
        "operationId": "generateImage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["model", "prompt", "image_size", "batch_size", "num_inference_steps", "guidance_scale"],
                "properties": {
                  "model": {
                    "type": "string",
                    "enum": ["Kwai-Kolors/Kolors"],
                    "description": "The name of the model to be used."
                  },
                  "prompt": {
                    "type": "string",
                    "description": "A text description of the desired image."
                  },
                  "negative_prompt": {
                    "type": "string",
                    "description": "A description of elements you do not want in the generated image."
                  },
                  "image_size": {
                    "type": "string",
                    "enum": ["1024x1024", "960x1280", "768x1024", "720x1440", "720x1280", "others"],
                    "description": "The size of the generated image."
                  },
                  "batch_size": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 4,
                    "description": "The number of images to generate."
                  },
                  "num_inference_steps": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "description": "The number of inference steps."
                  },
                  "guidance_scale": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 20,
                    "description": "A value that controls how closely the generated image aligns with the prompt."
                  },
                  "seed": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9999999999,
                    "description": "The random seed used for image generation."
                  },
                  "image": {
                    "type": "string",
                    "description": "An image to be uploaded, encoded in base64 format."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image successfully generated.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "images": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "url": {
                            "type": "string",
                            "description": "The URL of the generated image, valid for one hour."
                          }
                        }
                      }
                    },
                    "timings": {
                      "type": "object",
                      "properties": {
                        "inference": {
                          "type": "number",
                          "description": "The time taken for inference."
                        }
                      }
                    },
                    "seed": {
                      "type": "integer",
                      "description": "The random seed used for image generation."
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request."
          },
          "401": {
            "description": "Unauthorized."
          },
          "404": {
            "description": "Not found."
          },
          "429": {
            "description": "Too many requests."
          },
          "503": {
            "description": "Service unavailable."
          },
          "504": {
            "description": "Gateway timeout."
          }
        },
        "security": [
          {
            "Authorization": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "Authorization": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key"
      }
    }
  }
}
