Image to Text
Introduction
Image to text, also known as image captioning, allows you to obtain descriptive text prompts based on uploaded or previously generated images. This process is instrumental in generating textual descriptions that can be used to create additional images or provide detailed insights into visual content.
Request
Our API always accepts an array of objects as input, where each object represents a specific task to be performed. The structure of the object varies depending on the type of the task. For this section, we will focus on the parameters related to the image to text task.
The following JSON snippet shows the basic structure of a request object. All properties are explained in detail in the next section.
includeCost
If set to
true
, the cost to perform the task will be included in the response object.inputImage
Specifies the input image to be processed. The image can be specified in one of the following formats:
- An UUID v4 string of a previously uploaded image or a generated image.
- A data URI string representing the image. The data URI must be in the format
data:<mediaType>;base64,
followed by the base64-encoded image. For example:data:image/png;base64,iVBORw0KGgo...
. - A base64 encoded image without the data URI prefix. For example:
iVBORw0KGgo...
. - A URL pointing to the image. The image must be accessible publicly.
Supported formats are: PNG, JPG and WEBP.
Response
Results will be delivered in the format below.
taskUUID
The API will return the
taskUUID
you sent in the request. This way you can match the responses to the correct tasks.text
The resulting text or prompt from interrogating the image.
cost
if
includeCost
is set totrue
, the response will include acost
field for each task object. This field indicates the cost of the request in USD.