Qwen Image 3.0 Serverless API

Generate and edit legible in-image text, up to 2K.

POST /v2/qwen-image-3 · submit + poll
 1# pip install "segmind>=1.1.0"
 2# export SEGMIND_API_KEY="YOUR_API_KEY"
 3import segmind
 4
 5# Async (v2): submit to the queue and block until COMPLETED.
 6# run() returns the final result dict (600s deadline, 1.0s poll by default).
 7result = segmind.run(
 8    "qwen-image-3",
 9    prompt="A cozy independent bookstore cafe on a rainy autumn evening, warm golden light glowing through the large front windows onto a wet cobblestone street, a hand-painted wooden sign above the entrance that reads \"Qwen Books & Coffee\", reflections shimmering in the puddles, a person under a red umbrella walking past, cinematic photorealistic detail, shallow depth of field, 35mm",
10    size="1328*1328",
11    negative_prompt="blurry, watermark, low quality, distorted text, deformed, extra limbs, jpeg artifacts",
12    prompt_extend=True,
13    prompt_extend_mode="direct",
14    seed=12345,
15    watermark=False,
16)
17print(result["status"])                      # COMPLETED
18print(result.get("output"))                  # model output (e.g. media URL)
19print(result["metrics"]["inference_time"])   # server compute seconds
20
21# --- Or submit + poll manually (track request_id, control the cadence) ---
22from segmind import SegmindClient, InferenceFailed, InferenceTimeout
23
24client = SegmindClient()                      # reads SEGMIND_API_KEY
25payload = {
26    "prompt": "A cozy independent bookstore cafe on a rainy autumn evening, warm golden light glowing through the large front windows onto a wet cobblestone street, a hand-painted wooden sign above the entrance that reads \"Qwen Books & Coffee\", reflections shimmering in the puddles, a person under a red umbrella walking past, cinematic photorealistic detail, shallow depth of field, 35mm",
27    "size": "1328*1328",
28    "negative_prompt": "blurry, watermark, low quality, distorted text, deformed, extra limbs, jpeg artifacts",
29    "prompt_extend": True,
30    "prompt_extend_mode": "direct",
31    "seed": 12345,
32    "watermark": False,
33}
34job = client.submit_async("qwen-image-3", **payload)
35print(job.request_id)                         # available immediately
36try:
37    result = job.wait(timeout=600, interval=1.0)
38except InferenceTimeout as e:
39    print("still running:", e.request_id)
40except InferenceFailed as e:
41    print("failed:", e.detail)

API Endpoint

POSThttps://api.segmind.com/v1/qwen-image-3

Parameters

promptrequired
string

Describe the image to generate, or the edit to apply to the reference image(s).

imageoptional
string (uri)

Optional. Supply an image to edit it instead of generating from scratch.

image2optional
string (uri)

Optional second reference image.

image3optional
string (uri)

Optional third reference image. Up to 3 references are supported.

negative_promptoptional
string

Elements to exclude from the image.

prompt_extendoptional
boolean

Let the model automatically rewrite and enrich short prompts.

Default: true
prompt_extend_modeoptional
string

How the prompt is rewritten when Prompt Extend is on.

Default: "direct"
Allowed values :
Direct - light touch-up"direct"
Agent - fuller rewrite"agent"
seedoptional
integer

Seed for reproducible results.

Range: 0 - 2147483647
sizeoptional
string

Output resolution. Editing supports up to 1440 x 1440; 2048 x 2048 is text-to-image only.

Default: "1024*1024"
Allowed values :
1024 x 1024 (square)"1024*1024"
1328 x 1328 (square, large)"1328*1328"
768 x 1024 (portrait 3:4)"768*1024"
1024 x 768 (landscape 4:3)"1024*768"
1080 x 1440 (portrait 3:4, large)"1080*1440"
1440 x 1080 (landscape 4:3, large)"1440*1080"
2048 x 2048 (text-to-image only)"2048*2048"
watermarkoptional
boolean

Add the Qwen watermark to the output.

Default: false

Response Type

Returns: Text/JSON

Asynchronous requests (v2)

Use Async for video, long-running (>~60s), or high-concurrency workloads; Sync is simplest for fast image & LLM calls. Async submits a request and you poll it to completion.

  1. 1
    POST /v2/qwen-image-3

    Submitreturns request_id, status_url, response_url

  2. 2
    GET /v2/requests/{id}/status

    Polluntil COMPLETED or FAILED

  3. 3
    GET /v2/requests/{id}

    Resultfinal response body

Status states

QUEUEDAccepted, waiting for a worker
PROCESSINGRunning on a worker
COMPLETEDDone — result body is ready
FAILEDErrored (incl. content/RAI blocks)
  • A FAILED request is served as HTTP 422 — the body still carries the error detail.
  • An unknown or expired request_id returns HTTP 404.
  • Results are retained for 1 hour, then expire.
  • Content / RAI blocks surface as FAILED, not a separate state.
  • Track completion by polling the status endpoint.

Common Error Codes

The API returns standard HTTP status codes. Detailed error messages are provided in the response body.

400

Bad Request

Invalid parameters or request format

401

Unauthorized

Missing or invalid API key

403

Forbidden

Insufficient permissions

404

Not Found

Model or endpoint not found

406

Insufficient Credits

Not enough credits to process request

429

Rate Limited

Too many requests

500

Server Error

Internal server error

502

Bad Gateway

Service temporarily unavailable

504

Timeout

Request timed out