agentsvc.io

services / ocr

textoperational · 914 ms

OCR — Image to Text

Extract text from images using Tesseract OCR. Send image as image_base64 (PNG/JPEG/WebP/TIFF/BMP, max 10 MB decoded). Returns text and confidence (0-100, where 80+ is reliable). Set language to Tesseract code: 'eng' (default), 'deu' (German), 'fra' (French), 'chi_sim' (Chinese Simplified), 'jpn' (Japanese), 'ara' (Arabic). Use for invoices, receipts, scanned documents, or screenshots with text.

Run free trial ↗1 free call per day with the example input. Paid: $0.008 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/ocr", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"image_base64":"<base64 of a PNG/JPG>","language":"eng"}),
});
const { data, payment } = await res.json();  // payment.transaction = on-chain receipt

Input

FieldTypeDescription
image_base64 *stringBase64-encoded image. Supported formats: PNG, JPEG, WebP, TIFF, BMP. Max 10 MB decoded. For best results use high-contrast images with clear text.
languagestring = "eng"Tesseract language code. Default: 'eng' (English). Other supported: 'deu' (German), 'fra' (French), 'spa' (Spanish), 'ita' (Italian), 'por' (Portuguese), 'rus' (Russian), 'chi_sim' (Chinese Simplified), 'jpn' (Japanese), 'ara' (Arabic), 'kor' (Korean), 'nld' (Dutch), 'pol' (Polish). Use '+' to combine: 'eng+deu'.
psminteger = 3Page Segmentation Mode. 3 = fully automatic (default, best for most images). 6 = single uniform block of text. 7 = single text line. 11 = sparse text (find text anywhere). 13 = raw line (no line ordering). Use 6 or 7 for forms/labels.

Output

FieldTypeDescription
textstringFull extracted text from the image, with line breaks preserved
confidencenumberOverall OCR confidence score (0-100). Above 70 is considered reliable.
languagestringLanguage code used for recognition
word_countintegerNumber of words extracted
char_countintegerNumber of characters extracted (excluding whitespace)
processing_msintegerTime taken for OCR processing in milliseconds
processed_atstringISO 8601 timestamp

Example response (data)

{
  "text": "Invoice #12345\nDate: April 10, 2026\n\nBill To:\nJohn Smith\n123 Main Street\n\nTotal Due: $1,250.00",
  "confidence": 94,
  "language": "eng",
  "word_count": 18,
  "char_count": 72,
  "processing_ms": 1840,
  "processed_at": "2026-04-10T14:00:00.000Z"
}