Skip to main content
POST
Generate images
Send multipart/form-data with a prompt and, optionally, reference images. The request is asynchronous: it answers immediately with a queued Image object whose ID starts with img_, and you poll Get Image until status is ready or failed. Without reference images this is text-to-image; with at least one, the model is guided by them.
Pricing (1 credit = 0.01):∗∗1credit(0.01): **1 credit (0.01) per image** at 1K, 2 credits ($0.02) per image at 2K. A job costs n × the per-image price — for example, 2K with n=3 is 6 credits. The whole amount is reserved when the job is created and refunded in full if it fails. aspect_ratio, seed, and reference images don’t affect price. See Pricing and retention.

Request parameters

Send multipart/form-data. Up to 8 reference images in total, as any mix of reference_image and reference_image_url. The model receives the uploaded files first, then the URLs, each in the order you sent them. Supplying any reference image moves 2K to a smaller size — see the next section.

Reference image limits

  • Up to 24 MiB each, with a long-to-short side ratio of at most 8.
  • JPEG, PNG, WebP, GIF, BMP, TIFF, or HEIC.
  • An image with a long side of 3840 px or more, or a short side of 2160 px or more, is first downscaled, keeping its aspect ratio, to fit within 1920 × 1080 (1080 × 1920 for a portrait image).
  • A reference_image_url must be publicly reachable; it is downloaded while the create request is being processed.

Output sizes

aspect_ratio and resolution together select one of the model’s fixed sizes — you get exactly the size listed. Width × height, in pixels: 1K is the same with or without reference images. 2K is about 2048² pixels of area for text-to-image and about 1536² with reference images; the price is the same either way. Each image’s width and height in the response are its actual size.

Response parameters

Returns 200 OK with an Image object in queued state — the same shape Get Image returns. progress is 0, images is empty, and completed_at and error are null.

Common errors

HTTP errors use the standard envelope — {"error": {"code", "message", "retryable", "request_id", "details", "remediation"}}. See Errors and recovery. A job that is accepted and later fails reports its failure in the Image object’s error field instead — see Get Image.
Send your own User-Agent header. Python urllib’s default User-Agent has been observed to be blocked in front of apis.viggle.ai, which answers with a non-JSON error page instead of an API error.The body must be multipart/form-data, even without reference images — an application/x-www-form-urlencoded body gets 400. With Python requests, pass the fields through files= (as below), not data= alone.

Examples

With reference images

Uploads and URLs can be mixed, and both fields can be repeated:

@viggle/sdk

Requires an @viggle/sdk version that includes the images resource.

Next step

Use Get Image with the returned id to poll for the result.

Quick Start: Viggle Image

Follow the complete create, poll, and download flow.

Get Image

Read the job’s status, image URLs, sizes, and seeds.

Authorizations

Authorization
string
header
required

Server-side SDK clients use a project API key. Remote MCP clients use an OAuth access token. Never expose a project API key in browser code.

Headers

X-Request-Id
string

Optional caller-supplied correlation ID, up to 128 characters. The service returns the effective value in the response header for tracing and support.

Required string length: 1 - 128
X-Viggle-Source
string

Optional source-channel label, up to 128 characters, used to attribute traffic to an SDK, integration, product surface, or internal workflow.

Required string length: 1 - 128

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:qwen

Image model. Only qwen is available.

Available options:
qwen
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 used for generation; currently always qwen.

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).