> ## Documentation Index
> Fetch the complete documentation index at: https://docs.viggle.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate images

> Starts an asynchronous generation of `n` PNG images (1–6) from
`prompt`, optionally guided by up to 8
reference images. `aspect_ratio` and `resolution` select the output
size (see `CreateImageForm`). Answers `200` with the queued `Image`;
poll `GET /v1/images/{image_id}` until it is `ready` or `failed`.

Each image costs 1 credit at `1K` and 2 credits at `2K`. The whole
job (`n` × the per-image price) is reserved when it is created —
`402` when the balance cannot cover it — and refunded in full if
the job fails. A `400` creates no job and uploads no file. `429
RATE_LIMITED` means the credit-reservation gate is busy; retry with
backoff.




## OpenAPI

````yaml /openapi.yaml post /v1/images
openapi: 3.0.3
info:
  title: Viggle API
  description: >
    The Viggle API generates AI video (Viggle H3, Viggle Remake, Video

    Remix), images (Viggle Image), 2x video upscaling (FlashVSR), and JST-2

    3D characters, motions, and scenes. Every job is asynchronous: create it,

    then poll (or, for renders, watch) until it reaches a terminal status.


    Base URL: `https://apis.viggle.ai`. Authenticate every request with

    `Authorization: Bearer <API key>`. Usage is billed in credits

    (1 credit = $0.01). Guides and pricing:
    https://docs.viggle.ai/v1/introduction
  version: 2.0.0
  contact:
    name: Viggle Support
    url: https://viggle.ai
servers:
  - url: https://apis.viggle.ai
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Renders
    description: >-
      Video Remix (JST-1). Prepare inputs, create renders, watch progress,
      cancel, and download results. Read render status through `GET
      /v1/videos/{video_id}`.
  - name: Credits
    description: Read the credit balance available to the calling API key.
  - name: Characters
    description: |
      Create, list, inspect, and delete reusable character assets. `type`
      selects whether creation also extracts a 3D vsplat; export its
      download URL separately once ready.
  - name: Motions
    description: |
      Create, list, inspect, and delete reusable motion assets, and import one
      from an official motion template. `type` selects whether creation also
      extracts or generates a 3D animation; export its download URL
      separately once ready.
  - name: Videos
    description: |
      Generate a Viggle H3 video from text, frames, or references (`vid_`
      prefix) or a Viggle Remake video from a driving video and character
      images (`anim_` prefix), upscale a video 2x with FlashVSR (`vsr_`
      prefix), and read the unified view over every video the calling API
      key created — H3 generations, Remake generations, and Video Remix
      renders (`render_` prefix) — merged into one resource.
  - name: Images
    description: |
      Viggle Image — generate 1–6 PNG images from a text prompt,
      optionally guided by up to 8 reference images
      (`img_` prefix), and retrieve them by ID.
  - name: Scenes
    description: |
      Scene model — build a 3D Gaussian-splat scene (`.spz`) from a text
      prompt or a 360° panorama, generate new posed views of it, and
      reconstruct it from those views. Every operation is an asynchronous
      task (`scn_` prefix) read back by ID. Every run costs 1 credit per
      view, and a panorama counts as 6 views. Credits are refunded in full
      unless the task finishes `ready`.
paths:
  /v1/images:
    post:
      tags:
        - Images
      summary: Generate images
      description: |
        Starts an asynchronous generation of `n` PNG images (1–6) from
        `prompt`, optionally guided by up to 8
        reference images. `aspect_ratio` and `resolution` select the output
        size (see `CreateImageForm`). Answers `200` with the queued `Image`;
        poll `GET /v1/images/{image_id}` until it is `ready` or `failed`.

        Each image costs 1 credit at `1K` and 2 credits at `2K`. The whole
        job (`n` × the per-image price) is reserved when it is created —
        `402` when the balance cannot cover it — and refunded in full if
        the job fails. A `400` creates no job and uploads no file. `429
        RATE_LIMITED` means the credit-reservation gate is busy; retry with
        backoff.
      operationId: createImage
      parameters:
        - $ref: '#/components/parameters/RequestId'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CreateImageForm'
      responses:
        '200':
          description: Image generation accepted and queued.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Image'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/V1Unauthorized'
        '402':
          $ref: '#/components/responses/PaymentRequired'
        '408':
          $ref: '#/components/responses/UploadTimeout'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalServerError'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
