Skip to content
English

Qwen Image 2.0

POST /v1/tasks

All models are called through the Unified Async API POST /v1/tasks endpoint; only the input fields differ (see input parameters below).

Model summary

Model name qwen-image-2.0
Type Image generation
Endpoint POST /v1/tasks
Pricing See HiAPI Pricing

Qwen Image 2.0 is a low-cost image model with strong Chinese prompt and text-rendering behavior. The current docs show the tested native structure.

Production guidance

Production guidance
  • For production, pass callback.url at the top level of the request body so HiAPI can notify your service when the task reaches a terminal state.
  • GET /v1/tasks/:id is better for local debugging, low-volume jobs, or fallback reconciliation if a callback is missed.
  • Use callback.when=final. Both success and fail are terminal states, so your service should deduplicate by taskId.

Best suited for

Chinese text rendering

Use when the image needs Chinese headlines, signs, or poster text.

input.messages[].content[].text
Low-cost batches

Useful for content production, social images, and quick prototypes.

parameters.size
Negative constraints

Use negative_prompt to exclude unwanted elements.

parameters.negative_prompt
Prompt optimization

Enable prompt_extend when automatic prompt optimization is useful.

parameters.prompt_extend

Request parameters

model string required

Fixed value qwen-image-2.0.

example qwen-image-2.0
input object required

Business parameters. The tested structure is input.messages plus parameters.

input.messages[].role enum required

User message role. Fixed to user.

default user enum: user
input.messages[].content[].text string required

Positive prompt text.

parameters.size enum optional

Output image size. Use WIDTH*HEIGHT.

default 1328*1328 enum: 1664*9281472*11041328*13281104*1472928*1664
parameters.negative_prompt string optional

Negative prompt.

default
parameters.prompt_extend boolean optional

Whether to optimize the prompt.

default true
parameters.watermark boolean optional

Whether to add a watermark.

default false
parameters.seed integer optional

Random seed, range 0-2147483647.

callback object optional

Optional callback configuration. In production, pass callback.url so HiAPI can notify your service when the task reaches a terminal state.

url string required

HTTPS URL that receives terminal task notifications.

example https://your-domain.com/hiapi/callback
when enum optional

Callback trigger timing. Use final for terminal-state notifications.

default final enum: final

Example requests

Basic text-to-image

Current docs show the tested native input.messages structure.

Request body
{
  "model": "qwen-image-2.0",
  "input": {
    "input": {
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "text": "A small red apple on a white table, clean studio lighting"
            }
          ]
        }
      ]
    },
    "parameters": {
      "size": "1328*1328",
      "n": 1,
      "prompt_extend": false,
      "watermark": false
    }
  }
}
With negative prompt

Exclude unwanted visual elements.

Request body
{
  "model": "qwen-image-2.0",
  "input": {
    "input": {
      "messages": [
        {
          "role": "user",
          "content": [
            {
              "text": "A Chinese New Year poster with clear readable Chinese headline"
            }
          ]
        }
      ]
    },
    "parameters": {
      "size": "1328*1328",
      "n": 1,
      "negative_prompt": "blurry text, distorted characters",
      "prompt_extend": true,
      "watermark": false
    }
  }
}

Getting the result

  1. The response returns a taskId immediately without waiting for generation to finish.
  2. In production, prefer waiting for callback.url to receive the terminal notification. For local debugging, poll GET /v1/tasks/:id.
  3. When status=success, download the generated image from output[].url.
  4. When status=fail, fix the request based on the returned error instead of retrying the same invalid payload.

Next steps