Skip to main content
POST
Generate images

Authorizations

Authorization
string
header
required

Send your API key as Authorization: Bearer <API key>. Keys begin with sk-. A missing or invalid key answers 401 UNAUTHENTICATED. Never expose an API key in browser code.

Headers

X-Request-Id
string

Optional caller-supplied correlation ID, echoed as sent in the response header. Omit it and the service generates one. Use it for tracing and support.

Minimum string length: 1

Body

multipart/form-data

Body of POST /v1/images, multipart/form-data only. Text-to-image when no reference image is supplied, reference-guided generation when at least one is. aspect_ratio and resolution select one of the model's fixed output sizes (width × height, in pixels); with reference images, 2K is a smaller size than without:

Up to 8 reference images in total, as any mix of reference_image uploads and reference_image_url URLs. The model receives the uploads first, then the URLs, each in the order sent.

prompt
string
required

Text description of the images. Up to 4000 characters, counted as Unicode code points (one CJK character counts as one). Must not be blank.

Required string length: 1 - 4000
model
enum<string>
default:viggle-image

Image model. Omit it or send viggle-image.

Available options:
viggle-image
aspect_ratio
enum<string>
default:1:1

Output aspect ratio. Together with resolution, it selects the exact output size.

Available options:
1:1,
16:9,
9:16,
4:3,
3:4,
3:2,
2:3
resolution
enum<string>
default:1K

Output size tier, case-insensitive, and the price of each image — 1 credit at 1K, 2 credits at 2K. With any reference image, 2K is about 1536² pixels instead of about 2048².

Available options:
1K,
2K
n
integer
default:1

Number of images to generate. The job reserves n × the per-image price.

Required range: 1 <= x <= 6
seed
integer<int64>

Image i (counting from 0) is generated with seed (seed + i) mod 2147483648. Omitted, the server picks a random seed; each image reports the seed it used.

Required range: 0 <= x <= 2147483647
reference_image
file[]

Reference image upload; repeat the field for more than one. Each up to 24 MiB, with a long-to-short side ratio of at most 8; JPEG, PNG, WebP, GIF, BMP, TIFF, or HEIC. Counts toward the 8-image total shared with reference_image_url.

Maximum array length: 8
reference_image_url
string<uri>[]

Publicly reachable http(s) reference image URL, downloaded while the create request is processed; repeat the field for more than one. Same limits as reference_image, and counts toward the same 8-image total.

Maximum array length: 8

Response

Image generation accepted and queued.

An image generation job (img_ prefix), returned by both POST /v1/images and GET /v1/images/{image_id}. It only moves forward — queued → processing → ready or failed — and is never cancelled. images stays empty until the job is ready, then lists every generated image in request order. A job either produces all n images or fails; it never returns a partial set.

id
string
required

Public image job ID, img_ prefix.

Minimum string length: 1
status
enum<string>
required

Lifecycle state. ready and failed are terminal.

Available options:
queued,
processing,
ready,
failed
model
string
required

Model that ran the job, viggle-image.

progress
integer | null
required

Share of the requested images generated so far — 0 while queued, 0–99 while processing, 100 when ready, null when failed.

Required range: 0 <= x <= 100
images
object[]
required

Empty until ready, then all n generated images in request order.

created_at
string<date-time> | null
required

Creation timestamp, RFC 3339.

completed_at
string<date-time> | null
required

Terminal-state timestamp; set once the job is ready or failed, null before that.

error
object | null
required

Failure details, only when status is failed; otherwise null. code is SERVICE_BUSY (retryable — the generation service is busy or unavailable, or the job did not finish within 15 minutes), TASK_FAILED (retryable — any other generation or upload failure), or INVALID_REQUEST (not retryable — the model rejected the request, for example an unusable reference image).