POST
/
v3
/
async
/
qwen-image-txt2img
Qwen-Image Text to Image
curl --request POST \
  --url https://api.novita.ai/v3/async/qwen-image-txt2img \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '{
  "prompt": "<string>",
  "size": "<string>"
}'
{
  "task_id": "<string>"
}
Qwen-Image — a 20B MMDiT model for next-gen text-to-image generation. Especially strong at creating stunning graphic posters with native text.
This is an asynchronous API; only the task_id will be returned. You should use the task_id to request the Task Result API to retrieve the image generation results.

Request Headers

Content-Type
string
required
Supports: application/json
Authorization
string
required
Bearer authentication format, for example: Bearer {{API Key}}.

Request Body

prompt
string
required
Text prompt for image generation.
size
string
The size of the generated media in pixels (width*height). Default is 1024*1024. Range: 256 ~ 1536 per dimension.

Response

task_id
string
required
Use the task_id to request the Task Result API to retrieve the generated outputs.

Example

Here is an example of how to use the Qwen-Image Text to Image API.
  1. Generate a task_id by sending a POST request to the Qwen-Image Text to Image API.
Request:
curl --location 'https://api.novita.ai/v3/async/qwen-image-txt2img' \
--header 'Authorization: Bearer {{API Key}}' \
--header 'Content-Type: application/json' \
--data '{
    "prompt": "A cinematic scene of a quiet girl with short brown hair sitting by a misty lake at dawn. She wears an oversized sweater, holding a warm mug. Soft morning light filters through the trees, cool tones, tranquil mood, light fog, 50mm photography style.",
    "size": "1024*1024"
}'
Response:
{
    "task_id": "{Returned Task ID}"
}
  1. Use task_id to get output images.
HTTP status codes in the 2xx range indicate that the request has been successfully accepted, while status codes in the 5xx range indicate internal server errors. You can get image url in images of response. Request:
curl --location --request GET 'https://api.novita.ai/v3/async/task-result?task_id={Returned Task ID}' \
--header 'Authorization: Bearer {{API Key}}'
Response:
{
    "extra": {
        "has_nsfw_contents": []
    },
    "task": {
        "task_id": "0cdee604-7168-4ff4-9b2a-9793c0cc6cdf",
        "task_type": "QWEN_IMAGE_TEXT_TO_IMAGE",
        "status": "TASK_STATUS_SUCCEED",
        "reason": "",
        "eta": 0,
        "progress_percent": 0
    },
    "images": [
        {
            "image_url": "https://d2p7pge43lyniu.cloudfront.net/output/9dc2f15a-0dd3-49a3-a121-a352f229c84b-u2_c61a700e-dfec-4c01-81c6-bf890ad68f6c.jpeg",
            "image_url_ttl": "0",
            "image_type": "jpeg",
            "nsfw_detection_result": null
        }
    ],
    "videos": [],
    "audios": []
}
Image files:
LLM API Providers