API OCR.chat

Ko tētahi tono HTTP kotahi e huri ana i tētahi whakaahua, PDF rānei ki roto i te kupu mārama, Markdown, ngā ripanga, me JSON — i roto i ngā reo 100+ i te wā kotahi. Ka inetia ia pātaka, kāore he whakamātautau.

Whakamāramatanga

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)

Whakatuhi

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.

Whakahauhau i tētahi tuhinga

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 } ] } ]
}

Ka whiwhi hua

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"

Whakahua i tētahi hanga

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

Whakapāpāho me tētahi tuhinga

E pātai ana ki ngā pātai mo tētahi mahi i oti. Ko ngā whakautu e whakatū ana anake i roto i te kupu i tāpiritia, ā, ka whakahuatia te pātaka pūtake. E hiahiatia ana he tohu kāwanatanga - ko te āhuatanga kōrero he āhua ā-kōrero.

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?"}'

Ka hoki te karere āwhina ki tōna urupare me tētahi rārangi o ngā pātaka i whakahuatia:

{"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/, ki te whiwhi i te whakahua kōrero katoa mō tētahi mahi.

Ko ngā tauira waehere

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

Parameter

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.

Whakarewa

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.

Ko nga pātai e pā ana

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.

Ka inetia te whakamahinga i ia pātaka ki runga i tō tātau pūtea: ka whiwhi te whakarongo ā-whakaaro i tētahi utu i ia rā i ia IP, he pūkete wātea i te marama, ā, ka whakamahia e ngā mahere me ngā pūtea tuku iho ngā pūtea tuku me ngā pūtake pāpāho nui ake. Ina whakarewatia e koe, ka whiwhi 402 ki te whakamahi me te kōpaka i te tinana.

Ka taea e koe te tuku PNG, JPG, WEBP, GIF, BMP, TIFF, me te PDF-pātaka maha. Ka whakatakia ngā hua hei txt, md, docx, pdf (whakaahua), csv, json rānei mā te whakataki i te tohuāhua o te whakataki.

Ko te 400 he faila kāore, he momo kāore i tautokona, he nui rawa rānei te faila; 401 he tohu kāore, kāore rānei i te tika; 402 i waho o ngā pātaka; 404 he UUID mahi kāore i mōhiotia; me te 409 he tāpiri i tonotia i mua i te mutunga o te mahi. Kei roto i ngā tinana hapa he karere poto.

He ahanoa mahi me te tūnga, te taumata, te reo, te taupānga_pāpā, me te mea_whakawhirinaki, tae atu ki te kupu katoa me te tohu. Ka whakawātea te taupānga o ngā pātaka i ia pātaka ki ngā kōpaka me tō rātou kupu, te kāwai whakawhāiti (bbox), me te whakawhirinaki-pōkai.

Ka whakamahia te cpu (te pūmau) mō te āhua tere, te mōhiotanga iti o ngā tuhinga tātuhi mārō. Ka whakamahia te vlm, te mīhini AI utu, mō te tuhituhi, ngā whakaritenga matatini, ngā tautuhi taumaha rānei, ngā pāngarau, me te whakamāoritanga, i reira he tino tika.

Ka whakawhitia te utauta me tētahi pūrere (hei tauira, he tātaitai tāurunga, he tuhituhi-ki-te-tuhi rānei) hei hoatu i te tautuhi i whakaritea i mua o taua utauta. Mō te utauta whakamāoritanga, ka whakawhitia hoki te translate_to me te waehere reo ūnga hei whiwhi i te kupu i mōhiotia ki te whakamāoritia anō.

Ko ngā pūranga o ngā 5 pātaka, iti iho rānei, ka hoki ki roto i te urupare POST. Ka hoki mai ngā pūranga nui ake i te wā kotahi hei tūtohu, hei tukatuka rānei, ā, ka pātai atu ki te GET /api/v1/ocr/<uuid>/ tae noa ki te wā ka oti te tūnga, ka pōturi rānei. Ka whakatū i ngā mahere utu te kōpaka o te pātaka-kōpapa.

Ko te API he REST māmā i runga i te HTTPS, nā reira ka mahi mai i tētahi reo me tētahi kaiwhakahaere HTTP - tirohia ngā tauira Python, Node.js, me te cURL i runga ake nei. Kāore he SDK hei whakatū; He torutoru ngā raina o te waehere HTTP paerewa e hiahiatia ana e koe.