Qwen2 - Text To Image
Endpoint
POST /images/generations
Full URL: https://modelfold.ai/v1/images/generations
Authentication: every request must include the
Authorization: Bearer <API_KEY>header.
Send model parameters directly in the JSON body. Do not wrap them in input. This request waits for generation to finish and returns data[].url; supported media models also offer async jobs, polling and callbacks. Replace example media URLs with your own publicly accessible files. See API gateway for billing and errors.
Input parameters for the generation task
Request Parameters
Body (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model name to use for generation. Required field. - Must be qwen2/text-to-image for this endpoint. Default:"qwen2/text-to-image"。 Allowed values:qwen2/text-to-image。 Example:qwen2/text-to-image。 |
prompt | string | Yes | Prompt required by the ModelFold gateway; at most 2000 characters. The prompt to generate the image with. Max length: 5000 characters. maxLength: 2000. Example:A rainy nighttime city poster illuminated by neon lights.。 |
image_size | string | No | The size of the generated image. Default value: 16:9 Default:"16:9"。 Allowed values:1:1 / 3:4 / 4:3 / 9:16 / 16:9。 Example:16:9。 |
seed | integer | No | The same seed and the same prompt given to the same version of the model will output the same image every time. |
output_format | string | No | Output format: png or jpeg. Set this field explicitly. Allowed values:jpeg / png。 Example:png。 |
nsfw_checker | boolean | No | Defaults to false. When false, no additional content filtering is applied and results are returned directly by the model. |
Request Example
bash
curl -X POST "https://modelfold.ai/v1/images/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "qwen2/text-to-image",
"prompt": "A rainy nighttime city poster illuminated by neon lights.",
"image_size": "16:9"
}'json
{
"model": "qwen2/text-to-image",
"prompt": "A rainy nighttime city poster illuminated by neon lights.",
"image_size": "16:9"
}Response
200 — Generation completed. usage contains actual billing details; result URLs are illustrative.
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.png"
}
],
"usage": {}
}