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

# Create an AI image generation job



## OpenAPI

````yaml /api/openapi.yaml post /v1/image-generations
openapi: 3.1.0
info:
  title: AdSkull Public API
  version: 1.0.0
  summary: Public API for AdSkull creative generation.
  description: >
    Create AI ad assets, images, videos, voiceovers, custom voices, and talking
    avatars.

    Responses expose AdSkull product resources.
servers:
  - url: https://api.adskull.io
security:
  - bearerAuth: []
tags:
  - name: Account
  - name: Models
  - name: Assets
  - name: Images
  - name: Videos
  - name: Voices
  - name: Talking Avatars
  - name: Webhooks
  - name: LLM
  - name: LLM OpenAI Compat
  - name: LLM Anthropic Compat
paths:
  /v1/image-generations:
    post:
      tags:
        - Images
      summary: Create an AI image generation job
      operationId: createImageGeneration
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateImageGenerationRequest'
      responses:
        '202':
          description: Image generation accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerationJob'
        '400':
          $ref: '#/components/responses/InvalidRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/InsufficientCredits'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '422':
          $ref: '#/components/responses/ContentPolicyViolation'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - bearerAuth:
            - images:write
components:
  parameters:
    IdempotencyKey:
      in: header
      name: Idempotency-Key
      required: true
      schema:
        type: string
        minLength: 8
        maxLength: 128
      description: Unique key for safe retries of job creation requests.
  schemas:
    CreateImageGenerationRequest:
      type: object
      required:
        - prompt
        - model_id
      description: |
        Image generation request. Each model has its own accepted set of
        `quality` and `ratio` values — see GET /v1/models/{model_id} for
        the authoritative matrix.

        Orientation cheatsheet:
          • 9:16 → vertical / portrait (TikTok, Reels, Shorts, Stories)
          • 16:9 → horizontal / landscape (YouTube, web hero)
          • 1:1  → square (Instagram feed)
      properties:
        prompt:
          type: string
          minLength: 1
          maxLength: 4096
          description: Text prompt describing the image.
        model_id:
          type: string
          enum:
            - nano-banana-pro
            - nano-banana-2
            - nano-banana-2-lite
            - flux-2-pro
            - flux-2
            - seedream-4-5
            - seedream-5-lite
            - wan-2-7-pro
            - wan-2-7
            - ideogram-v3
            - grok-imagine
            - qwen2
            - gpt-image-2
            - gpt-image-1-5
            - z-image
          description: >
            Image model. Per-model qualities:

            • nano-banana-pro / nano-banana-2 → 1K | 2K | 4K

            • flux-2-pro / flux-2             → 1K | 2K

            • ideogram-v3                     → TURBO | BALANCED | QUALITY

            • grok-imagine                    → STANDARD | QUALITY

            • seedream-5-lite                 → basic | high

            • gpt-image-2                     → 1K | 2K | 4K

            • gpt-image-1-5                   → medium | high

            • nano-banana-2-lite, seedream-4-5, wan-2-7-pro, wan-2-7, qwen2,
            z-image → default
        quality:
          type: string
          description: >-
            Model-specific quality. See model_id description for accepted
            values.
          example: 1K
        ratio:
          type: string
          enum:
            - '1:1'
            - '1:4'
            - '1:8'
            - '2:3'
            - '3:2'
            - '3:4'
            - '4:1'
            - '4:3'
            - '4:5'
            - '5:4'
            - '8:1'
            - '9:16'
            - '16:9'
            - '21:9'
          description: |
            Aspect ratio, validated PER MODEL: any ratio the model advertises
            in GET /v1/models/{model_id} is accepted (e.g. 4:5 on the
            nano-banana models). Unsupported ratios return 400 with the
            accepted list in the error message. Omit to use the model's
            default ratio.
          default: '1:1'
          example: '9:16'
        reference_image_url:
          type: string
          format: uri
          description: |
            One hosted reference image URL. SSRF-checked. Upload local files
            via POST /v1/assets first.
        reference_image_urls:
          type: array
          deprecated: true
          description: |
            Compatibility alias for `reference_image_url`. The backend uses
            only the FIRST URL in the array. Prefer the singular form.
          items:
            type: string
            format: uri
        count:
          type: integer
          minimum: 1
          maximum: 4
          default: 1
          description: |
            Number of images to generate. grok-imagine ignores this and
            always returns 2–6 images per run.
        negative_prompt:
          type: string
          maxLength: 1024
          description: Optional content to avoid.
    GenerationJob:
      type: object
      required:
        - id
        - object
        - status
        - credits_reserved
        - created_at
        - assets
      properties:
        id:
          type: string
        object:
          type: string
          enum:
            - image_generation_job
            - video_generation_job
            - talking_avatar_job
        status:
          type: string
          enum:
            - queued
            - processing
            - completed
            - failed
            - canceled
        progress_percent:
          type: integer
          minimum: 0
          maximum: 100
          nullable: true
        credits_reserved:
          type: integer
        credits_used:
          type: integer
          nullable: true
        credits_refunded:
          type: integer
          default: 0
        request:
          type: object
          additionalProperties: true
        assets:
          type: array
          items:
            $ref: '#/components/schemas/Asset'
        failure_code:
          type: string
          nullable: true
        failure_message:
          type: string
          nullable: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
          nullable: true
        completed_at:
          type: string
          format: date-time
          nullable: true
        failed_at:
          type: string
          format: date-time
          nullable: true
    Asset:
      type: object
      required:
        - id
        - object
        - type
        - url
        - mime_type
      properties:
        id:
          type: string
        object:
          type: string
          const: asset
        type:
          type: string
          enum:
            - image
            - audio
            - video
        url:
          type: string
          format: uri
        mime_type:
          type: string
        size_bytes:
          type: integer
        duration_seconds:
          type: number
          nullable: true
        width:
          type: integer
          nullable: true
        height:
          type: integer
          nullable: true
        expires_at:
          type: string
          format: date-time
          nullable: true
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
            - request_id
          properties:
            code:
              type: string
            message:
              type: string
            request_id:
              type: string
            details:
              type: object
              additionalProperties: true
  responses:
    InvalidRequest:
      description: Invalid request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    InsufficientCredits:
      description: Not enough credits.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Forbidden:
      description: Missing scope, plan, or resource access.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    Conflict:
      description: Idempotency or concurrency conflict.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    ContentPolicyViolation:
      description: Input content is not allowed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimited:
      description: Rate limit exceeded.
      headers:
        Retry-After:
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API key

````