1 const result = await client.images.generate({ 2 model: "openai/gpt-image-1", 3 prompt: "A watercolor of a fox in a snowy forest", 4 n: 1, 5 size: "1024x1024", 6 quality: "high", 7 output_format: "webp", 8 }); 9 10 console.log(result.data[0].url);
1 const stream = client.images.stream({ 2 model: "openai/gpt-image-1", 3 prompt: "A watercolor of a fox in a snowy forest", 4 n: 1, 5 size: "1024x1024", 6 quality: "high", 7 output_format: "webp", 8 }); 9 10 for await (const chunk of stream) { 11 if (chunk.status === "processing") { 12 console.log("Generating..."); 13 } else if (chunk.data?.length) { 14 console.log("Done:", chunk.data[0].url); 15 } 16 }
| Field | Type | Notes |
|---|---|---|
prompt | string | Required |
model | string | e.g. "openai/gpt-image-1" |
n | number | Number of images (1–10) |
size | string | "auto", "1024x1024", "WIDTHxHEIGHT" |
quality | string | "auto", "low", "medium", "high", "hd", "standard" |
response_format | "url" | "b64_json" | |
output_format | "png" | "jpeg" | "webp" | OpenAI only |
stream | boolean | Enable SSE keep-alive streaming |