跳至正文
EN
Qwen · 模型接口

Qwen Image API

Qwen Image API 的模型能力、计价规格、请求参数和接入示例。使用 VezAPI 账号密钥统一接入。

文生图图生图

Qwen Image API 接入文档

使用 VezAPI 密钥接入 Qwen Image。下列操作共用同一个账号余额和鉴权方式。

服务地址: https://api.vezapi.com
请求头使用 Authorization: Bearer YOUR_VEZAPI_KEY。每次提交使用唯一的 Idempotency-Key,查询同一笔提交时才复用。

Qwen 图生图

POST/api/v1/jobs/createTask

模型标识: qwen/image-to-image

参数类型说明与限制
model
必填
string

用于生成任务的模型名称。必填字段。 - 该端点必须使用 `qwen/image-to-image` 模型

可选值:"qwen/image-to-image"

默认:"qwen/image-to-image"

callBackUrl
可选
string

接收生成任务完成通知的回调 URL。可选配置,建议在生产环境中使用。 - 任务生成完成后,系统会向该 URL POST 任务状态与结果 - 回调内容包含生成的资源 URL 与任务相关信息 - 您的回调端点需要支持接收带 JSON 负载的 POST 请求 - 也可以选择调用任务详情端点,主动轮询任务状态 - 为确保回调安全性,请参阅 [Webhook 校验指南](/cn/common-api/webhook-verification) 了解签名验证实现方法

input
可选
object

生成任务的输入参数

input.prompt
必填
string

用于图像生成的文本描述(最大长度:5000 字符)

maxLength: 5000

input.image_url
必填
string

用于引导图像生成的参考图 URL(为上传后的文件 URL,而非文件内容;支持类型:image/jpeg、image/png、image/webp;最大大小:10.0MB)

input.strength
可选
number

去噪强度。1.0 = 完全重构图像;0.0 = 完全保留原图(最小值:0,最大值:1,步长:0.01)

默认:0.8

minimum: 0

maximum: 1

input.output_format
可选
string

生成图像的格式

可选值:"png", "jpeg"

默认:"png"

input.acceleration
可选
string

图像生成的加速级别。可选值:'none'、'regular'、'high'。加速级别越高,生成速度越快。'regular' 模式平衡速度与质量。'high' 模式推荐用于不含文字的图像生成

可选值:"none", "regular", "high"

默认:"none"

input.negative_prompt
可选
string

图像生成的反向文本描述(最大长度:500 字符)

maxLength: 500

input.seed
可选
integer

对于同一版本的模型,相同的种子值和文本描述将生成完全相同的图像

input.num_inference_steps
可选
number

推理步数(最小值:2,最大值:250,步长:1)

默认:30

minimum: 2

maximum: 250

input.guidance_scale
可选
number

无分类器引导系数(CFG),用于控制生成图像与文本描述的贴合程度(最小值:0,最大值:20,步长:0.1)

默认:2.5

minimum: 0

maximum: 20

input.enable_safety_checker
可选
boolean

在控制台中安全检测功能始终启用。仅可通过 API 将该参数设为 false 来关闭此功能。(布尔值(true/false))

input.nsfw_checker
可选
boolean

默认值为 false。您可以根据需要将其设置为 false。如果设置为 false,我们的内容过滤功能将被禁用,所有结果将由模型直接返回。

默认:false

请求示例
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
  -H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
  -H 'Idempotency-Key: your-unique-request-id' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "qwen/image-to-image",
  "input": {
    "prompt": "Change the season from winter to spring. Keep the same composition, with the cabin, lake, and mountains unchanged. Fill the scene with warmth and vitality using blooming flowers and lush greenery.",
    "image_url": "https://example.com/input.png"
  }
}'
返回值与错误

HTTP 200

请求成功

参数类型说明与限制
code
可选
integer

Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying).

可选值:200, 401, 402, 404, 422, 429, 433, 455, 500, 501, 505

msg
可选
string

Response message, error description upon failure

data
必填
object
data.taskId
必填
string

The task ID can be used with the "Get Task Details" endpoint to query the task status.

Qwen 文生图

POST/api/v1/jobs/createTask

模型标识: qwen/text-to-image

参数类型说明与限制
model
必填
string

用于生成任务的模型名称。必填字段。 - 该端点必须使用 `qwen/text-to-image` 模型

可选值:"qwen/text-to-image"

默认:"qwen/text-to-image"

callBackUrl
可选
string

