POST multipart/form-data: required file field named exactly image (not file). model_slug in the path: alpha-digit-max or alpha-digit-medium. Optional: pdf_password (string) for a protected PDF. Any other field name is forbidden; no model field in the form → HTTP 422 if non-compliant. Do not set Content-Type manually: multipart/form-data and boundary are generated by the client.
/models/{model_slug}/ocr
Request body
The following parameters can be included in the request body:
Parameters
image
Image or PDF file to analyze (multipart/form-data, exact name: image).
pdf_password
Optional. Password for a protected PDF.
Successful response
The following fields are returned in a successful response:
Response fields
model_slug
Slug of the model used for inference.
text
Text extracted from the image.
inference_seconds
Inference time in seconds.
global_confidence
Global confidence score (0–1), or null if not applicable.
words
List of detected words with their individual confidence score.
image_filename
Name of the provided file, or null.
Examples
Code examples for using this endpoint:
curl -X POST "https://api-endpoints.alphaedge-ai.com/models/alpha-digit-max/ocr" \
-H "X-API-Key: TA_CLE" \
-F "image=@/chemin/image.png"
import requests
url = "https://api-endpoints.alphaedge-ai.com/models/alpha-digit-max/ocr"
headers = {"X-API-Key": "TA_CLE"}
with open("/chemin/image.png", "rb") as f:
files = {"image": ("image.png", f, "image/png")}
r = requests.post(url, headers=headers, files=files, timeout=300)
print(r.status_code)
print(r.json())
import fs from "node:fs";
const form = new FormData();
form.append("image", new Blob([fs.readFileSync("/chemin/image.png")]), "image.png");
const res = await fetch("https://api-endpoints.alphaedge-ai.com/models/alpha-digit-max/ocr", {
method: "POST",
headers: { "X-API-Key": "TA_CLE" },
body: form
});
console.log(res.status, await res.json());
Response
Sample API response:
{
"model_slug": "alpha-digit-max",
"text": "26 rue Honore de Balzac",
"inference_seconds": 0.055,
"global_confidence": 0.82,
"words": [
{
"w": "26",
"confidence": 1
},
{
"w": "rue",
"confidence": 0.97
},
{
"w": "Honore",
"confidence": 0.47
},
{
"w": "de",
"confidence": 0.99
},
{
"w": "Balzac",
"confidence": 0.99
}
],
"image_filename": "test_manuscrit7.png"
}