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

# Create image generation

> Generate images from text prompts with configurable size, quality, and output format

## Models you can use

| Model ID      | Notes                                                     |
| ------------- | --------------------------------------------------------- |
| `gpt-image-2` | GPT Image 2 — flexible sizing and multiple output formats |

> Snapshot versions (e.g. `gpt-image-2-2026-04-21`) are currently unavailable. Please use `gpt-image-2`.

## Size options (`gpt-image-2`)

The `size` parameter defaults to `auto` and supports flexible dimensions:

* Maximum edge length: `3840px`
* Both width and height must be multiples of `16`
* Aspect ratio (long side to short side) must not exceed `3:1`
* Total pixel count between `655,360` and `8,294,400`

Common presets: `1024x1024`, `1536x1024` (landscape), `1024x1536` (portrait),
`2048x2048`, `2048x1152`, `3840x2160`, `2160x3840`.

Custom sizes are also supported (e.g. `1024x768`), as long as both dimensions
are multiples of 16 and satisfy the constraints above.

## Streaming

Streaming is not currently supported. The `stream` and `partial_images`
parameters are accepted but have no effect — the response is always
returned as a complete JSON payload.

## Quality and format

* `quality`: Quality tiers are not currently supported; all requests
  use the `auto` level. The parameter is accepted but has no observable
  difference between levels.
* `output_format`: `png` (default) / `jpeg` / `webp`
* `output_compression`: applies to `jpeg` / `webp` only, range `0`–`100`


## OpenAPI

