curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-3.0",
"prompt": "雲海之上的古城,金色晨光,電影海報構圖,清晰的中文標題",
"size": "16:9",
"resolution": "2K",
"n": 1,
"metadata": {
"prompt_extend": true,
"negative_prompt": "模糊,低品質,文字錯誤",
"watermark": false
}
}'
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-3.0-pro",
"prompt": "保留第一張圖的人物與第二張圖的服裝設計,製作現代雜誌封面",
"image_urls": [
"https://example.com/person.png",
"https://example.com/outfit.png"
],
"size": "3:4",
"resolution": "2K",
"n": 1
}'
{
"id": "<string>",
"object": "<string>",
"model": "<string>",
"status": "<string>",
"progress": 123,
"created_at": 123
}Qwen Image 3.0
Qwen Image 3.0 圖像生成
使用 qwen-image-3.0 或 qwen-image-3.0-pro 生成圖像
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-3.0",
"prompt": "雲海之上的古城,金色晨光,電影海報構圖,清晰的中文標題",
"size": "16:9",
"resolution": "2K",
"n": 1,
"metadata": {
"prompt_extend": true,
"negative_prompt": "模糊,低品質,文字錯誤",
"watermark": false
}
}'
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-3.0-pro",
"prompt": "保留第一張圖的人物與第二張圖的服裝設計,製作現代雜誌封面",
"image_urls": [
"https://example.com/person.png",
"https://example.com/outfit.png"
],
"size": "3:4",
"resolution": "2K",
"n": 1
}'
{
"id": "<string>",
"object": "<string>",
"model": "<string>",
"status": "<string>",
"progress": 123,
"created_at": 123
}中國大陸用戶請注意: 中國大陸用戶請使用
https://toapis.cn 作為接口地址(Base URL)。文檔示例中的 https://toapis.com 請替換為 https://toapis.cn。- 支援
qwen-image-3.0與qwen-image-3.0-pro - 支援文生圖、圖生圖及多張參考圖
- 最多可傳入 3 張參考圖
- 支援 1K、2K 解析度及 7 種寬高比
- 每次請求固定生成 1 張圖像,
n必須為1 - 非同步執行,提交後使用任務 ID 查詢結果
image_urls 僅支援可公開存取的圖像 URL,不支援 base64 Data URI。本地檔案請先使用上傳圖像介面。支援模型
| 模型 | 文生圖 | 圖生圖 | 參考圖上限 | 輸出數量 |
|---|---|---|---|---|
qwen-image-3.0 | 支援 | 支援 | 3 張 | 固定 1 張 |
qwen-image-3.0-pro | 支援 | 支援 | 3 張 | 固定 1 張 |
Authorizations
string
必填
Body
string
必填
模型名稱,只支援:
qwen-image-3.0qwen-image-3.0-pro
string
必填
圖像描述或編輯指令,不可為空字串。
string
輸出圖像寬高比:
1:1、4:3、3:4、16:9、9:16、3:2、2:3也支援 WIDTH*HEIGHT 或 WIDTHxHEIGHT 像素格式。像素總面積必須介於 512*512 和 2048*2048 之間,寬高比必須介於 1:8 和 8:1 之間。不傳時由模型自動選擇。string
預設值:"1K"
使用寬高比時的解析度:
1K- 預設2K
metadata.resolution,但建議使用頂層欄位。integer
預設值:1
生成數量,固定為
1。傳入大於 1 的值會返回 400 invalid_request。string
您的訂單號或業務任務 ID。傳入後,可使用同一個查詢介面按此 ID 查詢。
object
解析度與像素對照
兩個模型使用相同的寬高比與像素對照:| 寬高比 | 1K | 2K |
|---|---|---|
1:1 | 1024×1024 | 2048×2048 |
4:3 | 1152×864 | 1600×1200 |
3:4 | 864×1152 | 1200×1600 |
16:9 | 1280×720 | 1920×1080 |
9:16 | 720×1280 | 1080×1920 |
3:2 | 1152×768 | 1728×1152 |
2:3 | 768×1152 | 1152×1728 |
Response
string
用於查詢的任務 ID。
string
固定為
generation.task。string
本次使用的模型。
string
queued、in_progress、completed 或 failed。integer
0-100 的進度百分比。
integer
Unix 格式的建立時間。
請求範例
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-3.0",
"prompt": "雲海之上的古城,金色晨光,電影海報構圖,清晰的中文標題",
"size": "16:9",
"resolution": "2K",
"n": 1,
"metadata": {
"prompt_extend": true,
"negative_prompt": "模糊,低品質,文字錯誤",
"watermark": false
}
}'
curl --request POST \
--url https://toapis.com/v1/images/generations \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'Content-Type: application/json' \
--data '{
"model": "qwen-image-3.0-pro",
"prompt": "保留第一張圖的人物與第二張圖的服裝設計,製作現代雜誌封面",
"image_urls": [
"https://example.com/person.png",
"https://example.com/outfit.png"
],
"size": "3:4",
"resolution": "2K",
"n": 1
}'
提交成功回應
{
"id": "task_img_abc123def456",
"object": "generation.task",
"model": "qwen-image-3.0-pro",
"status": "queued",
"progress": 0,
"created_at": 1787270400
}
查詢任務
curl --request GET \
--url https://toapis.com/v1/images/generations/task_img_abc123def456 \
--header 'Authorization: Bearer <YOUR_API_KEY>'
{
"id": "task_img_abc123def456",
"object": "generation.task",
"model": "qwen-image-3.0-pro",
"status": "completed",
"progress": 100,
"result": {
"type": "image",
"data": [
{ "url": "https://files.toapis.com/generated/qwen-image-result.png" }
]
}
}
生成圖像 URL 有效期為 24 小時,請在
expires_at 前下載或轉存。計費
- 每次成功輸出:
$0.03 - 每張輸入參考圖:
$0.003 - 參考圖沒有免費額度
- 兩個模型目前使用相同計費規則