qwen-image-0925Async generation
Qwen Image (0925) text-to-image model, generated asynchronously: submit a task to /v1/images/tasks, then download the image. Sizes 1024x1024, 1280x720, 720x1280 (1K) and 2048x2048 (2K).
The lowest price across upstreams, for reference. Prices depend on size and are listed per upstream below.
| Upstream | Resolution · price | Data policy |
|---|---|---|
lune.io-vodLowest price | 1K (short edge ≤ 1024px)$0.06546 / image 2K (short edge 1025–2048px)$0.08289 / image | — |
Routed in real time — you pay the listed price of whichever upstream serves your call. Priced per image by the output's short edge: 1K (short edge ≤ 1024px), 2K (short edge 1025–2048px). Any width × height from 512×512 to 2048×2048 pixels in total works, as long as its resolution is listed. Data policies reflect each upstream's own data terms and its agreement with us. We do not independently audit upstream implementations.
# Async image model: no OpenAI SDK method — call the task endpoints directly.
# 1. Submit — returns a task with status "queued"
curl https://api.lune.io/v1/images/tasks \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "qwen/qwen-image-0925", "prompt": "A red paper boat on a calm lake", "size": "1024x1024"}'
# 2. Poll every few seconds until status is completed, failed or expired
curl https://api.lune.io/v1/images/tasks/$TASK_ID -H "Authorization: Bearer $API_KEY"
# 3. Download within 24 hours of completion (one call per image, index from data[])
curl -o image.png "https://api.lune.io/v1/images/tasks/$TASK_ID/content?index=0" -H "Authorization: Bearer $API_KEY"# Async image model: no OpenAI SDK method — call the task endpoints directly.
import os, time, requests
base = "https://api.lune.io/v1"
headers = {"Authorization": f"Bearer {os.environ['API_KEY']}"}
task = requests.post(f"{base}/images/tasks", headers=headers, json={
"model": "qwen/qwen-image-0925",
"prompt": "A red paper boat on a calm lake",
"size": "1024x1024",
}).json()
while task["status"] in ("queued", "in_progress"):
time.sleep(4)
task = requests.get(f"{base}/images/tasks/{task['id']}", headers=headers).json()
if task["status"] == "completed":
for item in task["data"]: # one entry per image; download within 24 hours
img = requests.get(f"{base}/images/tasks/{task['id']}/content",
headers=headers, params={"index": item["index"]})
open(f"image_{item['index']}.png", "wb").write(img.content)
else:
print(task["status"], task["error"]) # failed and expired tasks aren't charged// Async image model: no OpenAI SDK method — call the task endpoints directly.
const base = "https://api.lune.io/v1";
const headers = { Authorization: `Bearer ${process.env.API_KEY}`, "Content-Type": "application/json" };
let task = await fetch(`${base}/images/tasks`, {
method: "POST",
headers,
body: JSON.stringify({ model: "qwen/qwen-image-0925", prompt: "A red paper boat on a calm lake", size: "1024x1024" }),
}).then((r) => r.json());
while (task.status === "queued" || task.status === "in_progress") {
await new Promise((r) => setTimeout(r, 4_000));
task = await fetch(`${base}/images/tasks/${task.id}`, { headers }).then((r) => r.json());
}
if (task.status === "completed") {
const fs = await import("node:fs/promises");
for (const item of task.data) {
// one entry per image; download within 24 hours
const img = await fetch(`${base}/images/tasks/${task.id}/content?index=${item.index}`, { headers });
await fs.writeFile(`image_${item.index}.png`, Buffer.from(await img.arrayBuffer()));
}
} else {
console.log(task.status, task.error); // failed and expired tasks aren't charged
}// Async image model: no OpenAI SDK method — call the task endpoints directly.
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"os"
"time"
)
const base = "https://api.lune.io/v1"
func call(method, path string, body []byte) *http.Response {
req, _ := http.NewRequest(method, base+path, bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
return resp
}
func main() {
var task struct {
ID, Status string
Error any
Data []struct{ Index int }
}
body := []byte(`{"model": "qwen/qwen-image-0925", "prompt": "A red paper boat on a calm lake", "size": "1024x1024"}`)
json.NewDecoder(call("POST", "/images/tasks", body).Body).Decode(&task)
for task.Status == "queued" || task.Status == "in_progress" {
time.Sleep(4 * time.Second)
json.NewDecoder(call("GET", "/images/tasks/"+task.ID, nil).Body).Decode(&task)
}
if task.Status != "completed" {
fmt.Println(task.Status, task.Error) // failed and expired tasks aren't charged
return
}
for _, item := range task.Data { // one entry per image; download within 24 hours
out, _ := os.Create(fmt.Sprintf("image_%d.png", item.Index))
io.Copy(out, call("GET", fmt.Sprintf("/images/tasks/%s/content?index=%d", task.ID, item.Index), nil).Body)
}
}