````yaml /openapi/images.en.yaml post /v1/images/generations
openapi: 3.1.0
info:
  title: InfinityBlue API — Images
  version: 1.0.0
  summary: Image generation and editing endpoints
  description: >
    InfinityBlue image endpoints support both the OpenAI native format and the

    NanoBanana (Gemini native) format, covering text-to-image generation,

    image editing, and multi-reference image fusion.


    ## Authentication


    Every request must include your API key in the header:


    ```

    Authorization: Bearer YOUR_API_KEY

    ```


    Create and manage your API keys in the
    [console](https://api.getinfinityblue.com/console).


    ## Endpoint format conventions


    | Path prefix | Compatible format |

    | --- | --- |

    | `/v1/images/*` | OpenAI Images API |

    | `/v1/chat/completions` | OpenAI Chat Completions (NanoBanana OpenAI
    format) |

    | `/v1beta/models/{model}:generateContent` | Google Gemini native
    (NanoBanana native format) |
  contact:
    name: InfinityBlue
    url: https://getinfinityblue.com
servers:
  - url: https://api.getinfinityblue.com
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Images
    description: |
      OpenAI-compatible image generation and editing endpoints supporting
      models such as `gpt-image-2`.
  - name: NanoBanana
    description: |
      NanoBanana image generation endpoints available in both Gemini native
      format and OpenAI chat format, supporting text-to-image, multi-reference
      fusion, and style-unification workflows.
paths:
  /v1/images/generations:
    post:
      tags:
        - Images
      summary: Create image generation
      description: |
        Generate an image from a text prompt. Supports the `gpt-image-2` model
        with flexible sizing and multiple output formats.

        Fully compatible with the OpenAI Images API — just point your SDK's
        base URL at InfinityBlue.
      operationId: createImageGeneration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageGenerationRequest'
            examples:
              basic:
                summary: Basic square image
                value:
                  model: gpt-image-2
                  prompt: A cute baby sea otter floating on a blue ocean
                  size: 1024x1024
              landscape:
                summary: Landscape widescreen
                value:
                  model: gpt-image-2
                  prompt: >-
                    Futuristic city at night, neon lights reflecting on
                    rain-soaked streets, cyberpunk style
                  size: 1536x1024
                  output_format: png
              jpeg_compressed:
                summary: JPEG compressed output
                value:
                  model: gpt-image-2
                  prompt: >-
                    A serene Japanese garden with cherry blossoms falling and
                    sunlight through the leaves
                  output_format: jpeg
                  output_compression: 80
                  size: 1024x1024
              portrait:
                summary: Portrait (vertical)
                value:
                  model: gpt-image-2
                  prompt: >-
                    An ancient lighthouse on a cliff edge, waves crashing
                    against rocks, sunset glow
                  size: 1024x1536
                  output_format: png
              webp_output:
                summary: WebP format output
                value:
                  model: gpt-image-2
                  prompt: >-
                    A steaming bowl of Japanese ramen, top-down angle, food
                    photography style
                  size: 1024x1024
                  output_format: webp
                  output_compression: 90
              url_response:
                summary: URL response format
                value:
                  model: gpt-image-2
                  prompt: >-
                    A minimalist red apple icon, flat design style, white
                    background
                  size: 1024x1024
                  response_format: url
      responses:
        '200':
          description: Image generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageGenerationResponse'
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ImageGenerationRequest:
      type: object
      required:
        - model
        - prompt
      description: Image generation request body.
      properties:
        model:
          type: string
          description: >
            Model ID to use for image generation. Pass `gpt-image-2`.

            Snapshot versions (e.g. `gpt-image-2-2026-04-21`) are currently
            unavailable.
          examples:
            - gpt-image-2
        prompt:
          type: string
          description: |
            A text description of the desired image. For `gpt-image-2`,
            the maximum length is 32,000 characters.
          examples:
            - A cute baby sea otter floating on a blue ocean
        'n':
          type: integer
          minimum: 1
          maximum: 1
          default: 1
          description: |
            The `n` parameter is not currently supported. Defaults to `n=1`,
            returning one image per request. To generate multiple images,
            call the endpoint in a loop.
        size:
          type: string
          default: auto
          description: |
            Size of the generated image. For `gpt-image-2`, defaults to `auto`
            with flexible dimensions (max edge 3840px, both dimensions multiples
            of 16, aspect ratio ≤ 3:1, total pixels 655,360–8,294,400).
            Common presets: `1024x1024`, `1536x1024`, `1024x1536`, `2048x2048`,
            `2048x1152`, `3840x2160`, `2160x3840`.
          examples:
            - 1024x1024
            - 1536x1024
            - auto
        background:
          type: string
          description: >
            Background setting for the generated image. For `gpt-image-2`,

            defaults to `auto`; supports `opaque` or `auto`.

            `gpt-image-2` does not support `transparent` — passing it returns a
            400 error.
          enum:
            - opaque
            - transparent
            - auto
        moderation:
          type: string
          description: |
            Content moderation level. For `gpt-image-2`, defaults to `auto`
            (standard); `low` applies a more permissive policy.
          enum:
            - auto
            - low
        quality:
          type: string
          description: |
            Quality tiers are not currently supported; all requests use the
            `auto` level. The parameter is accepted but has no observable
            difference between levels.
          enum:
            - low
            - medium
            - high
            - auto
        stream:
          type: boolean
          default: false
          description: |
            Streaming is not currently supported. The parameter is accepted
            but has no effect — the response is always returned as a complete
            JSON payload.
        style:
          type: string
          description: |
            Image style hint. Only supported by DALL·E 3.
            For `gpt-image-2`, the parameter is accepted but has no effect.
        output_format:
          type: string
          description: |
            Output format of the generated image. For `gpt-image-2`, defaults
            to `png`; options: `png`, `jpeg`, `webp`. Only GPT Image models
            support this parameter.
          enum:
            - png
            - jpeg
            - webp
        output_compression:
          type: integer
          minimum: 0
          maximum: 100
          description: |
            Output compression quality (0–100). For `gpt-image-2`, applies
            only when `output_format` is `jpeg` or `webp`.
        partial_images:
          type: integer
          minimum: 0
          maximum: 3
          default: 0
          description: |
            Number of intermediate partial frames when streaming (0–3).
            Depends on streaming support — since streaming is not currently
            available, this parameter has no effect.
        response_format:
          type: string
          default: b64_json
          description: |
            Format in which the generated image is returned. Defaults to
            `b64_json` (Base64-encoded image data); set to `url` to receive
            a temporary access URL (download or save promptly).
          enum:
            - b64_json
            - url
        user:
          type: string
          description: |
            A unique identifier for your end user, useful for monitoring and
            abuse detection.
    ImageGenerationResponse:
      type: object
      description: Image generation response body.
      properties:
        created:
          type: integer
          description: Unix timestamp (seconds) of creation.
          examples:
            - 1713833628
        data:
          type: array
          description: List of generated images.
          items:
            type: object
            properties:
              b64_json:
                type: string
                description: >-
                  Base64-encoded image data (returned when
                  `response_format=b64_json`).
              url:
                type: string
                description: >-
                  Temporary URL to access the image (returned when
                  `response_format=url`).
        usage:
          $ref: '#/components/schemas/ImageUsage'
    ErrorResponse:
      type: object
      description: Standard error response.
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Error message.
              examples:
                - >-
                  Invalid size. Supported sizes are 1024x1024, 1536x1024,
                  1024x1536.
            type:
              type: string
              description: Error type.
              examples:
                - invalid_request_error
            param:
              type:
                - string
                - 'null'
              description: The parameter related to the error.
              examples:
                - size
            code:
              type:
                - string
                - 'null'
              description: Error code.
              examples:
                - invalid_size
    ImageUsage:
      type: object
      description: Token usage statistics for the request.
      properties:
        total_tokens:
          type: integer
          description: Total tokens consumed.
        input_tokens:
          type: integer
          description: Tokens consumed by the input.
        output_tokens:
          type: integer
          description: Tokens consumed by the output (including image generation tokens).
        input_tokens_details:
          type: object
          description: Breakdown of input token usage.
          properties:
            text_tokens:
              type: integer
              description: Text tokens consumed.
            image_tokens:
              type: integer
              description: Image tokens consumed.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: >
        Bearer token authentication, format: `Authorization: Bearer sk-xxxxxx`.

        Get your API key in the
        [console](https://api.getinfinityblue.com/console).

````