OCR.chat API

एक HTTP विनंती प्रतिमा किंवा PDF स्वच्छ पाठ्य, मार्कडाउन, तालिका, आणि JSON मध्ये बदलते - 100 + भाषा. प्रति पान मोजले, आश्चर्य नाही.

ओळख

The OCR.chat API is a small REST interface. You POST a file and get back a job with the recognized text and a per-page breakdown (text, bounding boxes, confidence). Jobs of 5 pages or fewer return inline; larger jobs return immediately with a pending status that you poll until done.

  • Base URL: https://ocr.chat
  • Formats in: PNG, JPG, WEBP, GIF, BMP, TIFF, and multi-page PDF
  • Formats out: txt, md, docx, pdf, csv, json
  • Engines: cpu (fast, printed docs) and vlm (premium AI, handwriting, complex layout, math)

अधिप्रमाणन

Authenticate with your API token (find it on your account page) as a Bearer header:

Authorization: Bearer YOUR_API_TOKEN

You can also pass ?api_token=… as a query parameter. Usage is metered against your account's page balance.

दस्तऐवज सादर करा

POST /api/v1/ocr/, multipart form upload.

curl -X POST https://ocr.chat/api/v1/ocr/ \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F "file=@invoice.pdf" \
  -F "tier=vlm" \
  -F "language=auto"

Returns the job. For ≤5-page files it is already done with the text; larger files come back pending/processing, poll the status endpoint.

{
  "uuid": "9f2c1b7e4a...",
  "status": "done",
  "tier": "vlm",
  "language": "auto",
  "page_count": 1,
  "mean_confidence": 0.98,
  "text": "INVOICE\nAcme Corp\nTotal: 215.00 USD",
  "markdown": "# INVOICE\n\n**Acme Corp** ...",
  "pages": [ { "index": 0, "text": "...", "blocks": [ { "text": "...", "bbox": [x0,y0,x1,y1], "confidence": 0.98 } ] } ]
}

परिणाम प्राप्त करा

GET /api/v1/ocr/<uuid>/, poll until status is done or failed.

curl https://ocr.chat/api/v1/ocr/9f2c1b7e4a.../ \
  -H "Authorization: Bearer YOUR_API_TOKEN"

स्वरूप डाउनलोड करा

GET /api/v1/ocr/<uuid>/download/?format=md, export the result. format is one of txt, md, docx, pdf, csv, json.

curl -L "https://ocr.chat/api/v1/ocr/9f2c1b7e4a.../download/?format=docx" \
  -H "Authorization: Bearer YOUR_API_TOKEN" -o result.docx

दस्तऐवजासह गप्पा मारा

पूर्ण झालेले कार्य विषयी प्रश्न विचारा. उत्तरे फक्त काढून टाकलेले पाठ्य व स्त्रोत पान पासूनच आहेत. ॲकाऊंट टोकनची आवश्यकता आहे - संवाद वैशिष्ट्य ॲकाऊंट-गेटेड आहे.

POST /api/v1/chat/<uuid>/, JSON body {"message": "your question"}.

curl -X POST https://ocr.chat/api/v1/chat/9f2c1b7e4a.../ \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message": "What is the invoice total and due date?"}'

उत्तर व उद्धृत पानांची यादी सह सहाय्यक संदेश परत करतो:

{"conversation": "a1b2…", "message": {
   "role": "assistant",
   "content": "The total is $42, due on March 3 (p. 1).",
   "citations": [{"page": 1, "snippet": "The invoice total is $42…"}]
}}

GET /api/v1/chat/<uuid>/history/, कार्य करीता पूर्ण संवाद ट्रान्सक्रिप्ट प्राप्त करा.

कोड उदाहरण

import requests, time

API = "https://ocr.chat/api/v1/ocr/"
H = {"Authorization": "Bearer YOUR_API_TOKEN"}

# Submit
with open("invoice.pdf", "rb") as f:
    job = requests.post(API, headers=H,
        files={"file": f}, data={"tier": "vlm"}).json()

# Poll until done
while job["status"] in ("pending", "processing"):
    time.sleep(2)
    job = requests.get(API + job["uuid"] + "/", headers=H).json()

print(job["markdown"])

# Download as DOCX
r = requests.get(API + job["uuid"] + "/download/",
                 headers=H, params={"format": "docx"})
open("result.docx", "wb").write(r.content)
import fs from "fs";

const API = "https://ocr.chat/api/v1/ocr/";
const H = { Authorization: "Bearer YOUR_API_TOKEN" };

const form = new FormData();
form.append("file", new Blob([fs.readFileSync("invoice.pdf")]), "invoice.pdf");
form.append("tier", "vlm");

let job = await (await fetch(API, { method: "POST", headers: H, body: form })).json();

while (["pending", "processing"].includes(job.status)) {
  await new Promise(r => setTimeout(r, 2000));
  job = await (await fetch(API + job.uuid + "/", { headers: H })).json();
}
console.log(job.markdown);
# 1. Submit
curl -X POST https://ocr.chat/api/v1/ocr/ \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F "file=@invoice.pdf" -F "tier=vlm"

