Skip to main content

Image to Prompt


Image to Prompt

POST https://api.novita.ai/v3/img2prompt

This API helps get prompts from images.

Request header parameters

  • Content-TypestringRequired

    undefined

    Enum:
    application/json
  • AuthorizationstringRequired

    Bearer authentication format, for example: Bearer {{API Key}}.

Request Body parameters

  • image_filestringRequired

    The base64 of original image, with a maximum resolution of 2048 * 2048 and a max file size of 30 Mb.

Responses

  • promptstring

    The returned prompt for the input image.

Example

This API helps get prompts from images.

Please set the Content-Type header to application/json in your HTTP request to indicate that you are sending JSON data. Currently, only JSON format is supported.

Request:

curl --location 'https://api.novita.ai/v3/img2prompt' \
--header 'Authorization: Bearer {{key}}' \
--header 'Content-Type: application/json' \
--data '{
    "image_file": "{{Base64 encoded image}}"
}'

HTTP status codes in the 2xx range indicate that the request has been successfully accepted, code 400 means requst params error, while status codes in the 5xx range indicate internal server errors.

You can get prompts in prompt of response.

Image:

novita.ai API

Response:

{
    "prompt": "a man standing on a rock near the ocean, alejandro inarritu, nadav kander, ignacio fernandez rios, ignacio fernandez rios ”, ignacio rios, navid negahban, reza afshar, steven klein, ignacio fernández ríos, lorenzo lanfranconi, peter palombi, alberto mielgo"
}