Image-to-Text (OCR)

Image-to-text models translate images into written output. The most common uses are image captioning and OCR, which describe scenes and extract text, respectively.

post

Endpoint for requesting image2text (OCR) inference

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
Acceptstring · enumRequiredDefault: application/jsonPossible values:
Body
imagestring · binaryRequired

Image file to extract text from. Supported formats: JPG, JPEG, PNG, GIF, BMP, WebP. Maximum file size: 10 MB.

modelstringRequired

The OCR model to use for text extraction

Example: Nanonets_Ocr_S_F16
languagestring | nullableOptional

Language code for OCR processing (optional)

Example: en
formatstring · enum | nullableOptional

Output format for extracted text

Example: textPossible values:
return_result_in_responseboolean | nullableOptional

If true, the result will be returned directly in the response instead of only download url. Optional parameter.

Default: falseExample: false
Responses
200

ID of the inference request.

application/json
post
/api/v1/client/img2txt
POST /api/v1/client/img2txt HTTP/1.1
Host: api.deapi.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: application/json
Content-Type: multipart/form-data
Content-Length: 113

{
  "image": "binary",
  "model": "Nanonets_Ocr_S_F16",
  "language": "en",
  "format": "text",
  "return_result_in_response": false
}
{
  "data": {
    "request_id": "c08a339c-73e5-4d67-a4d5-231302fbff9a"
  }
}
post

Endpoint for calculating price for image2text (OCR) inference

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Header parameters
Acceptstring · enumRequiredDefault: application/jsonPossible values:
Body
one ofOptional
or
Responses
200

Calculated price for img2txt inference.

application/json
post
/api/v1/client/img2txt/price-calculation
POST /api/v1/client/img2txt/price-calculation HTTP/1.1
Host: api.deapi.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: application/json
Content-Type: multipart/form-data
Content-Length: 79

{
  "image": "binary",
  "model": "Nanonets_Ocr_S_F16",
  "language": "en",
  "format": "text"
}
{
  "data": {
    "price": 0.15
  }
}

Last updated