components:
  parameters:
    RequestId:
      name: X-Request-Id
      in: header
      required: false
      description: >-
        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.
      schema:
        type: string
        minLength: 1
  schemas:
    CreateImageForm:
      description: |
        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:

        | aspect_ratio | 1K | 2K | 2K with reference images |
        | --- | --- | --- | --- |
        | 1:1 | 1024×1024 | 2048×2048 | 1536×1536 |
        | 16:9 | 1376×768 | 2720×1536 | 2048×1152 |
        | 9:16 | 768×1376 | 1536×2720 | 1152×2048 |
        | 4:3 | 1184×896 | 2368×1760 | 1760×1344 |
        | 3:4 | 896×1184 | 1760×2368 | 1344×1760 |
        | 3:2 | 1248×832 | 2496×1664 | 1888×1248 |
        | 2:3 | 832×1248 | 1664×2496 | 1248×1888 |

        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.
      type: object
      required:
        - prompt
      properties:
        prompt:
          type: string
          minLength: 1
          maxLength: 4000
          description: >-
            Text description of the images. Up to 4000 characters, counted as
            Unicode code points (one CJK character counts as one). Must not be
            blank.
        model:
          type: string
          enum:
            - viggle-image
          default: viggle-image
          description: Image model. Omit it or send `viggle-image`.
        aspect_ratio:
          type: string
          enum:
            - '1:1'
            - '16:9'
            - '9:16'
            - '4:3'
            - '3:4'
            - '3:2'
            - '2:3'
          default: '1:1'
          description: >-
            Output aspect ratio. Together with `resolution`, it selects the
            exact output size.
        resolution:
          type: string
          enum:
            - 1K
            - 2K
          default: 1K
          description: >-
            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².
        'n':
          type: integer
          minimum: 1
          maximum: 6
          default: 1
          description: >-
            Number of images to generate. The job reserves `n` × the per-image
            price.
        seed:
          type: integer
          format: int64
          minimum: 0
          maximum: 2147483647
          description: |
            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.
        reference_image:
          type: array
          maxItems: 8
          items:
            type: string
            format: binary
          description: >-
            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`.
        reference_image_url:
          type: array
          maxItems: 8
          items:
            type: string
            format: uri
          description: >-
            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.
    Image:
      description: |
        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.
      type: object
      additionalProperties: false
      required:
        - id
        - status
        - model
        - progress
        - images
        - created_at
        - completed_at
        - error
      properties:
        id:
          type: string
          minLength: 1
          description: Public image job ID, `img_` prefix.
        status:
          type: string
          enum:
            - queued
            - processing
            - ready
            - failed
          description: Lifecycle state. `ready` and `failed` are terminal.
        model:
          type: string
          description: Model that ran the job, `viggle-image`.
        progress:
          type: integer
          nullable: true
          minimum: 0
          maximum: 100
          description: >-
            Share of the requested images generated so far — `0` while queued,
            0–99 while processing, `100` when ready, null when failed.
        images:
          type: array
          description: Empty until `ready`, then all `n` generated images in request order.
          items:
            $ref: '#/components/schemas/GeneratedImage'
        created_at:
          type: string
          format: date-time
          nullable: true
          description: Creation timestamp, RFC 3339.
        completed_at:
          type: string
          format: date-time
          nullable: true
          description: >-
            Terminal-state timestamp; set once the job is `ready` or `failed`,
            null before that.
        error:
          type: object
          nullable: true
          description: |
            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).
          allOf:
            - $ref: '#/components/schemas/ErrorBody'
    GeneratedImage:
      type: object
      additionalProperties: false
      required:
        - url
        - width
        - height
        - seed
      properties:
        url:
          type: string
          format: uri
          nullable: true
          description: >-
            Signed download URL of the PNG, valid for 1 hour; fetch the job
            again for a fresh one. Null once the file has been deleted, 24 hours
            after the job finished.
        width:
          type: integer
          minimum: 1
          description: Actual width in pixels.
        height:
          type: integer
          minimum: 1
          description: Actual height in pixels.
        seed:
          type: integer
          format: int64
          minimum: 0
          description: Seed actually used for this image.
    ErrorBody:
      type: object
      additionalProperties: false
      required:
        - code
        - message
        - retryable
        - request_id
        - details
        - remediation
      properties:
        code:
          description: >-
            Stable, machine-readable error code. Use it for programmatic
            handling instead of parsing `message`.
          allOf:
            - $ref: '#/components/schemas/ErrorCode'
        message:
          type: string
          description: >-
            Human-readable explanation suitable for logs or presentation to a
            developer.
        retryable:
          type: boolean
          description: >-
            Whether retrying the operation without changing its input may
            succeed. True for HTTP 408, 429, and 5xx responses.
        request_id:
          type: string
          description: >-
            Correlation identifier for tracing and support. Include it when
            reporting the failure.
        details:
          type: object
          description: Error-specific structured context; available keys depend on `code`.
          additionalProperties: true
        remediation:
          description: Suggested recovery action and optional retry delay.
          allOf:
            - $ref: '#/components/schemas/ErrorRemediation'
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - error
      properties:
        error:
          description: >-
            Error payload containing the stable code, message, retry guidance,
            correlation ID, and error-specific details.
          allOf:
            - $ref: '#/components/schemas/ErrorBody'
    ErrorCode:
      description: |
        Error codes the API emits, in the synchronous error envelope and in
        the `error` object of a failed job. Clients should tolerate codes not
        listed here. Asynchronous failures that have no public mapping
        surface as `PROCESSING_FAILED`.
      type: string
      enum:
        - INVALID_REQUEST
        - UNAUTHENTICATED
        - INVALID_CREDENTIAL
        - INSUFFICIENT_CREDITS
        - RENDER_NOT_FOUND
        - CHARACTER_NOT_FOUND
        - MOTION_NOT_FOUND
        - DRAFT_NOT_FOUND
        - NOT_FOUND
        - RESULT_EXPIRED
        - IDEMPOTENCY_KEY_REUSED
        - ID_ALREADY_EXISTS
        - UPLOAD_TIMEOUT
        - CONTENT_POLICY_VIOLATION
        - RATE_LIMITED
        - SERVICE_BUSY
        - INTERNAL_ERROR
        - IMAGE_REQUIRED
        - MOTION_VIDEO_REQUIRED
        - UNSUPPORTED_MEDIA
        - VIDEO_TOO_LONG
        - VIDEO_TOO_LARGE
        - VIDEO_RESOLUTION_TOO_HIGH
        - VIDEO_UNREADABLE
        - VIDEO_DIMENSIONS_MUST_BE_EVEN
        - VIDEO_INACCESSIBLE
        - NO_HUMANS_DETECTED
        - MOTION_NOT_READY
        - MOTION_MODEL_MISMATCH
        - INVALID_BACKGROUND_MODE
        - ALL_WORKERS_BUSY
        - WORKER_STOPPED
        - TASK_FAILED
        - PROCESSING_FAILED
    ErrorRemediation:
      type: object
      additionalProperties: false
      required:
        - action
        - retry_after_ms
      properties:
        action:
          type: string
          enum:
            - none
            - retry
          description: >-
            Suggested next action. Synchronous errors always carry `none`; a
            failed job's `error` carries `retry` when the failure is retryable.
        retry_after_ms:
          type: integer
          description: >-
            Recommended delay in milliseconds before retrying; null when no
            timed retry is advised.
          nullable: true
          format: int64
          minimum: 0
  headers:
    RequestId:
      description: Stable request identifier for support and tracing.
      schema:
        type: string
  responses:
    BadRequest:
      description: Invalid request.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    V1Unauthorized:
      description: Missing or invalid API key. Code `UNAUTHENTICATED`.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    PaymentRequired:
      description: Insufficient credits.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UploadTimeout:
      description: >-
        A multipart upload did not finish arriving within the 10-minute read
        deadline. Code `UPLOAD_TIMEOUT`, retryable: retry, or pass a URL instead
        of the file.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    RateLimited:
      description: |
        The credit-reservation gate is busy (code `RATE_LIMITED`, retryable).
        There is no per-account rate limit; this appears only on Viggle
        Remake, image, and scene creation. Retry with backoff.
      headers:
        Retry-After:
          schema:
            type: integer
            minimum: 0
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Unexpected server error.
      headers:
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ServiceUnavailable:
      description: Service temporarily unavailable.
      headers:
        Retry-After:
          schema:
            type: integer
            minimum: 0
        X-Request-Id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key
      description: |
        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.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.