Qwen Image Generation

OpenAI compatible: POST /v1/images/generations. Native path: /api/v1/services/aigc/multimodal-generation/generation. Image Generation API

Refer to the platform's "Open Models List" for exact model IDs. On the OpenAI-compatible path, use prompt + image / image_urls; messages, style, and quality are not supported.


1. OpenAI-Compatible Integration (POST)

  • Path: https://www.tokenpad.ai/v1/images/generations
  • Auth: Authorization: Bearer sk-your_token

A. Text-to-Image

curl -X POST https://www.tokenpad.ai/v1/images/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image-3.0-pro",
    "prompt": "Cyberpunk city nightscape, neon reflections, ultra-clear photorealism, cinematic composition",
    "size": "1024*1024",
    "n": 1,
    "response_format": "url"
  }'

B. Single Image Reference / Image-to-Image

curl -X POST https://www.tokenpad.ai/v1/images/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image-3.0-pro",
    "prompt": "The character from the reference image standing by a library window looking out into the distance, cinematic natural lighting",
    "image": "https://example.com/assets/character_face.jpg",
    "size": "1024*1024",
    "n": 1
  }'

C. Multi-Image Reference Generation

curl -X POST https://www.tokenpad.ai/v1/images/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image-3.0-pro",
    "prompt": "Use the character appearance from image 1 and scene atmosphere from image 2, unified illustration style, warm natural light",
    "image_urls": [
      "https://example.com/character.png",
      "https://example.com/scene.png"
    ],
    "size": "1280*720",
    "n": 2
  }'

D. Negative Prompt

curl -X POST https://www.tokenpad.ai/v1/images/generations \
  -H "Authorization: Bearer sk-your_token_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-image-3.0-pro",
    "prompt": "Cyberpunk city nightscape, neon reflections, ultra-clear photorealism",
    "negative_prompt": "blurry, low quality, deformed, watermark",
    "size": "1024*1024",
    "n": 1
  }'

2. OpenAI-Compatible Parameter Dictionary

ParamTypeRequiredDescription
modelstringYese.g., qwen-image-3.0-pro
promptstringYesVisual description
negative_promptstringNoNegative prompt
imagestring / arrayNoReference image URL; single string or URL array
image_urlsarrayNoMulti-image reference URL array (equivalent to image array; use either)
sizestringNoe.g., 1024*1024, 1280*720; 1024x1024 is automatically converted to *
nintegerNoNumber of images to generate, default 1
response_formatstringNo"url" or "b64_json"

3. Alibaba Bailian Native Routes (Brief)

CapabilityPath
Image submitPOST /api/v1/services/aigc/multimodal-generation/generation
Async queryGET /api/v1/tasks/{task_id}

Payloads already containing the official input / parameters structure are passed through verbatim; async tasks require header X-DashScope-Async: enable.


4. Response Example (200 OK)

{
  "created": 1719441600,
  "data": [
    { "url": "https://example.com/output/qwen_img_1.png" },
    { "url": "https://example.com/output/qwen_img_2.png" }
  ]
}

5. Common Error Codes & Troubleshooting

HTTP codes, error body format, and troubleshooting are maintained in one dedicated page (not duplicated under each example).

👉 Gateway Error Codes & Troubleshooting

Quick reference:

CodeMeaning
400Invalid parameters / content moderation or copyright block
402Insufficient account balance (not 429)
429RPS/RPM limits or in-flight task cap (low balance)
403Token / IP / model permission (balance → 402; content filter → 400)
200 + status: failedAsync video/long-task business failure on poll

HTTP status matches call log status_code for traceability by log_id.

Maintenance: update the error-codes article only; this appendix links to it.

Raw Markdown (.md) · llms.txt