Adding AI Image Generation to Your App
Submit a prompt, poll a task, serve the image: a working image-generation integration on Orux AI in about 30 lines of Node.js, starting at ≈ 4.95 credits per image.
What you'll build
A small Node.js script that submits a text prompt to an image generation model and retrieves the finished image URL — the core of features like avatars, product mockups and illustration generators.
1. Get an API key
Create an account, open the dashboard and create a key. New accounts include trial credits, and image models on Orux start at about 4.95 Credits per image (1 Credit = $0.005).
2. Submit a generation task
Image models like seedream-5.0 run as async tasks: submit once, then poll.
const KEY = process.env.ORUX_API_KEY
const headers = { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" }
const submit = await fetch("https://orux.top/api/v1/tasks", {
method: "POST", headers,
body: JSON.stringify({ model: "seedream-5.0", input: { prompt: "a red fox in a snowy forest, cinematic light" } }),
})
const { task_id } = await submit.json()
console.log("task:", task_id)3. Poll until the image is ready
let task
do {
await new Promise((r) => setTimeout(r, 5000))
task = await (await fetch(`https://orux.top/api/v1/tasks/${task_id}`, { headers })).json()
console.log(task.status)
} while (task.status === "QUEUED" || task.status === "RUNNING")
if (task.status === "SUCCESS") console.log("image:", task.result[0])Typical turnaround is 10–30 seconds. The response result array contains hosted image URLs that stay accessible, so you can store them or hand them straight to your users.
Pricing and model choice
| Model | Price | Best for |
|---|---|---|
| seedream-5.0 | ≈ 4.95 Credits / image | photorealistic renders, clean typography |
| nano-banana-2.1 | see model page | prompt adherence and image editing |
Failed tasks (FAILED / expired) are not charged.
Common errors
401 invalid_api_key— the key is missing theBearer` prefix or was revoked.402 quota_exceeded— balance is used up; top up and retry.- Task
FAILED— usually a prompt the safety system rejected; rephrase and resubmit (no charge).
Next steps
Browse every image model on the model market, check exact parameters on each model page, and read the quickstart for auth details.