BBox Extraction

Extracts text from images with precise bounding box coordinates for each text element.

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.

return_bboxes
boolean
Default Value: true

Whether to return 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.

bboxes
array<BBox>
Required

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,...',
  return_bboxes: 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,...",
    return_bboxes=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,...",
    "return_bboxes": true
  }' 

Response

Exemple de réponse de l'API :

json
{
  "id": "ocr-abc123",
  "object": "ocr.result",
  "model": "alphaedge-ocr-3-2512",
  "text": "Extracted text",
  "bboxes": [
    {
      "text": "Hello",
      "bbox": [10, 20, 100, 30],
      "confidence": 0.98
    }
  ]
}