---
title: "Generate an image (6 or 10 tokens)"
method: POST
path: "/v1/generate/image"
---

# Generate an image (6 or 10 tokens)

`POST /v1/generate/image`

## Request

- Base URL: `https://api.ffmpeg-micro.com`
- URL: `https://api.ffmpeg-micro.com/v1/generate/image`
- Auth: HTTP bearer

Text to image. Default model `flux-schnell` bills 6 tokens per image. `model: nano-banana` (10 tokens) follows style instructions more faithfully. With `reference_urls` (1–4 https images) the result is an EDIT that keeps the referenced character and product identical — the way to build a consistent storyboard; references force `nano-banana`. Tokens are spent before the provider call and refunded if it fails. Rate limited to 30/min per key.

## Request body

- GenerateImageRequest
  - `prompt` string, required
  - `aspect` 'landscape_16_9' | 'portrait_9_16' | 'square_1_1'
  - `model` 'flux-schnell' | 'nano-banana': Ignored when `reference_urls` is given (references force `nano-banana`)
  - `reference_urls` string[]: https images the result must stay faithful to (a character sheet, a product shot)
  - `seed` integer: Fixed seed for repeatability. Omit for random; `null` is rejected.

## Response `200`

Image generated

- GenerateImageResponse
  - `url` string, uri
  - `aspect` string
  - `model` 'flux-schnell' | 'nano-banana'
  - `tokens_charged` number

## Other responses

- `400`: Invalid input (charged nothing)
- `401`: Missing/invalid API key
- `402`: Not enough tokens for this call; nothing was charged (for `animate`, `id` and `cancelled` are present if a render had already been submitted)
- `429`: Per-API-key rate limit exceeded (free routes 60/min, paid routes 30/min); see `x-ratelimit-*` headers
- `502`: The provider failed; any tokens spent were refunded unless `refund` says otherwise

---

[API](https://skmtc.dev/ffmpeg-micro/apis/ffmpeg-micro-api.md) · [All operations](https://skmtc.dev/ffmpeg-micro/apis/ffmpeg-micro-api/llms.txt) · [OpenAPI document](https://skmtc.dev/ffmpeg-micro/apis/ffmpeg-micro-api/revisions/64bb930ff345?raw)
