Skip to content
roasOS API
Esc
navigateopen⌘Jpreview
On this page

Generate an image

A complete image generation, start to finish.

This is the full flow for making an image. The same steps work for video, audio, and lipsync — just change the type and model.

Pick a model

See what’s available:

curl https://api.roasos.com/v1/capabilities \
  -H "Authorization: Bearer roasos_sk_..."

Image models include nano-banana-pro, gpt-image-2, flux-2-max, and more.

Quote

Always quote first to see the price (free, no charge):

curl -X POST https://api.roasos.com/v1/generations \
  -H "Authorization: Bearer roasos_sk_..." \
  -H "Idempotency-Key: product-shot-001" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "image",
    "prompt": "a ceramic coffee mug on a marble counter, soft morning light",
    "model": "nano-banana-pro",
    "quote_only": true
  }'
{
  "data": {
    "kind": "quote",
    "quote_id": "e6defcc5-...",
    "reserved_credits": 5,
    "expires_at": "2026-07-17T23:56:11.487Z",
    "authorization": { "status": "auto_approved" }
  }
}

Confirm

Same request, with the quote_id and the same idempotency key:

curl -X POST https://api.roasos.com/v1/generations \
  -H "Authorization: Bearer roasos_sk_..." \
  -H "Idempotency-Key: product-shot-001" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "image",
    "prompt": "a ceramic coffee mug on a marble counter, soft morning light",
    "model": "nano-banana-pro",
    "quote_id": "e6defcc5-..."
  }'
{
  "data": {
    "id": "a5823100-...",
    "status": "processing",
    "credits_used": 5,
    "credits_remaining": 1581
  }
}

Wait for the result

Poll until it’s done (images usually take ~20–30 seconds):

curl https://api.roasos.com/v1/generations/a5823100-... \
  -H "Authorization: Bearer roasos_sk_..."
{
  "data": {
    "status": "completed",
    "output": { "images": ["https://cdn.roasos.com/.../image.png"] }
  }
}

That URL is your finished image.

Was this page helpful?