# 2. Poll  (use the uuid from step 1)
curl https://ocr.chat/api/v1/ocr/UUID/ \
  -H "Authorization: Bearer YOUR_API_TOKEN"

# 3. Download
curl -L "https://ocr.chat/api/v1/ocr/UUID/download/?format=md" \
  -H "Authorization: Bearer YOUR_API_TOKEN" -o result.md

पैरामीटर

FieldTypeDescription
filefileRequired. The image or PDF to process.
tierstringcpu (default, fast/printed) or vlm (premium AI: handwriting, layout, math).
languagestringauto (default) or a language code (en, ch, ja, ar, …).
toolstringOptional tool slug (e.g. extract-tables, handwriting-to-text) to apply that tool's preset.
translate_tostringFor the translate tool, target language code.

त्रुटी व मर्यादा

CodeMeaning
400No file, unsupported type, or file too large.
401Missing or invalid API token.
402Out of pages, daily/monthly free limit reached, or no credits. The body includes used/cap.
404Job UUID not found.
409Download requested before the job finished.

Each page processed costs credits (1/page on the fast tier, more on premium). Paid plans raise per-file page caps and add priority. See pricing.

वारंवार विचारले जाणारे प्रश्न

Create a free account and open your account page, your token is shown there with a copy button.

Yes, files of 5 pages or fewer return the full result inline in the POST response, so no polling is needed for most images and short PDFs.

Over 100, including Latin, CJK, Arabic, Cyrillic and Indic scripts. Use language=auto to detect, or pass a specific code.

Uploads are processed for OCR and deleted automatically. We never sell, share, or train on your documents.

वापर तुमच्या खात्यामधील बॅलन्स विरुद्ध प्रति पान मोजला जातो: अनधिकृत कॉलला प्रति-IP दैनंदिन अनुदान मिळते, मोफत खाते महिन्याचे बॅच, आणि मोफत योजना वापरा खरेदी केलेले क्रेडिट उच्च प्रति-फाइल पान कव्हर आणि प्राधान्यतेसह. जेव्हा तुम्ही बाहेर पडता तेव्हा तुम्हाला वापरलेले आणि मुख्य भागात कव्हरसह 402 मिळते.

PNG, JPG, WEBP, GIF, BMP, TIFF, आणि बहु- पान PDF पाठवू शकता. परिणाम txt, md, docx, pdf (searchable), csv, किंवा json डाउनलोड अंतबिंदू स्वरूप परिमाण द्वारे डाउनलोड करा.

400 ही आढळलेली फाइल, असमर्थीत प्रकार, किंवा फाइल खूप मोठी आहे; 401 एक आढळले नाही किंवा अवैध टोकन; 402 पान बाहेर; 404 एक अपरिचीत कार्य UUID; व 409 कार्य पूर्ण करण्यापूर्वी डाउनलोड करीता विनंती. त्रुटी बाह्यत्वचेत एक लहान संदेश समाविष्टीत आहे.

स्थिती, स्तर, भाषा, पान_संख्या, व mean_confidence सह कार्य वस्तु, पूर्ण पाठ्य व मार्कडाउन सह. पानांची यादी प्रत्येक पानाच्या पाठ्य, बाउंडिंग बॉक्स (bbox) व प्रति-ब्लॉक विश्वासार्हतेसह ब्लॉकमध्ये विभाजित करते.

स्वच्छ छपाई दस्तऐवजाच्या जलद, कमी खर्चाचे ओळखणी करीता cpu चा वापर करा (मूलभूत). vlm चा वापर करा, प्रीमियम AI इंजिन, हस्तलेखन, जटिल किंवा बहु- स्तंभ मांडणी, गणित व अनुवाद करीता, जेथे ते अधिक अचूक आहे.

त्या साधनाचे पूर्वनिर्धारित अनुरूप वापरण्याकरीता एक स्लागसह साधन पास करा (उदाहरणार्थ, एक्सट्रॅक्ट-टेबल किंवा हँडराइटिंग-टू-टेक्स्ट). अनुवाद साधन करीता, ओळखले गेलेले पाठ्य परत अनुवादित करण्यासाठी लक्ष्य भाषा कोडसह translate_to पास करा.

POST प्रतिसादात ५ किंवा कमी पानांचे फाइल इनलाइन परत येतात. मोठे फाइल लगेचच परत येतात, अपेक्षित किंवा प्रक्रियेत, आणि तुम्ही GET /api/v1/ocr/ पॉल करा<uuid>/ स्थिती पूर्ण किंवा अपयशी होईपर्यंत. मोफत योजना प्रति- फाइल पान कमाल वाढविते.

हे API HTTPS वर REST आहे, म्हणून ते HTTP क्लाइंटसह कोणत्याही भाषेतून काम करते - Python, Node.js, आणि cURL वरील उदाहरणे पहा. स्थापना करण्यासाठी SDK नाही; मानक HTTP कोडच्या काही ओळी तुम्हाला सर्व आवश्यक आहेत.