image.generate
Schema
Input = { prompt: string, size?: '256x256'|'512x512'|'768x768'|'1024x1024'|'1024x768'|'768x1024'|'1280x720'|'1920x1080', // default '1024x1024' path: string, // extension optional; chosen by the actual result (png/svg) style?: string, // e.g. "flat illustration", "photo", "watercolor" placeholder?: boolean, // default false — skip the model, go straight to the SVG artwork}
Output = { path: string, mime: string, width: number, height: number, size: number, provider: 'openrouter' | 'svg-fallback', model: string | null, costUsd: number, note?: string,}The fallback that always ships something
The image model tier is tried first (OpenRouter’s image
modality); if it isn’t configured, refuses, or returns no image data, the skill doesn’t fail — it
writes a deterministic abstract SVG instead (abstractSvg()), seeded from a hash of the prompt
text so the same prompt always produces the same artwork. The generator picks one of seven built-in
colour palettes, scatters six-to-twelve blurred colour blobs, a few thin rings, and a scatter of
“stars,” plus a subtle noise-grain overlay — genuinely decorative, never a grey box. note records
exactly why the fallback happened (e.g. “Fell back to generated artwork: OpenRouter is not
configured”) so a trace reader can tell a real image from a placeholder at a glance.
This is what makes the Logo and image set generator usable end-to-end even with no OpenRouter key — every brand still gets four distinct pieces of artwork, just abstract ones instead of model-rendered logos.
Example
curl -s -X POST http://localhost:4000/api/studio/skills/invoke \ -H 'content-type: application/json' -b cookies.txt \ -d '{"name":"image.generate","input":{"prompt":"a minimal geometric mark for a coffee roastery, deep indigo and warm white","path":"logo-1","placeholder":true}}'{ "ok": true, "output": { "path": "logo-1.svg", "mime": "image/svg+xml", "width": 1024, "height": 1024, "size": 2148, "provider": "svg-fallback", "model": null, "costUsd": 0, "note": "Placeholder requested; no model call made." }}