PDF.chat API
Layisha phezulu i-PDF ne-chat nayo kusuka ku-app yakho - buza imibuzo futhi uthole izimpendulo ezibhalwe kukhasi, nge-100 + ulwimi. Ikhasi ngalinye lilinganiselwa, akukho okuthakazelisayo.
Umbono
I-PDF.chat API iyi-REST interface encane. POST ikhasi lokufaka ikhasi ukuze uthathe ikhasi bese uthola umsebenzi ngesihloko sekhasi kanye nekhasi ngalinye lokuhlukaniswa (isihloko, amabhokisi okuqeda, ukuphepha). POST izingcingo ezingezona umsebenzi futhi uthole izimpendulo ezifundelwe kulesi siqukathi, ngayinye echaza ikhasi layo kwavela. Imisebenzi ye 5 amakhasi noma ngaphezu kokubuyiselwa inline; imisebenzi enkulu ukubuyiselwa ngokushesha nge pending isimo esizoxoxwa done.
- Isisekelo URL:
https://pdf.chat - Amadokhumende ku: PDF, kanye ne-Word, PowerPoint, umbhalo, nezithombe (PNG, JPG, WEBP, GIF, BMP, TIFF)
- Chat ngaphandle: iphendula ngekhasi lokuchaza; ibhala ngendawo yokuphelisa imbali
- Umbhalo oqediwe ngaphandle:
txt,md,docx,pdf,csv,json - Ukufunda ama-engine:
cpu(ikhasi elisheshayo, eliphrintiwe) kanyevlm(AI ephakeme, ukubhalela ngesandla, isitayela esinzima, i-matematics)
Ukuqinisekisa
Ukuqinisekisa nge- I-API token (thola ku- ikhasi le-akhawunti) njengesihloko somuntu ophethe:
Authorization: Bearer YOUR_API_TOKEN
Ungadlulisa futhi ?api_token=… njenge parameter yombuzo. Ukusetshenziswa kulinganiselwa ngokumelene nekhasi le-akhawunti yakho.
Faka idokhumende
POST /api/v1/ocr/, ifomu eliningi lokulayisha.
curl -X POST https://pdf.chat/api/v1/ocr/ \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "file=@invoice.pdf" \
-F "tier=vlm" \
-F "language=auto"
Ibuyisela umsebenzi. Kumakhasi a≤5 amafayela akhona done ngesihloko; amafayela amakhulu abuyela emuva pending/processing, umbuzo isimo isiqephu.
{
"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 } ] } ]
}
Thola imiphumela
GET /api/v1/ocr/<uuid>/, umbuzo kuze status i done noma failed.
curl https://pdf.chat/api/v1/ocr/9f2c1b7e4a.../ \
-H "Authorization: Bearer YOUR_API_TOKEN"
Layisha phezulu ifomu
GET /api/v1/ocr/<uuid>/download/?format=md, khipha imiphumela. format iyisi- txt, md, docx, pdf, csv, json.
curl -L "https://pdf.chat/api/v1/ocr/9f2c1b7e4a.../download/?format=docx" \
-H "Authorization: Bearer YOUR_API_TOKEN" -o result.docx
Chat ngedokhumende
Umbuzo mayelana nemisebenzi eqediwe. Izixazululo zikhona kuphela embhalweni okhishwayo futhi zisho ikhasi lomthombo. Kudinga i-akhawunti ye-token, i-chat izici ziyi-akhawunti-gated.
POST /api/v1/chat/<uuid>/, Isiqu se-JSON {"message": "your question"}.
curl -X POST https://pdf.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?"}'
Ibuyisela umlayezo we-assistant nge-response yayo nohlu lwekhasi elibhalwe phansi:
{"conversation": "a1b2…", "message": {
"role": "assistant",
"content": "The total is $42, due on March 3 (p. 1).",
"citations": [{"page": 1, "cited_text": "The invoice total is $42…", "document_id": "9f2c1b7e4a…"}]
}}
GET /api/v1/chat/<uuid>/history/, thola ukuxhumana okuphelele kwe-transcript yomsebenzi.
Isibonelo sekhodi
import requests, time
BASE = "https://pdf.chat/api/v1"
H = {"Authorization": "Bearer YOUR_API_TOKEN"}
# 1. Upload a PDF
with open("contract.pdf", "rb") as f:
job = requests.post(BASE + "/ocr/", headers=H, files={"file": f}).json()
# 2. Wait until it's ready to chat
while job["status"] in ("pending", "processing"):
time.sleep(2)
job = requests.get(f"{BASE}/ocr/{job['uuid']}/", headers=H).json()
# 3. Ask questions — every answer is cited to the page
ans = requests.post(f"{BASE}/chat/{job['uuid']}/", headers=H,
json={"message": "What is the termination notice period?"}).json()
print(ans["message"]["content"])
print(ans["message"]["citations"])
import fs from "fs";
const BASE = "https://pdf.chat/api/v1";
const H = { Authorization: "Bearer YOUR_API_TOKEN" };
// 1. Upload a PDF
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("contract.pdf")]), "contract.pdf");
let job = await (await fetch(`${BASE}/ocr/`, { method: "POST", headers: H, body: form })).json();
// 2. Wait until it's ready to chat
while (["pending", "processing"].includes(job.status)) {
await new Promise(r => setTimeout(r, 2000));
job = await (await fetch(`${BASE}/ocr/${job.uuid}/`, { headers: H })).json();
}
// 3. Ask questions — every answer is cited to the page
const ans = await (await fetch(`${BASE}/chat/${job.uuid}/`, {
method: "POST", headers: { ...H, "Content-Type": "application/json" },
body: JSON.stringify({ message: "What is the termination notice period?" })
})).json();
console.log(ans.message.content, ans.message.citations);
# 1. Upload a PDF
curl -X POST https://pdf.chat/api/v1/ocr/ \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-F "file=@contract.pdf"
# 2. Ask questions (use the uuid from step 1) — answers cited to the page
curl -X POST https://pdf.chat/api/v1/chat/UUID/ \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "What is the termination notice period?"}'
Amapharamitha
| Isigaba | Uhlobo | Ulwaziso |
|---|---|---|
file | file | Kudingeka. Isithombe noma i-PDF esizoqhubekekisa. |
tier | string | cpu (iphutha, lishesha/liphrintwa) noma vlm (premium AI: ukubhalela ngesandla, ukwakheka, i-mathematics). |
language | string | auto (iphutha) noma ikhodi lesilimi (en, ch, ja, ar,...). |
tool | string | Isisetshenziswa esikhethiwe esingenalutho (isib. summarize-pdf, ask-pdf) ukulungiselela kuqala i-chat yale misebenzi. |
Iphutha & amaphutha
| Ikhodi | Iqiniso |
|---|---|
400 | Akukho fayela, uhlobo olusaxhasiwe, noma ifayela likhulu kakhulu. |
401 | Iphutha noma i-API token engasebenziyo. |
402 | Ngaphandle kwamakhasi, umkhawulo wosuku/wezinyanga okhululekile ufinyelelwe, noma akukho zimali. Isiqu sifaka used/cap. |
404 | Imisebenzi UUID ayitholakali. |
409 | Ukulanda kudingeka ngaphambi kokuba umsebenzi uphele. |
Ikhasi ngalinye eliphathwayo libiza ama-credits (1/ikhasi ku-fast tier, ngaphezulu ku-premium). Ama-plans akhokhelwayo akhuphula ikhasi lefayela ngalinye futhi angeza ukuqala. Bona ukuthengwa.
Imibuzo ebuzwa kaningi
language=auto ukukhomba, noma udlulisa ikhodi elikhethekile.