接收生成任务完成通知的回调 URL。可选配置,建议在生产环境中使用。 - 任务生成完成后,系统会向该 URL POST 任务状态与结果 - 回调内容包含生成的资源 URL 与任务相关信息 - 您的回调端点需要支持接收带 JSON 负载的 POST 请求 - 也可以选择调用任务详情端点,主动轮询任务状态 - 为确保回调安全性,请参阅 [Webhook 校验指南](/cn/common-api/webhook-verification) 了解签名验证实现方法

input
可选
object

生成任务的输入参数

input.prompt
必填
string

用于生成图像的文本描述(最大长度:5000 字符)

maxLength: 5000

input.image_size
可选
string

生成图像的尺寸规格。请显式传入。

可选值:"square", "square_hd", "portrait_4_3", "portrait_16_9", "landscape_4_3", "landscape_16_9"

input.num_inference_steps
可选
number

推理步数(最小值:2,最大值:250,步长:1)

默认:30

minimum: 2

maximum: 250

input.seed
可选
integer

对于同一版本的模型,相同的种子值和文本描述将生成完全相同的图像

input.guidance_scale
可选
number

无分类器引导系数(CFG),用于控制生成图像与文本描述的贴合程度(最小值:0,最大值:20,步长:0.1)

默认:2.5

minimum: 0

maximum: 20

input.enable_safety_checker
可选
boolean

在控制台中安全检测功能始终启用。仅可通过 API 将该参数设为 false 来关闭此功能。(布尔值(true/false))

input.output_format
可选
string

生成图像的格式

可选值:"png", "jpeg"

默认:"png"

input.negative_prompt
可选
string

图像生成的反向文本描述(最大长度:500 字符)

maxLength: 500

input.acceleration
可选
string

图像生成的加速级别。可选值:'none'、'regular'、'high'。加速级别越高,生成速度越快。'regular' 模式平衡速度与质量。'high' 模式推荐用于不含文字的图像生成

可选值:"none", "regular", "high"

默认:"none"

input.nsfw_checker
可选
boolean

默认值为 false。您可以根据需要将其设置为 false。如果设置为 false,我们的内容过滤功能将被禁用,所有结果将由模型直接返回。

默认:false

请求示例
curl -X POST 'https://api.vezapi.com/api/v1/jobs/createTask' \
  -H 'Authorization: Bearer YOUR_VEZAPI_KEY' \
  -H 'Idempotency-Key: your-unique-request-id' \
  -H 'Content-Type: application/json' \
  -d '{
  "model": "qwen/text-to-image",
  "input": {
    "prompt": "A rainy nighttime city poster illuminated by neon lights."
  }
}'
返回值与错误

HTTP 200

请求成功

参数类型说明与限制
code
可选
integer

Status code of the request. The HTTP status is 200 even when the request fails, so always check this field: 200 means success; any other value means the request failed and msg describes the reason. Common values: 401 invalid or missing API key; 402 insufficient credits; 429 rate limit exceeded; 422 or 500 the request could not be processed (read msg and check your parameters before retrying).

可选值:200, 401, 402, 404, 422, 429, 433, 455, 500, 501, 505

msg
可选
string

Response message, error description upon failure

data
必填
object
data.taskId
必填
string

The task ID can be used with the "Get Task Details" endpoint to query the task status.

任务状态与回调

异步任务请保存返回的 taskId。调用 GET /api/v1/jobs/recordInfo?taskId=... 查询,或在创建时设置 callBackUrl。只有任务所属账号可以查询任务或基于任务创建派生资源。

超时可能表示请求已经受理。请在控制台查看原请求,不要自动新建任务。回调可能重试并重复到达,请使用 X-VezAPI-Event-Id 去重。

文件、日志与计费

生成媒体通常随上游保留 14 天,上传文件在 24 小时后失效。请在过期前保存所需文件。VezAPI 仅流式转发已登记资源,不提供永久作品库。请求日志保留两个自然月。

调用前预留积分,最终按实际优惠扣分 1:1 结算。用量不明时暂停新付费请求。若保护其他任务预留后余额不足以结算,会保留待结算记录,补足余额后再扣费;模型用量不会将钱包扣成负数。按时长计价的输入文件由服务端读取时长,读取失败时不提交模型任务。

打开完整文档 →

Qwen Image API 价格

下方费率为参考估算,最终按实际优惠扣分 1:1 结算。按标准充值包换算,1,000 积分约为 10 美元,大额充值包可降低每积分实际单价。

规格积分计价单位美元参考
Qwen Image, text-to-image4.0每百万像素$0.04
Qwen Image, image-to-image4.0每张图片$0.04