API reference · Alibaba

alibaba/qwen-image-3/edit

Integrate this model through SandBase's unified API, with production-ready schemas and examples.

IMAGEAsyncOpen model
Production endpoint

Send your first request

OpenAI-compatible endpoint with unified authentication and usage tracking.

POSThttps://api.sandbase.ai/v1/run
Model IDalibaba/qwen-image-3/edit
01

Input Schema

5 parameters · 2 required · 3 optional

ParameterTypeRequiredDescription
imagesstring[]RequiredList of input image URLs for editing. Supports 1 to 3 images.
promptstringRequiredThe editing instruction describing what changes to make. · Min length: 1 · Max length: 800 · Default: "用途:precise-object-edit。图像1是唯一编辑目标。这是中国高中数学试卷批改真实性测试。\n严格保留原图的木桌、相机视角、纸张轮廓与阴影,以及全部黑色印刷文字、题号、公式、图形和版式;禁止重绘、改写、移动或删除原试卷内容。只新增以下红色教师签字笔笔迹:\n1. 在试卷右上角写“112/150”并用红笔圈住。\n2. 在四个部分标题旁依次写“45/60”“15/20”“10/20”“42/70”。\n3. 仅在第3、14、25题题号旁画红色叉号;仅在第1、13、21题题号旁画红色勾号。\n4. 在第25题旁写“计算错误”,在第22题旁写“过程不完整”。\n红笔必须像中国高中教师真实批卷:自然手写、轻微倾斜、压感和墨迹浓淡变化,位置准确且不遮挡题干。不要添加学生答案、手、人物、文具、印章、水印或其他内容。除指定红笔内容外,画面保持不变。"
seedintegerOptionalRandom seed for reproducibility (0-2147483647). · Default: 20260724
aspect_ratiostringOptionalThe aspect ratio of the generated image. · Options: 21:9, 16:9, 3:2, 4:3, 5:4, 1:1, 4:5, 3:4, 2:3, 9:16 · Default: "3:4"
21:916:93:24:35:41:14:53:42:39:16
output_formatstringOptionalThe format of the generated image. · Options: jpeg, png · Default: "png"
jpegpng
02

Output Schema

FieldTypeDescription
idstringUnique identifier for the generation task
statusstringTask status: pending, running, completed, failed, timeout
modelstringModel used for the generation
outputsarrayArray of output items
outputs[].urlstringURL of the generated artifact
outputs[].content_typestringMIME type (e.g. image/png, video/mp4)
errorobject | nullError details if failed, null on success
error.typestringMachine-readable error type code
error.messagestringHuman-readable error description

Async Workflow

This model uses asynchronous execution. Submit a request and poll for the result.

  1. Submit — POST to /v1/run, receive an id
  2. Poll — GET /v1/run/{id} until status is completed, failed, or timeout
  3. Retrieve — Read outputs from the completed response
03

Code Examples

Ready-to-run snippets

const apiKey = process.env.SANDBASE_API_KEY;
const response = await fetch("https://api.sandbase.ai/v1/run", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${apiKey}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "model": "alibaba/qwen-image-3/edit",
    "seed": 20260724,
    "images": [
      "https://media.sandbase.ai/files/3b376bfd-65d4-4653-817b-51098dee1045.png"
    ],
    "prompt": "用途:precise-object-edit。图像1是唯一编辑目标。这是中国高中数学试卷批改真实性测试。\n严格保留原图的木桌、相机视角、纸张轮廓与阴影,以及全部黑色印刷文字、题号、公式、图形和版式;禁止重绘、改写、移动或删除原试卷内容。只新增以下红色教师签字笔笔迹:\n1. 在试卷右上角写“112/150”并用红笔圈住。\n2. 在四个部分标题旁依次写“45/60”“15/20”“10/20”“42/70”。\n3. 仅在第3、14、25题题号旁画红色叉号;仅在第1、13、21题题号旁画红色勾号。\n4. 在第25题旁写“计算错误”,在第22题旁写“过程不完整”。\n红笔必须像中国高中教师真实批卷:自然手写、轻微倾斜、压感和墨迹浓淡变化,位置准确且不遮挡题干。不要添加学生答案、手、人物、文具、印章、水印或其他内容。除指定红笔内容外,画面保持不变。",
    "aspect_ratio": "3:4",
    "output_format": "png"
  }),
});

if (!response.ok) throw new Error(await response.text());
let result = await response.json();
for (let attempt = 0; attempt < 120 && !["completed", "failed", "timeout"].includes(result.status); attempt++) {
  await new Promise((resolve) => setTimeout(resolve, 2_000));
  const poll = await fetch(`https://api.sandbase.ai/v1/run/${result.id}`, {
    headers: { Authorization: `Bearer ${apiKey}` },
  });
  if (!poll.ok) throw new Error(await poll.text());
  result = await poll.json();
}
if (result.status !== "completed") throw new Error(`Generation ended: ${result.status}`);
console.log(result);