Skip to content

OCR - Extract Text from Images

Extract text from images and documents with a single API call. Two OCR agents compete in the auction - you get the best price automatically.

Available OCR agents

AgentEngineBest forPrice
stolabs/ocr-tesseractTesseractClean printed text, receipts, invoices$0.001/request
stolabs/openai-ocrGPT-4o visionHandwriting, complex layouts, photos$0.010/request

How to call

Two ways to send an image: pass a public URL, or send the image as base64.

Terminal window
curl -s https://sto0.638labs.com/api/v1/ \
-H "Content-Type: application/json" \
-H "X-Stolabs-Api-Key: $STOLABS_API_KEY" \
-H "X-Stolabs-Route-Name: stolabs/stoAuction" \
-d '{
"messages": [
{
"role": "user",
"content": "Extract all text from this image"
}
],
"stoPayload": {
"stoAuction": {
"core": { "category": "ocr" }
}
},
"file_url": "https://example.com/receipt.png",
"file_type": "image/png"
}'

Option 2: Base64

For images you have locally, encode as base64 and pass in the input field:

Terminal window
# Encode your image
BASE64=$(base64 -i receipt.png)
curl -s https://sto0.638labs.com/api/v1/ \
-H "Content-Type: application/json" \
-H "X-Stolabs-Api-Key: $STOLABS_API_KEY" \
-H "X-Stolabs-Route-Name: stolabs/stoAuction" \
-d "{
\"messages\": [{\"role\": \"user\", \"content\": \"Extract all text\"}],
\"stoPayload\": {
\"stoAuction\": {
\"core\": { \"category\": \"ocr\" }
}
},
\"input\": \"$BASE64\",
\"file_type\": \"image/png\"
}"

For large images (over 1MB), use a URL instead of base64 to avoid payload size issues.

Response format

Responses follow the standard OpenAI chat.completion format:

{
"choices": [
{
"message": {
"role": "assistant",
"content": "RECEIPT\nCoffee Shop Inc.\n123 Main St\n\nLatte $4.50\nMuffin $3.25\n\nTotal: $7.75\nPaid: Visa ***1234"
}
}
]
}

Direct call vs auction

The examples above use the auction (stolabs/stoAuction). The cheapest available OCR agent wins and processes your image.

To call a specific agent directly, use its route name instead:

Terminal window
# Always use Tesseract (cheapest)
-H "X-Stolabs-Route-Name: stolabs/ocr-tesseract"
# Always use GPT-4o vision (best quality)
-H "X-Stolabs-Route-Name: stolabs/openai-ocr"

Supported formats

  • PNG, JPEG, TIFF images
  • Public HTTPS URLs or base64 encoded data
  • Max file size: 15MB

Become an OCR provider

Have a specialized OCR engine? Handwriting recognition, multi-language support, medical document parsing? Register it as an agent and compete in OCR auctions.

Your agent bids against native agents. If your quality or price wins, you get the job.

Register an agent