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

# Visualize Image

> Answer a prompt based on the content of an image.

### Description

This endpoint returns a response based on the content of an image and a base prompt.

The prompt can be a question, statement, or any text that you want to ask about the image. The API will analyze the content of the image and generate a response based on the prompt
using a pre-trained model.

Right now there are two models available for this endpoint:

* **Uform-Gen**: [UForm-Gen is a small](https://huggingface.co/unum-cloud/uform-gen2-qwen-500m) generative vision-language model primarily designed for Image Captioning and Visual Question Answering.
* **Llava**: [LLaVA](https://huggingface.co/llava-hf/llava-1.5-7b-hf) is a large multimodal model that can generate text based on images and text prompts.
* **Gemini**: [Gemini](https://deepmind.google/models/gemini/) is a multimodal model with advanced capabilities for understanding and generating text based on images.

<Warning>
  Test images may return accurate results due the `test` watermarks applied to them. If you want to get
  better results, please use live images. If you just want to test this feature, contact support to temporarily
  upgrade your account.
</Warning>

***


## OpenAPI

````yaml openapi.json post /v1/images/{image_id}/visualize
openapi: 3.1.0
info:
  title: IMG Processing API
  description: >
    This powerful and flexible API provides a wide range of

    image manipulation and analysis capabilities, allowing developers to
    integrate advanced image processing

    features into their applications with ease.
  version: 1.0.0
servers:
  - url: https://api.img-processing.com
    description: IMG Processing API Server
security:
  - ApiKeyAuth: []
paths:
  /v1/images/{image_id}/visualize:
    post:
      tags:
        - Analysis Endpoints
      summary: Visualize Image
      description: >-
        This endpoint returns a response based on the content of an image and a
        base prompt.


        The prompt can be a question, statement, or any text that you want to
        ask about the image. The API will analyze the content of the image and
        generate a response based on the prompt using a pre-trained model.


        Right now there are three models available for this endpoint:


        - Uform-Gen: UForm-Gen is a small generative vision-language model
        primarily designed for Image Captioning and Visual Question Answering.

        - Llava: LLaVA is a large multimodal model that can generate text based
        on images and text prompts.

        - Gemini: Gemini is a multimodal model with advanced capabilities for
        understanding and generating text based on images.
      operationId: visualize
      parameters:
        - in: path
          name: image_id
          schema:
            type: string
            description: >-
              The unique identifier of the image. This identifier is used to
              reference the image in subsequent requests.
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                prompt:
                  type: string
                  minLength: 1
                  maxLength: 1000
                  description: >-
                    The prompt to answer based on the content of the image. This
                    is a natural language question or instruction that the model
                    will respond to.
                model:
                  type: string
                  enum:
                    - uform-gen
                    - llava
                    - gemini
                  description: >-
                    The model to use for the visualization. Supported models are
                    uform-gen, llava, and gemini. If not provided, the default
                    model will be used.
              required:
                - prompt
              examples:
                - prompt: What is in this image?
                  model: uform-gen
      responses:
        '201':
          description: The API will return the Image object in the response body.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VisualizeResponse'
        '401':
          description: >-
            Error object for unauthorized access. Probably due to missing or
            invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedError'
        '403':
          description: >-
            Error object for forbidden access. Probably due to insufficient
            permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenError'
        '422':
          description: Error object for validation errors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationError'
        '429':
          description: Error object for rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
        5XX:
          description: Error object for internal server errors.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ServerError'
components:
  schemas:
    VisualizeResponse:
      type: object
      properties:
        response:
          type: string
          description: >-
            The response from the AI model. This is the description of the image
            based on the prompt provided.
      required:
        - response
      title: Visualize Response
      description: Response object for the visualize endpoint.
      examples:
        - response: >-
            A beautiful sunset over the mountains with a clear sky and vibrant
            colors.
    UnauthorizedError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          const: 401
          description: The status of the error
        message:
          type: string
          description: The error message
      required:
        - type
        - error
        - status
        - message
      title: Unauthorized Error
      description: >-
        Error object for unauthorized access. Probably due to missing or invalid
        API key
      examples:
        - type: https://docs.img-processing.com/errors/unauthorized
          error: Unauthorized
          status: 401
          message: API key is required.
    ForbiddenError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          const: 403
          description: The status of the error
        message:
          type: string
          description: The error message
      required:
        - type
        - error
        - status
        - message
      title: Forbidden Error
      description: >-
        Error object for forbidden access. Probably due to insufficient
        permissions.
      examples:
        - type: https://docs.img-processing.com/errors/forbidden
          error: Forbidden
          status: 403
          message: You are not allowed to access this image.
    ValidationError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          const: 422
          description: The status of the error
        errors:
          type: array
          items:
            type: string
          description: The validation errors
      required:
        - type
        - error
        - status
        - errors
      title: Validation Error
      description: Error object for validation errors
      examples:
        - type: https://docs.img-processing.com/errors/validation-error
          error: Validation Error
          status: 422
          errors:
            - '{field or param} {error message}'
    RateLimitError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          const: 429
          description: The status of the error
        message:
          type: string
          description: The error message
      required:
        - type
        - error
        - status
        - message
      title: Rate Limit Error
      description: Error object for rate limit exceeded.
      examples:
        - type: https://docs.img-processing.com/errors/too-many-requests
          error: Too Many Requests
          status: 429
          message: Rate limit exceeded. Try again later.
    ServerError:
      type: object
      properties:
        type:
          type: string
          description: The type of error
        error:
          type: string
          description: The title of the error
        status:
          type: number
          description: The status of the error
        message:
          type: string
          description: The error message
      required:
        - type
        - error
        - status
        - message
      title: Server Error
      description: Error object for internal server errors.
      examples:
        - type: https://docs.img-processing.com/errors/internal-error
          error: Internal Error
          status: 500
          message: >-
            An unexpected error occurred. Please try again later. If the problem
            persists, contact support.
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key for authentication

````