Image Generations
Endpoints
Image Generations
Generate or edit images. Asynchronous — returns 202 with a job_id; poll GET /v1/jobs/ for the result.
POST
Image Generations
Async endpoint. The request returns immediately with a
Same response shape. Poll every 1–2 seconds until
The
When
The resulting
Replaying this exact request returns the same job — no new charge.
job_id; the actual generation runs in the background and is charged on success only.
Request body
One of:
recraft-v4, recraft-v4-pro, recraft-v4-vector, recraft-v4-vector-pro, flux-2-pro, flux-kontext-pro, ideogram-v3, flux-1.1-ultra (legacy), recraft-v3 (legacy). See Image Generation.Text prompt describing the desired image. Maximum 4000 characters.
Number of images to generate. Range 1–4. Each image is billed at the model’s per-image rate. Ignored by
flux-2-pro (per-megapixel billing — n=1 always).Output dimensions or aspect ratio. Accepted forms:
"auto", "WIDTHxHEIGHT" (e.g. "1024x1024"), or an aspect string like "16:9". Mapped to one of the canonical aspect ratios: 1:1, 16:9, 9:16, 4:3, 3:4, 21:9. Unrecognized sizes use the model default. For flux-2-pro, larger sizes increase the per-megapixel charge.HTTPS URL of a single source image. Required for
flux-kontext-pro (image-edit model). Optionally accepted by flux-2-pro for image-to-image generation. Ignored by other text-to-image models. A flux-kontext-pro request without image_url (or image_urls) returns 400 image_url_required.Array of up to 10 HTTPS source image URLs for multi-reference blending. Currently supported by
flux-2-pro only — first 6 entries are processed at high fidelity, entries 7–10 act as supplementary composition guides. When both image_url and image_urls are present, image_urls takes precedence. Arrays longer than 10 return 400 too_many_references.Client-supplied key (≤128 chars) to make the request safe to retry. Repeated POSTs with the same
(api_key, idempotency_key) pair return the same job — no duplicate charge, no duplicate generation.Pass-through model-specific parameters (e.g.
seed, style). Forwarded to the underlying provider unchanged.Response
202 Accepted for new jobs, 200 OK if the same idempotency_key is replayed.
Job ID. Use it to poll
GET /v1/jobs/{id}.One of:
pending, processing, succeeded, failed, refunded, expired.Hold amount placed at submit time (USD). Refunded if the job fails.
Final billed amount once the job succeeds.
null until then.Poll for the result
status is succeeded, failed, refunded, or expired. Most images complete within 30 seconds; the runner times out at 5 minutes.
output.url points to a Vercel Blob URL hosted by Kyma — the original upstream URL is rehosted so it remains stable after the upstream TTL expires.
Errors
| Status | error.code | When |
|---|---|---|
400 | invalid_model | Model is not a supported image model |
400 | invalid_prompt | Missing prompt or > 4000 chars |
400 | image_url_required | flux-kontext-pro called without image_url or image_urls |
400 | too_many_references | image_urls array contains more than 10 entries |
401 | auth_error | Missing or invalid API key |
402 | insufficient_balance | Hold could not be placed |
413 | invalid_request | Request body > 25 MB |
429 | rate_limited | Tier limit exceeded |
500 | db_error / provider_error | Internal failure — hold is fully refunded |
status becomes failed or refunded, no charge is made and the held funds are returned to your balance via a hold_release ledger entry.
Examples
Cinematic hero shot
Image edit with kontext
Multi-reference blend with FLUX.2 Pro
Native vector (SVG) output
output.url returns an SVG file (Content-Type: image/svg+xml) with editable paths and layers — open directly in Figma or Illustrator.