DeepInfra Image Generation API

Generate, edit, and create variations of images.

Operations 4

POST /v1/images/generations Openai Images Generations #
POST /v1/images/variations Openai Images Variations #
POST /v1/images/edits Openai Images Edits #
GET /v1/images/{image_id} Get Generated Image #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/deepinfra:deepinfra-image-generation-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

deepinfra-image-generation-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: DeepInfra Image Generation 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
tags:
- name: Image Generation
  description: Generate, edit, and create variations of images.
paths:
  /v1/images/generations:
    post:
      tags:
      - Image Generation
      summary: Openai Images Generations
      description: Generate image using OpenAI Images API
      operationId: openai_images_generations_v1_images_generations_post
      security:
      - HTTPBearer: []
      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:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenAIImagesGenerationsIn'
      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'
  /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
      security:
      - HTTPBearer: []
      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'
  /v1/images/edits:
    post:
      tags:
      - Image Generation
      summary: Openai Images Edits
      description: Edit image using OpenAI Images Edits API
      operationId: openai_images_edits_v1_images_edits_post
      security:
      - HTTPBearer: []
      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_edits_v1_images_edits_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'
  /v1/images/{image_id}:
    get:
      tags:
      - Image Generation
      summary: Get Generated Image
      description: Serve a `response_format=url` image; unauthenticated, 404 once expired.
      operationId: get_generated_image_v1_images__image_id__get
      parameters:
      - name: image_id
        in: path
        required: true
        schema:
          type: string
          title: Image Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    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
    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
      - url
      title: OpenAIImagesResponseFormat
    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
    OpenAIImagesVariationsIn:
      properties:
        model:
          type: string
          title: Model
          description: The model to use.
        n:
          type: integer
          maximum: 4.0
          minimum: 1.0
          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: ''b64_json'' (default) or ''url''. For most models ''url'' points to a temporary copy we host that expires after about a day; for some provider-backed models it is the provider''s own URL with the provider''s own lifetime.'
          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
    OpenAIImagesGenerationsIn:
      properties:
        model:
          type: string
          title: Model
          description: The model to use for image generation.
          examples:
          - black-forest-labs/FLUX-1-schnell
        n:
          type: integer
          maximum: 4.0
          minimum: 1.0
          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: ''b64_json'' (default) or ''url''. For most models ''url'' points to a temporary copy we host that expires after about a day; for some provider-backed models it is the provider''s own URL with the provider''s own lifetime.'
          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.
        prompt:
          type: string
          title: Prompt
          description: A text description of desired image(s).
          examples:
          - A photo of an astronaut riding a horse on Mars.
        quality:
          anyOf:
          - type: string
          - type: 'null'
          title: Quality
          description: The quality of the image that will be generated.
        style:
          anyOf:
          - type: string
          - type: 'null'
          title: Style
          description: The style of the generated images.
      type: object
      required:
      - model
      - prompt
      title: OpenAIImagesGenerationsIn
    Body_openai_images_edits_v1_images_edits_post:
      properties:
        image:
          type: string
          format: binary
          title: Image
        inp:
          anyOf:
          - $ref: '#/components/schemas/OpenAIImagesEditsIn'
          - type: 'null'
        prompt:
          type: string
          title: Prompt
        model:
          type: string
          title: Model
        response_format:
          anyOf:
          - $ref: '#/components/schemas/OpenAIImagesResponseFormat'
          - type: 'null'
      type: object
      required:
      - image
      - prompt
      - model
      title: Body_openai_images_edits_v1_images_edits_post
    OpenAIImagesEditsIn:
      properties:
        model:
          type: string
          title: Model
          description: The model to use.
        n:
          type: integer
          maximum: 4.0
          minimum: 1.0
          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: ''b64_json'' (default) or ''url''. For most models ''url'' points to a temporary copy we host that expires after about a day; for some provider-backed models it is the provider''s own URL with the provider''s own lifetime.'
          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 editing task
          is_image: true
        prompt:
          type: string
          title: Prompt
          description: A text description of the desired image edits.
          examples:
          - Add a hat to the cat
        mask:
          anyOf:
          - type: string
            format: binary
          - type: 'null'
          title: Mask
          description: An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where image should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as image.
          is_image: true
      type: object
      required:
      - model
      - image
      - prompt
      title: OpenAIImagesEditsIn
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
        response_format:
          anyOf:
          - $ref: '#/components/schemas/OpenAIImagesResponseFormat'
          - type: 'null'
      type: object
      required:
      - image
      - model
      title: Body_openai_images_variations_v1_images_variations_post
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer