Forge OCR Server v0.1.0
Multi-layer document OCR with consensus and validation
API Endpoints
POST
/api/v1/ocr/{doc_type}
OCR any document (multipart)
POST
/api/v1/ocr/{doc_type}/json
OCR any document (base64 JSON)
POST
/api/v1/pan/ocr
PAN card OCR (multipart)
POST
/api/v1/pan/ocr/json
PAN card OCR (base64 JSON)
GET
/api/v1/documents
List document types
GET
/api/v1/pan/config
Default PAN layer config
GET
/api/v1/layers
Available OCR layers
GET
/api/v1/health
Health check
Supported Documents
Aadhaar Card (UIDAI, India)
doc_type: aadhaar_card
aadhaar_number Aadhaar Number requiredname Name requireddate_of_birth Date of Birth requiredgender Gender requiredaddress Address optionalmasked_number Masked Aadhaar Number optional
PAN Card (India)
doc_type: pan_card
pan_number PAN Number requiredname Name requiredfathers_name Father's Name requireddate_of_birth Date of Birth required
OCR Layers
| ID | Description | Weight | PSM | Preprocess | Status |
ocrs_deep_learning |
OCRS Deep Learning OCR (PSM 3 + denoise) — best accuracy |
0.90 |
3 |
grayscale, denoise |
active |
tesseract |
Tesseract LSTM (PSM 3, grayscale) — reliable PAN/DOB |
0.70 |
3 |
grayscale |
active |
onnx_ocr |
ONNX OCR (PSM 6 + binarize) — slow on large images, disabled |
0.85 |
6 |
grayscale, binarize |
disabled |
llm_anthropic |
LLM Vision (PSM 11 sparse) — garbles names, disabled |
0.95 |
11 |
none |
disabled |
Quick Start
curl https://forge-ocr.sachinkumarskrose.workers.dev/api/v1/health
curl -X POST https://forge-ocr.sachinkumarskrose.workers.dev/api/v1/pan/ocr \
-F "image=@pan_card.jpg"
curl -X POST https://forge-ocr.sachinkumarskrose.workers.dev/api/v1/pan/ocr \
-F "image=@pan_card.jpg" \
-F "include_layers=true"
curl -X POST https://forge-ocr.sachinkumarskrose.workers.dev/api/v1/pan/ocr \
-F "image=@pan_card.jpg" \
-F 'config=[{"id":"ocrs_deep_learning","description":"OCRS","weight":0.9,"psm":3,"preprocess":{"grayscale":true,"binarize":false,"denoise":true,"deskew":false},"enabled":true}]'
curl -X POST https://forge-ocr.sachinkumarskrose.workers.dev/api/v1/ocr/pan_card \
-F "image=@pan_card.jpg"
How It Works
- Upload image (multipart or base64 JSON)
- Multiple OCR layers process image in parallel
- Fields parsed from raw text using document-specific regex
- Results merged via weighted consensus per field
- Each field validated (format, checksum, date range)
- Response: extracted fields, confidence score, review recommendation