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

# Openai Images Variations

> Generate a similar image using OpenAI Images Variations API



## OpenAPI

````yaml https://api.deepinfra.com/openapi.json post /v1/images/variations
openapi: 3.1.0
info:
  title: DeepInfra API
  description: >-
    The DeepInfra API provides serverless AI inference, custom model
    deployments, and GPU rentals.
  version: 1.0.0
servers:
  - url: https://api.deepinfra.com
security: []
tags:
  - name: Chat Completions
    description: OpenAI and Anthropic-compatible chat completion endpoints for LLMs.
  - name: Text Completions
    description: OpenAI-compatible text completion endpoints.
  - name: Embeddings
    description: Generate text embeddings for search and RAG.
  - name: Image Generation
    description: Generate, edit, and create variations of images.
  - name: Audio
    description: OpenAI-compatible speech synthesis, transcription, and translation.
  - name: Text to Speech
    description: ElevenLabs-compatible TTS endpoints and voice management.
  - name: Inference
    description: Native DeepInfra inference API for models and deployments.
  - name: Dedicated Models
    description: Deploy and manage private model instances with autoscaling.
  - name: GPU Rentals
    description: Rent dedicated GPU containers.
  - name: Models
    description: Browse, search, and manage AI models.
  - name: Files & Batches
    description: File uploads and batch processing.
  - name: LoRA Adapters
    description: Create, manage, and query LoRA adapter models.
  - name: Agents
    description: Manage agent-framework instances (OpenClaw and friends).
  - name: Sandboxes
    description: Create and manage isolated sandbox environments.
  - name: Account
    description: User profile, team management, and rate limits.
  - name: Authentication
    description: API tokens, SSH keys, scoped JWTs, and login flows.
  - name: Billing
    description: Payment methods, usage tracking, and billing.
  - name: Logs & Metrics
    description: Query inference logs, deployment logs, and usage metrics.
  - name: Utilities
    description: Feedback submission and CLI version.
paths:
  /v1/images/variations:
    post:
      tags:
        - Image Generation
      summary: Openai Images Variations
      description: Generate a similar image using OpenAI Images Variations API
      operationId: openai_images_variations_v1_images_variations_post
      parameters:
        - name: xi-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Xi-Api-Key
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: >-
                #/components/schemas/Body_openai_images_variations_v1_images_variations_post
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIImagesOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    Body_openai_images_variations_v1_images_variations_post:
      properties:
        image:
          type: string
          format: binary
          title: Image
        inp:
          anyOf:
            - $ref: '#/components/schemas/OpenAIImagesVariationsIn'
            - type: 'null'
        model:
          type: string
          title: Model
      type: object
      required:
        - image
        - model
      title: Body_openai_images_variations_v1_images_variations_post
    OpenAIImagesOut:
      properties:
        created:
          type: integer
          title: Created
          description: Unix timestamp of when the images were created
        data:
          items:
            $ref: '#/components/schemas/OpenAIImageData'
          type: array
          title: Data
          description: List of generated images
      type: object
      required:
        - data
      title: OpenAIImagesOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    OpenAIImagesVariationsIn:
      properties:
        model:
          type: string
          title: Model
          description: The model to use.
        'n':
          type: integer
          maximum: 4
          minimum: 1
          title: 'N'
          description: The number of images to generate.
          default: 1
        response_format:
          anyOf:
            - $ref: '#/components/schemas/OpenAIImagesResponseFormat'
            - type: 'null'
          description: >-
            The format in which the generated images are returned. Currently
            only b64_json is supported.
          default: b64_json
        size:
          type: string
          title: Size
          description: >-
            The size of the generated images. Available sizes depend on the
            model.
          default: 1024x1024
        user:
          anyOf:
            - type: string
            - type: 'null'
          title: User
          description: >-
            A unique identifier representing your end-user, which can help to
            monitor and detect abuse.
        image:
          type: string
          format: binary
          title: Image
          description: Input image bytes for variation task
          is_image: true
      type: object
      required:
        - model
        - image
      title: OpenAIImagesVariationsIn
    OpenAIImageData:
      properties:
        b64_json:
          anyOf:
            - type: string
            - type: 'null'
          title: B64 Json
          description: The base64-encoded image data
        revised_prompt:
          anyOf:
            - type: string
            - type: 'null'
          title: Revised Prompt
          description: The prompt used to generate this image
        url:
          anyOf:
            - type: string
            - type: 'null'
          title: Url
          description: The URL of the generated image
      type: object
      title: OpenAIImageData
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    OpenAIImagesResponseFormat:
      type: string
      enum:
        - b64_json
      title: OpenAIImagesResponseFormat
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````