# Qwen Image Image Generation

> Image Generation

Generate an image from a text prompt using the `Qwen/Qwen-Image`
model. The documented response returns generated image data as a URL,
Base64 data, or both.

## Endpoint

`POST https://api.modelverse.cn/v1/images/generations`

## Request Body

## Responses

- **200** — Image generation response.
- **400** — 
- **default** — 

## OpenAPI Definition

```json
{
  "openapi": "3.1.0",
  "x-language": "en-US",
  "info": {
    "title": "ModelVerse Qwen/Qwen-Image Image API",
    "version": "1.0.0",
    "description": "Self-contained OpenAPI 3.1 schema for the ModelVerse OpenAI-compatible\n`Qwen/Qwen-Image` image generation API.\n"
  },
  "servers": [
    {
      "url": "https://api.modelverse.cn",
      "description": "ModelVerse API endpoint documented for this model."
    }
  ],
  "tags": [
    {
      "name": "Qwen/Qwen-Image",
      "description": "OpenAI-compatible image generation with Qwen/Qwen-Image."
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "paths": {
    "/v1/images/generations": {
      "post": {
        "tags": [
          "Qwen/Qwen-Image"
        ],
        "operationId": "createQwenQwenImageGeneration",
        "summary": "Qwen Image Image Generation",
        "description": "Generate an image from a text prompt using the `Qwen/Qwen-Image`\nmodel. The documented response returns generated image data as a URL,\nBase64 data, or both.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QwenQwenImageGenerationRequest"
              },
              "examples": {
                "quickPencilSketch": {
                  "summary": "Source document image generation request",
                  "value": {
                    "model": "Qwen/Qwen-Image",
                    "prompt": "Convert to quick pencil sketch",
                    "size": "1664x928"
                  }
                },
                "deterministicSquare": {
                  "summary": "Request with a deterministic seed and documented default-size family",
                  "value": {
                    "model": "Qwen/Qwen-Image",
                    "prompt": "A quiet bookstore storefront at night, watercolor style",
                    "seed": 12345,
                    "size": "1328x1328"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Image generation response.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QwenQwenImageGenerationResponse"
                },
                "examples": {
                  "documentedResponse": {
                    "summary": "Source document response with URL and Base64 data",
                    "value": {
                      "created": 1750667997,
                      "data": [
                        {
                          "url": "https://xxxxx/xxxx.png",
                          "b64_json": "data:image/png;base64,{image_base64_string}"
                        }
                      ],
                      "usage": {
                        "input_tokens_details": {}
                      }
                    }
                  },
                  "urlOnly": {
                    "summary": "Generated image returned as a URL",
                    "value": {
                      "created": 1750667997,
                      "data": [
                        {
                          "url": "https://xxxxx/xxxx.png"
                        }
                      ],
                      "usage": {
                        "input_tokens_details": {}
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/QwenQwenImageBadRequest"
          },
          "default": {
            "$ref": "#/components/responses/QwenQwenImageError"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API key",
        "description": "ModelVerse API key sent as `Authorization: Bearer <MODELVERSE_API_KEY>`."
      }
    },
    "responses": {
      "QwenQwenImageBadRequest": {
        "description": "Invalid request parameters or image generation error.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/QwenQwenImageErrorResponse"
            },
            "examples": {
              "documentedError": {
                "$ref": "#/components/examples/QwenQwenImageError"
              }
            }
          }
        }
      },
      "QwenQwenImageError": {
        "description": "Error response.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/QwenQwenImageErrorResponse"
            },
            "examples": {
              "documentedError": {
                "$ref": "#/components/examples/QwenQwenImageError"
              }
            }
          }
        }
      }
    },
    "schemas": {
      "QwenQwenImageModel": {
        "type": "string",
        "const": "Qwen/Qwen-Image",
        "description": "Model name. This API is pinned to `Qwen/Qwen-Image`."
      },
      "QwenQwenImagePrompt": {
        "type": "string",
        "description": "Prompt describing the image to generate."
      },
      "QwenQwenImageSeed": {
        "type": "integer",
        "default": -1,
        "description": "Random seed used to control generation randomness. Use the same seed\nvalue when you want generation to remain consistent.\n"
      },
      "QwenQwenImageSize": {
        "type": "string",
        "default": "1664x928",
        "description": "Generated image size in `WIDTHxHEIGHT` form. The source parameter table\nlists `1664x928` (16:9), `1472x1104` (4:3), `1328x1328` (1:1),\n`1104x1472` (3:4), and `928x1664` (9:16).\n",
        "enum": [
          "1664x928",
          "1472x1104",
          "1328x1328",
          "1104x1472",
          "928x1664"
        ]
      },
      "QwenQwenImageGenerationRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "prompt",
          "model"
        ],
        "properties": {
          "prompt": {
            "$ref": "#/components/schemas/QwenQwenImagePrompt"
          },
          "model": {
            "$ref": "#/components/schemas/QwenQwenImageModel"
          },
          "seed": {
            "$ref": "#/components/schemas/QwenQwenImageSeed"
          },
          "size": {
            "$ref": "#/components/schemas/QwenQwenImageSize"
          }
        }
      },
      "QwenQwenImageGenerationResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "created",
          "data"
        ],
        "properties": {
          "created": {
            "type": "integer",
            "format": "int64",
            "description": "Unix timestamp, in seconds, for when this request was created."
          },
          "data": {
            "type": "array",
            "description": "Generated image output information.",
            "items": {
              "$ref": "#/components/schemas/QwenQwenImageData"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/QwenQwenImageUsage"
          }
        }
      },
      "QwenQwenImageData": {
        "type": "object",
        "additionalProperties": false,
        "description": "Generated image data. The source document states that URL responses use\n`url`, while Base64 responses use `b64_json`; the source example shows\nboth fields present in one item.\n",
        "anyOf": [
          {
            "required": [
              "url"
            ]
          },
          {
            "required": [
              "b64_json"
            ]
          }
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Download URL for the generated image. The source document notes that\nlinks expire within 7 days after generation.\n"
          },
          "b64_json": {
            "type": "string",
            "description": "Base64-encoded generated image data."
          }
        }
      },
      "QwenQwenImageUsage": {
        "type": "object",
        "additionalProperties": false,
        "description": "Usage object shown in the source response example.",
        "properties": {
          "input_tokens_details": {
            "type": "object",
            "additionalProperties": true,
            "description": "Input token detail object shown in the source response example."
          }
        }
      },
      "QwenQwenImageErrorResponse": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "$ref": "#/components/schemas/QwenQwenImageErrorObject"
          }
        }
      },
      "QwenQwenImageErrorObject": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "message",
          "type",
          "param",
          "code"
        ],
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message."
          },
          "type": {
            "type": "string",
            "description": "Error type."
          },
          "param": {
            "type": "string",
            "description": "Request identifier, documented as `request_id`."
          },
          "code": {
            "type": "string",
            "description": "Error code."
          }
        }
      }
    },
    "examples": {
      "QwenQwenImageError": {
        "summary": "Source document error response",
        "value": {
          "error": {
            "message": "error_message",
            "type": "error_type",
            "param": "request_id",
            "code": "error_code"
          }
        }
      }
    }
  }
}
```
