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

# Create image

> Creates an image given a text prompt. Supports streaming responses for real-time generation updates.



## OpenAPI

````yaml /openapi.json post /images/generations
openapi: 3.0.3
info:
  title: AnyAPI API
  description: >-
    Universal API Integration Platform - Connect any API to any API with
    intelligent data transformation and workflow orchestration.
  version: 1.0.0
  contact:
    name: AnyAPI Support
    email: support@anyapi.ai
    url: https://anyapi.ai/support
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: https://api.anyapi.ai/v1
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: Text
    description: Generate text completions
  - name: Images
    description: Generate and manipulate images
  - name: Audio
    description: Generate speech and transcribe audio
  - name: Music
    description: List and retrieve model information
  - name: Video
    description: Create vector embeddings for text
  - name: Vision
    description: Create vector embeddings for text
  - name: 3D Models
    description: Create vector embeddings for text
  - name: Embeddings
    description: Create vector embeddings for text
  - name: Files
    description: Files
  - name: Batches
    description: Batches
  - name: Moderation
    description: Moderation
  - name: Other
    description: Other models
paths:
  /images/generations:
    post:
      tags:
        - Images
      summary: Create image
      description: >-
        Creates an image given a text prompt. Supports streaming responses for
        real-time generation updates.
      operationId: createImageGeneration
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ImageGenerationRequest'
            examples:
              Generation:
                summary: Basic image generation
                value:
                  model: MODEL_EXAMPLE
                  prompt: A cute baby sea otter
                  'n': 1
                  size: 1024x1024
              Streaming:
                summary: Streaming image generation
                value:
                  model: MODEL_EXAMPLE
                  prompt: A cute baby sea otter
                  'n': 1
                  size: 1024x1024
                  stream: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ImageGenerationResponse'
            text/event-stream:
              schema:
                $ref: '#/components/schemas/ImageGenerationStreamResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ImageGenerationRequest:
      type: object
      required:
        - model
        - prompt
      properties:
        model:
          type: string
          description: The model to use for image generation
          example: gpt-image-1
        prompt:
          type: string
          description: A text description of the desired image(s)
          example: A cute baby sea otter
          maxLength: 1000
        'n':
          type: integer
          description: The number of images to generate
          minimum: 1
          maximum: 10
          default: 1
        size:
          type: string
          description: The size of the generated images
          enum:
            - 256x256
            - 512x512
            - 1024x1024
            - 1792x1024
            - 1024x1792
          default: 1024x1024
        stream:
          type: boolean
          description: >-
            If set, generation progress updates will be sent as server-sent
            events
          default: false
        response_format:
          type: string
          description: The format in which the generated images are returned
          enum:
            - url
            - b64_json
          default: url
    ImageGenerationResponse:
      type: object
      required:
        - created
        - data
      properties:
        created:
          type: integer
          description: The Unix timestamp (in seconds) of when the images were generated
        data:
          type: array
          description: Array of generated image objects
          items:
            $ref: '#/components/schemas/ImageObject'
    ImageGenerationStreamResponse:
      type: object
      description: Represents a streamed chunk of an image generation response
      required:
        - id
        - object
        - created
      properties:
        id:
          type: string
          description: A unique identifier for the image generation
        object:
          type: string
          enum:
            - image.generation.chunk
          description: The object type, which is always 'image.generation.chunk'
        created:
          type: integer
          description: >-
            The Unix timestamp (in seconds) of when the image generation was
            created
        progress:
          type: number
          description: The progress of the image generation as a percentage (0-100)
          minimum: 0
          maximum: 100
        status:
          type: string
          enum:
            - pending
            - generating
            - completed
            - failed
          description: The current status of the image generation
        data:
          type: array
          description: Array of generated image objects (only present when completed)
          items:
            $ref: '#/components/schemas/ImageObject'
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            param:
              type: string
            type:
              type: string
          required:
            - message
            - type
      required:
        - error
    ImageObject:
      type: object
      properties:
        url:
          type: string
          format: uri
          description: The URL of the generated image, if response_format is url (default)
        b64_json:
          type: string
          description: >-
            The base64-encoded JSON of the generated image, if response_format
            is b64_json
        revised_prompt:
          type: string
          description: >-
            The prompt that was used to generate the image, if there was any
            revision to the prompt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token authentication. Get your API key from the dashboard.

````