Optical Character Recognition endpoint that extracts text and structured data from images and PDF documents.
POST
/v1/ocr
Request Body
Les paramètres suivants peuvent être inclus dans le corps de la requête :
Paramètres
model
string
Required
Default Value:
alphaedge-ocr-3-2512
ID of the OCR model to use.
image
string
Required
Base64 encoded image or image URL.
structured_output
boolean
Default Value:
false
Whether to return structured output with bounding boxes.
Successful Response
Les champs suivants sont retournés dans une réponse réussie :
Champs de réponse
id
string
Required
A unique identifier for the OCR result.
object
string
Required
The object type, which is always "ocr.result".
model
string
Required
The OCR model used.
text
string
Required
The extracted text content.
bboxes
array<BBox>
Array of bounding boxes with text and coordinates.
Examples
Exemples de code pour utiliser cet endpoint :
typescript
import { AlphaEdge } from '@alphaedge/alphaedge';
const alphaedge = new AlphaEdge({
apiKey: process.env.ALPHAEDGE_API_KEY,
});
const result = await alphaedge.ocr.create({
model: 'alphaedge-ocr-3-2512',
image: 'data:image/png;base64,...',
structured_output: true
});
python
from alphaedge import AlphaEdge
alphaedge = AlphaEdge(api_key="your-api-key")
result = alphaedge.ocr.create(
model="alphaedge-ocr-3-2512",
image="data:image/png;base64,...",
structured_output=True
)
curl
curl https://api.alphaedge-ai.com/v1/ocr \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ALPHAEDGE_API_KEY" \
-d '{
"model": "alphaedge-ocr-3-2512",
"image": "data:image/png;base64,...",
"structured_output": true
}'
Response
Exemple de réponse de l'API :
json
{
"id": "ocr-abc123",
"object": "ocr.result",
"model": "alphaedge-ocr-3-2512",
"text": "Extracted text content...",
"bboxes": [
{
"text": "Hello",
"bbox": [10, 20, 100, 30],
"confidence": 0.98
}
]
}