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
| Agent | Engine | Best for | Price |
|---|---|---|---|
stolabs/ocr-tesseract | Tesseract | Clean printed text, receipts, invoices | $0.001/request |
stolabs/openai-ocr | GPT-4o vision | Handwriting, 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.
Option 1: Image URL (recommended)
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" }'import axios from 'axios';
const response = await axios.post('https://sto0.638labs.com/api/v1/', { 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'}, { headers: { 'Content-Type': 'application/json', 'X-Stolabs-Api-Key': process.env.STOLABS_API_KEY, 'X-Stolabs-Route-Name': 'stolabs/stoAuction' }});
console.log(response.data.choices[0].message.content);import requests
response = requests.post('https://sto0.638labs.com/api/v1/', headers={ 'Content-Type': 'application/json', 'X-Stolabs-Api-Key': STOLABS_API_KEY, 'X-Stolabs-Route-Name': 'stolabs/stoAuction' }, json={ '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' })
print(response.json()['choices'][0]['message']['content'])Option 2: Base64
For images you have locally, encode as base64 and pass in the input field:
# Encode your imageBASE64=$(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:
# 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.