Image Playground
Describe a picture and generate it with dozens of models. Guide them with reference images, keep the results in collections, and see what each one cost.
Sign in to use this toy
It runs on your AIVAX account, and each image is charged to your balance at the model's list price. You choose how long access lasts and can revoke it in the console.
No account? Create one for free, then come back.
Your collections
Saved in this browser only. Clearing site data removes them.
Charged to your AIVAX account · see usage
Nothing here yet. Your images show up here, newest first.
How it works
Generate
Your prompt goes to the model you pick, and AIVAX returns up to four images per request. Each model has its own price per image, and failed images aren't charged. Image generation
Guide
Models that accept references follow up to 16 pictures: a link, an upload, a pasted screenshot or an image you already made. Styles add a short description to the end of your prompt.
Keep
Collections live in your browser's IndexedDB: only the image links, prompts and costs. The images themselves are hosted by AIVAX at those links.
For developers API calls from this session, and the code to build it yourself
Calls made by this page
- API calls
- 0
- Images generated
- 0
- Charged this session
- $0.00
Costs come from the API response. Each call is billed to the AIVAX account you signed in with, through an application key limited to web fetch and generations.
Build it yourself
One API call: POST /api/v1/generations/images. The models and their prices come from the public
GET /api/v1/information/image-models.json. See the API reference or the
Worker behind this page.
# 1. Models, flags (AllowReferenceImage, Deprecated) and list prices. Public, no key needed. curl https://inference.aivax.net/api/v1/information/image-models.json # 2. Generate. `count` is 1 to 4 images per prompt. `size` is "x curl https://direct.inference.aivax.net/api/v1/generations/images \ -H "Authorization: Bearer $AIVAX_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "input": "A lighthouse during a winter storm\n\nStyle: anime illustration, cel shading\n\nAspect ratio: 16:9 (landscape).", "model": "@black-forest-labs/flux-3-image-klein", "count": 2, "size": "2048x1152", "referenceImages": ["https://example.com/lighthouse.jpg"] }' # → { "data": [ { # "input": "A lighthouse during a winter storm...", # "images": ["https://.../image-1.webp"], # "outputs": [ # { "url": "https://.../image-1.webp", "cost": 0.019, "error": null }, # { "url": null, "cost": 0, "error": "The image could not be generated." } ← not charged # ], # "cost": 0.019 } ] }", 64 to 4096 px # per side; some models only get close, so this page also names the aspect ratio in the prompt. # `referenceImages` takes up to 16 http(s) links or data:image/...;base64 URIs, on models # flagged AllowReferenceImage.
// Works in Node 18+, Bun, Deno and browsers. Keep the API key server-side. const AIVAX = "https://direct.inference.aivax.net/api/v1"; // Skip deprecated models, and note which ones accept reference images. async function listModels() { const response = await fetch("https://inference.aivax.net/api/v1/information/image-models.json"); const { data } = await response.json(); return data .filter((model) => !model.flags.includes("Deprecated")) .map((model) => ({ name: model.name, label: model.displayName, price: model.pricingDescription, acceptsReferences: model.flags.includes("AllowReferenceImage"), })); } async function generateImages({ prompt, model, count = 1, size, references = [] }) { const response = await fetch(`${AIVAX}/generations/images`, { method: "POST", headers: { authorization: `Bearer ${process.env.AIVAX_API_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ input: prompt, model, count, ...(size && { size }), // "2048x1152" ...(references.length && { referenceImages: references }), }), }); const payload = await response.json(); if (!response.ok) throw new Error(payload.error); const [group] = payload.data; // one group per prompt in `input` return { outputs: group.outputs, cost: group.cost }; } const { outputs, cost } = await generateImages({ prompt: "A cozy reading nook with a sleeping cat", model: "@black-forest-labs/flux-3-image-klein", count: 2, size: "1024x1024", }); for (const output of outputs) console.log(output.url ?? `failed: ${output.error}`); console.log(`Charged $${cost}`);
// Trimmed from src/worker.js in the repository. The real file adds the AIVAX OAuth // sign-in that stores each visitor's application key in an HttpOnly cookie. const AIVAX_API = "https://direct.inference.aivax.net/api/v1"; export default { async fetch(request, env) { const url = new URL(request.url); if (url.pathname === "/api/images/generate" && request.method === "POST") { const { prompt, model, count, size, references } = await request.json(); const response = await fetch(`${AIVAX_API}/generations/images`, { method: "POST", headers: { authorization: `Bearer ${env.AIVAX_API_KEY}`, "content-type": "application/json", }, body: JSON.stringify({ input: prompt, model, count, size, referenceImages: references }), }); const payload = await response.json(); if (!response.ok) return Response.json({ error: payload.error }, { status: response.status }); const [group] = payload.data; return Response.json({ outputs: group.outputs, cost: group.cost }); } return env.ASSETS.fetch(request); }, };