外观
Qwen Image 3.0
qwen-image-3.0 是阿里巴巴 Qwen Image 3.0,通过 Pixapi 的 OpenAI 兼容图片接口进行生成和编辑。
API 形式
| 操作 | Endpoint | 模式 |
|---|---|---|
| 图片生成 | POST /v1/images/generations | 同步 |
| 图片生成任务 | POST /v1/async/images/generations | 异步 |
| 图片编辑 | POST /v1/images/edits | 同步 |
| 图片编辑任务 | POST /v1/async/images/edits | 异步 |
模型 id
| 模型 id | 适合 |
|---|---|
qwen-image-3.0 | Qwen 图片生成与编辑 |
价格
| 模型 id | 每张积分 |
|---|---|
qwen-image-3.0 | 3 |
请求字段
通用字段放在请求体一级,下面列出的模型专用参数放进 providerOptions。
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | qwen-image-3.0. 模型 ID,区分大小写。 |
prompt | string | 是 | 描述主体、构图、风格或需要修改的内容。Pixapi 最多保留前 2,000 字符;生成和编辑都要提供非空提示词。 |
n | integer | 否 | 整数 1–6,默认 1。 |
size | string | 否 | 填写 宽x高 像素尺寸,例如 1024x1024。 总像素 512×512–2048×2048。 宽高比 1:8–8:1。宽高各 512–2048,默认 1024×1024。 |
image | string / string[] | 编辑时必填 | 公网 HTTP(S) 图片 URL 或 URL 数组;/images/edits 必填。 1–3 张,每张 ≤ 10 MB,建议宽高各 384–2048 像素,支持 JPEG/PNG/BMP/TIFF/WebP/GIF。 |
providerOptions | object | 否 | 模型专用选项,详见下表。 |
providerOptions
本表所有字段都写在 providerOptions 内,不要与 model 并列。
| 字段 | 类型 | 说明 |
|---|---|---|
nsfw_check | boolean | 是否审核提示词和图片,默认 false。 |
negative_prompt | string | 描述希望排除的内容。 |
prompt_extend | boolean | 智能提示词优化,默认 false。 |
prompt_extend_mode | string | direct(默认)支持生成和编辑;agent 仅文生图。要求 prompt_extend=true。 |
输入规则
输出分辨率请用像素 size 指定。
示例
bash
curl https://api.pixapi.ai/v1/images/generations \
-H "Authorization: Bearer $PIXAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"qwen-image-3.0","prompt":"暖灰背景上的简洁杂志风产品照片","n":1,"size":"1024x1024"}'py
import os
import requests
response = requests.post(
"https://api.pixapi.ai/v1/images/generations",
headers={
"Authorization": f"Bearer {os.environ['PIXAPI_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "qwen-image-3.0",
"prompt": "暖灰背景上的简洁杂志风产品照片",
"n": 1,
"size": "1024x1024"
},
)
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-3.0",
"prompt": "暖灰背景上的简洁杂志风产品照片",
"n": 1,
"size": "1024x1024"
}),
});
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-3.0",
"prompt": "暖灰背景上的简洁杂志风产品照片",
"n": 1,
"size": "1024x1024"
}`)
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, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
}编辑图片
json
{
"model": "qwen-image-3.0",
"prompt": "把背景替换为极简摄影棚",
"image": "https://example.com/input.png",
"n": 1
}异步请求与任务轮询请参阅异步媒体任务。
统一响应结构见 API 参考。
