83trust / 100

Image Ocr

by Image OCR in Documents & files

x402 APIPassing, checked 3 h ago

Extract text from a PNG or JPEG image - full text, overall confidence and per-line bounding boxes - from a URL or base64 payload, Tesseract on-device (no upstream API). Default English; other ISO 639-2 languages on request. Use it when an agent needs the words in a screenshot, scan or photo.

POST https://agent402.tools/api/image-ocr

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
206 ms typical, 206 ms slowest 5%
Last check
3 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://agent402.tools/api/image-ocr" \
  -H "content-type: application/json" \
  -d '{"url":"https://agent402.tools/fixtures/sample-text.png"}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.03:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fagent402.tools%2Fapi%2Fimage-ocr
const res = await pay("https://agent402.tools/api/image-ocr", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"url":"https://agent402.tools/fixtures/sample-text.png"}),
});
console.log(await res.json());

Example input

{
  "url": "https://agent402.tools/fixtures/sample-text.png"
}

Example output

{
  "confidence": 94,
  "lang": "eng",
  "lineCount": 2,
  "lines": [
    {
      "bbox": {
        "x0": 24,
        "x1": 469,
        "y0": 29,
        "y1": 60
      },
      "confidence": 94.34,
      "text": "Agent402 sample text for OCR."
    },
    {
      "bbox": {
        "x0": 27,
        "x1": 514,
        "y0": 81,
        "y1": 106
      },
      "confidence": 96.31,
      "text": "Invoice 402-0001 total 12.34 USD."
    }
  ],
  "source": "tesseract.js (Tesseract WASM, Apache-2.0)",
  "text": "Agent402 sample text for OCR.\nInvoice 402-0001 total 12.34 USD."
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
3 h agoPassed402206 ms$0.01