curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-3.0",
"prompt": "一张咖啡馆海报,主标题写着「秋日限定」,暖色调,排版精致",
"size": "16:9",
"resolution": "1K"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "qwen-image-3.0",
"prompt": "一张咖啡馆海报,主标题写着「秋日限定」,暖色调,排版精致",
"size": "16:9",
"resolution": "1K",
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/images/generations";
const payload = {
model: "qwen-image-3.0",
prompt: "一张咖啡馆海报,主标题写着「秋日限定」,暖色调,排版精致",
size: "16:9",
resolution: "1K",
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01JGXYZ1234567890ABCDEF"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
Qwen Image 3.0
Qwen Image 3.0 图像生成
- 异步处理模式,返回任务 ID 用于后续查询
- 支持文生图、图生图(1-3 张参考图编辑)
- 支持 1K / 2K 分辨率,单次最多 6 张
- 提供标准版与 Pro 版(密集排版、图文更强)
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-3.0",
"prompt": "一张咖啡馆海报,主标题写着「秋日限定」,暖色调,排版精致",
"size": "16:9",
"resolution": "1K"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "qwen-image-3.0",
"prompt": "一张咖啡馆海报,主标题写着「秋日限定」,暖色调,排版精致",
"size": "16:9",
"resolution": "1K",
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/images/generations";
const payload = {
model: "qwen-image-3.0",
prompt: "一张咖啡馆海报,主标题写着「秋日限定」,暖色调,排版精致",
size: "16:9",
resolution: "1K",
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01JGXYZ1234567890ABCDEF"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-3.0",
"prompt": "一张咖啡馆海报,主标题写着「秋日限定」,暖色调,排版精致",
"size": "16:9",
"resolution": "1K"
}'
import requests
url = "https://api.apimart.ai/v1/images/generations"
payload = {
"model": "qwen-image-3.0",
"prompt": "一张咖啡馆海报,主标题写着「秋日限定」,暖色调,排版精致",
"size": "16:9",
"resolution": "1K",
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json",
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
const url = "https://api.apimart.ai/v1/images/generations";
const payload = {
model: "qwen-image-3.0",
prompt: "一张咖啡馆海报,主标题写着「秋日限定」,暖色调,排版精致",
size: "16:9",
resolution: "1K",
};
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01JGXYZ1234567890ABCDEF"
}
]
}
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
支持的模型
| 模型名 | 说明 | 最大张数 | 分辨率 |
|---|---|---|---|
qwen-image-3.0 | 指令理解清晰,文字渲染稳定,常规出图更划算 | 6 张 | 1K / 2K |
qwen-image-3.0-pro | 内容更丰实,适合报纸、分镜、菜单、试卷等密集排版 | 6 张 | 1K / 2K |
排版密集、字多的场景优先用
-pro;常规出图用 qwen-image-3.0。提示词最长约 4.5k token。模型名与 2.0 系列不兼容互换。Authorizations
string
必填
所有接口均需要使用 Bearer Token 进行认证获取 API Key:访问 API Key 管理页面 获取您的 API Key使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
Body
string
必填
模型名称
qwen-image-3.0- 标准版qwen-image-3.0-pro- Pro 版(密集图文 / 排版)
boolean
默认值:"false"
是否在提交图片任务前执行内容审核。
true:使用omni-moderation-latest审核提示词和输入图片false或不传:不发起审核请求,不增加审核成本与延迟(默认)
string
必填
图像生成的文本描述,最长约 4.5k token
string[]
参考图 URL 数组(图生图 / 图像编辑),1-3 张
- 支持公网
http(s)://URL,或data:image/png;base64,...(base64 会先转存) - 格式:JPG / JPEG / PNG / BMP / TIFF / WEBP / GIF
- 单张 ≤ 10MB,宽高建议 384-2048 像素
string
默认值:"1K"
分辨率档位(与计费档位相关)
1K(默认,兼容小写)2K
size 中直接写像素(如 1600x900)。直接给像素时,面积 > 225 万像素 按 2K 档计费。string
默认值:"1:1"
图像宽高比,或直接像素尺寸支持的宽高比:
1:1(默认)4:3/3:416:9/9:163:2/2:3
16x9 写法,或像素如 1024x1024。自定义像素时,宽与高各自须在 512 ~ 2048,宽高比 1:8 ~ 8:1。不传 size 也不传 resolution 时固定出 1024×1024。integer
默认值:"1"
出图张数,1-6。超过 6 会自动截断为 6。
string
反向提示词,描述不希望出现的内容
boolean
默认值:"false"
提示词智能改写默认关闭,以保证结果可预测。需要智能改写时设为
true。string
改写方式(仅 3.0 系列,且需
prompt_extend: true)direct- 文生图 / 图生图均可agent- 仅文生图,改写更激进
尺寸对照表
通过resolution(档位)+ size(比例)组合控制输出尺寸:
| 分辨率 | 1:1 | 4:3 | 3:4 | 16:9 | 9:16 | 3:2 | 2:3 |
|---|---|---|---|---|---|---|---|
| 1K | 1024×1024 | 1152×864 | 864×1152 | 1280×720 | 720×1280 | 1248×832 | 832×1248 |
| 2K | 2048×2048 | 2048×1536 | 1536×2048 | 2048×1152 | 1152×2048 | 2048×1360 | 1360×2048 |
使用场景示例
文生图(多张)
{
"model": "qwen-image-3.0",
"prompt": "扁平插画风格的城市天际线,黄昏,暖橙色调",
"size": "16:9",
"resolution": "1K",
"n": 4
}
文生图(密集排版,开改写)
{
"model": "qwen-image-3.0-pro",
"prompt": "一份西餐厅菜单,分前菜/主菜/甜品三栏,每栏 5 道菜带价格,衬线字体,米色底",
"size": "3:4",
"resolution": "2K",
"prompt_extend": true,
"prompt_extend_mode": "agent"
}
图生图(图像编辑)
{
"model": "qwen-image-3.0-pro",
"prompt": "把画面里的招牌文字改成「营业中」,其余保持不变",
"image_urls": ["https://example.com/shop.jpg"],
"size": "1:1"
}
带反向提示词
{
"model": "qwen-image-3.0",
"prompt": "写实风格的山间小屋,清晨薄雾",
"negative_prompt": "文字, 水印, 人物, 低分辨率",
"size": "3:2"
}
限制
| 项 | 限制 |
|---|---|
| 提示词 | ≤ 4.5k token |
| 输出尺寸 | 自定义像素时宽、高各自 512 ~ 2048;宽高比 1:8 ~ 8:1 |
| 出图张数 | 1-6(超出自动截断) |
| 参考图数量 | 1-3 张 |
| 参考图格式 | JPG / JPEG / PNG / BMP / TIFF / WEBP / GIF |
| 参考图大小 | ≤ 10MB,宽高建议 384-2048 像素 |
Response
integer
响应状态码,成功时为 200
与 2.0 的差异
| 2.0 系列 | 3.0 系列 | |
|---|---|---|
| 提示词长度 | 较短 | 约 4.5k token |
prompt_extend_mode | 不支持 | direct / agent |
| 分辨率 | 1K / 2K | 1K / 2K(Pro 的 2K 档位价格更高) |
| 参考图 | 支持 | 1-3 张 |
注意事项
- 异步处理:提交后返回
task_id,使用 获取任务状态 轮询;建议每 3~5 秒一次,超时约 3 分钟(2K + 多张更慢)。 - 图片存储:生成图片已镜像到平台 CDN,返回地址长期可用。
- 计费:按实际出图张数 × 分辨率档位计费;档位按实际像素面积判定(> 225 万像素为 2K)。
qwen-image-3.0的 1K/2K 同价;-pro的 2K 为 1K 的两倍。任务失败全额退款;参考图不额外收费。 - 常见错误:自定义
size宽或高不在 512–2048、比例越界、agent用在图生图、参考图不可访问或超 10MB 等返回 400;限流 429。
查询任务结果使用 获取任务状态 接口查询进度与
result.images。