Skip to content

qwen-image-2.0 ​

Request parameters and examples for qwen-image-2.0.

POST /v1/images/generations · POST /v1/async/images/generations

POST /v1/images/edits · POST /v1/async/images/edits

Send JSON with Authorization: Bearer <PIXAPI_KEY> and Content-Type: application/json.

Request fields ​

Send the common fields at the top level. Put the model-specific controls listed below inside providerOptions.

FieldTypeRequiredDescription
modelstringYesqwen-image-2.0. Case-sensitive model ID.
promptstringYesDescribe the subject, composition, style, and requested edits. Pixapi keeps the first 2,000 characters; provide a non-empty prompt for both generation and editing.
nintegerNoInteger 1–6, default 1.
sizestringNoUse pixel dimensions WIDTHxHEIGHT, for example 1024x1024. Pixel area 512×512–2048×2048. Generation defaults to 2048x2048; editing follows the reference ratio. No auto.
imagestring / string[]For editsPublic HTTP(S) image URL or URL array; required on /images/edits. 1–3 images, ≤ 10 MB each; recommended 384–2048 pixels per edge. JPEG/PNG/BMP/TIFF/WebP/GIF. Also accepts complete data:image/...;base64,... URLs (≤10 MB per image, ≤20 MB total); raw Base64 and files are not accepted.
providerOptionsobjectNoModel-specific options; see the table below.

providerOptions ​

All fields in this table are nested inside providerOptions, not alongside model.

FieldTypeDescription
seedintegerRandom seed, 0–2147483647; omitted means random. The same seed does not guarantee identical output.
prompt_extendbooleanRewrite and expand the prompt for generation; default true.
negative_promptstringContent to exclude; at most 500 characters.
watermarkbooleanAdd a visible AI watermark. Default false.

Input rules ​

Use JSON requests. Do not send quality, resolution, mask, or output_format for these Bailian models. Z-Image supports text-to-image only.

Example ​

bash
curl https://api.pixapi.ai/v1/images/generations \
  -H "Authorization: Bearer $PIXAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "qwen-image-2.0",
  "prompt": "A poster for a coffee shop with the title Good Morning",
  "n": 1,
  "size": "1024x1024",
  "providerOptions": {
    "prompt_extend": true
  }
}'
py
import os
import requests

response = requests.post(
    "https://api.pixapi.ai/v1/images/generations",
    headers={"Authorization": f"Bearer {os.environ['PIXAPI_KEY']}"},
    json={
  "model": "qwen-image-2.0",
  "prompt": "A poster for a coffee shop with the title Good Morning",
  "n": 1,
  "size": "1024x1024",
  "providerOptions": {
    "prompt_extend": True
  }
},
)
response.raise_for_status()
print(response.json())
js
const response = await fetch('https://api.pixapi.ai/v1/images/generations', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "model": "qwen-image-2.0",
  "prompt": "A poster for a coffee shop with the title Good Morning",
  "n": 1,
  "size": "1024x1024",
  "providerOptions": {
    "prompt_extend": true
  }
}),
});
if (!response.ok) throw new Error(await response.text());
console.log(await response.json());
go
package main

import (
  "bytes"
  "fmt"
  "io"
  "net/http"
  "os"
)

func main() {
  body := []byte(`{
  "model": "qwen-image-2.0",
  "prompt": "A poster for a coffee shop with the title Good Morning",
  "n": 1,
  "size": "1024x1024",
  "providerOptions": {
    "prompt_extend": true
  }
}`)
  req, err := http.NewRequest("POST", "https://api.pixapi.ai/v1/images/generations", bytes.NewBuffer(body))
  if err != nil { panic(err) }
  req.Header.Set("Authorization", "Bearer " + os.Getenv("PIXAPI_KEY"))
  req.Header.Set("Content-Type", "application/json")
  resp, err := http.DefaultClient.Do(req)
  if err != nil { panic(err) }
  defer resp.Body.Close()
  result, err := io.ReadAll(resp.Body)
  if err != nil { panic(err) }
  if resp.StatusCode >= 400 { panic(string(result)) }
  fmt.Println(string(result))
}

For asynchronous requests, save the returned id and poll GET /v1/tasks/{id} until completed or failed. See task results and billing.