PDF.chat എപിഐ
Upload a PDF and chat with it from your own app — ask questions and get answers cited to the page, in 100+ languages. Metered per page, no surprises.
അവലോകനം
PDF.chat API ഒരു ചെറിയ റിവേര്ഡ് വിനിമയതലമാണ്. POST അതു് ദഹിപ്പിക്കാന് ഒരു രേഖയും രേഖയുടെ പദാവലിയോടൊപ്പം ഒരു ജോലിയും, ഓരോ പേജും തകരുന്ന (അടയാളം, പെട്ടികള്, ബോക്സ്ബോക്സ്), പിന്നെ നിങ്ങള്ക്കു് ഒരു ജോലിയും തിരികെ നല്കണം. POST 5 പേജുകളിൽ നിന്നുള്ള ജോലികൾ അല്ലെങ്കിൽ കുറഞ്ഞത് ആലേഖനം ചെയ്താൽ ഉടൻതന്നെ തിരിച്ചുവരും. pending നീ കളിക്കുന്നത് വരെ. done.
- അടിസ്ഥാന യുആര്എല്:
https://pdf.chat - രേഖകള്: പിഡിഎഫ്, കൂടെയുള്ള വാക്ടറി, പവര് പോസ്റ്റന്റ്, ടെക്സ്റ്റ്, ഇമേജുകള് (പിപിജി, ജിപിജി, WEBP, GIF, BMP, TIF)
- Chat പുറത്തേക്ക്: താളിലെ ക്യാപ്ഷനുകള്; നാള്വഴി അവസാനത്തിലെ അക്ഷരങ്ങള്
- പ്രവര്ത്തനത്തിലാക്കിയ പദാവലി:
txt,md,docx,pdf,csv,json - എഞ്ചിന് വായിക്കുന്നു:
cpu(വേഗം, അച്ചടിച്ച ഡോക്സ്)vlm(പശ്ചാത്തലം AI, കൈപ്പട, സങ്കീര്ണ്ണമായ വിന്യാസം, കണക്കുകൂട്ടല്)
ആധികാരകത ഉറപ്പുവരുത്തല്
നിങ്ങളുടെ വിശ്വാസ്യത അംഗീകരിക്കുക. API അടയാളം (അത് നിങ്ങള്ക്ക് കാണണം. അക്കൗണ്ട് പേജ്ഒരു കരടി ഹെഡ് എന്ന നിലയിൽ:
Authorization: Bearer YOUR_API_TOKEN
നിനക്കും കടന്നു പോകാം ?api_token=… ഒരു ചോദ്യ പംക്തിയായി. നിങ്ങളുടെ അക്കൌണ്ടിന്റെ താളിന്റെ സമനിലയ്ക്കു് വേണ്ടി ഉപയോഗം മീറ്ററാണു്.
രേഖ സമര്പ്പിക്കുക
POST /api/v1/ocr/, ഒന്നിലധികം ഭാഗങ്ങള് അപ്ലോഡ് ചെയ്തു.
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"
ജോലി തിരിച്ചു് നല്കുന്നു. 0. 45- പേജുള്ള ഫയലുകള്ക്കു്. done പദാവലിയോടൊപ്പം; വലിയ ഫയലുകള് തിരികെ വരുന്നു pending/processing, സ്റ്റേറ്റ് സ്റ്റേഷന് സെക്ഷന് അഭിനയിക്കൂ.
{
"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>/, കളിച്ചാൽ മതി status ഉണ്ട് done അല്ലെങ്കില് failed.
curl https://pdf.chat/api/v1/ocr/9f2c1b7e4a.../ \
-H "Authorization: Bearer YOUR_API_TOKEN"
ഒരു ഫോര്മാറ്റ് ഡൌണ്ലോട് ചെയ്യുക
GET /api/v1/ocr/<uuid>/download/?format=md, ഫലം എക്സ്പോര്ട്ട് ചെയ്യുക. format അത് ഒന്നാ. 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
പൂര്ത്തിയാക്കിയ ജോലിയെപ്പറ്റി ചോദ്യങ്ങള് ചോദിക്കുക. ഡേറ്റ ചെയ്ത പദാവലിയില് മാത്രമേ ഉത്തരങ്ങള് തുറന്ന് ആധികാരികത ഉറപ്പാക്കിയിട്ടുള്ളൂ. ഒരു അക്കൌണ്ട് ആവശ്യമുണ്ട് chat എന്ന വിശേഷത അക്കൗണ്ട് ആവശ്യമുണ്ട്.
POST /api/v1/chat/<uuid>/, ജോണ് ശരീരം {"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?"}'
സഹായസന്ദേശം അതിന്റെ ഉത്തരവും പറഞ്ഞിരിക്കുന്ന താളുകളുടെ ഒരു പട്ടികയും തിരികെ നല്കുന്നു:
{"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/, ഒരു ജോലിക്ക് വേണ്ടിയുള്ള എല്ലാ സംഭാഷണങ്ങളും എടുക്കൂ.
കോഡറിന്റെ ഉദാഹരണങ്ങള്
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?"}'
പരാമീറ്ററുകള്
| ഫീള്ഡ് | തരം | വിവരണം |
|---|---|---|
file | file | ആവശ്യമുണ്ട്. പ്രക്രിയയ്ക്കായി ഇമേജ് അല്ലെങ്കില് പിഡിഎഫ്. |
tier | string | cpu (സഹജം, വേഗത/ പ്രിന്റ്) അല്ലെങ്കില് vlm (പശ്ചിമം AI: കൈപ്പട, ഘടന, കണക്കുകള്. |
language | string | auto (സഹജമായ) അല്ലെങ്കില് ഭാഷാ കോഡ് (അസാധു)en, ch, ja, ar. |
tool | string | ഇഷ്ടമുളള ഉപകരണം നീക്കം (ഉദാ. g. summarize-pdf, ask-pdfആ ജോലിക്ക് chat പ്ലേമിലേക്ക്. |
പിശകുകളും പരിധികളും
| കോഡ് | അര്ത്ഥം |
|---|---|
400 | ഫയലോ, പിന്തുണ ലഭ്യമല്ലാത്ത തരത്തിലുള്ള തരത്തിലുള്ളതോ, ഫയല് വളരെ വലുതോ ഇല്ല. |
401 | API അടയാളം ലഭ്യമല്ല അല്ലെങ്കില് ലഭ്യമല്ല. |
402 | ഓരോ മാസവും, ഓരോ മാസവും/ മാസവും സ്വതന്ത്രമായി, അല്ലെങ്കില് കടങ്ങളൊന്നും കിട്ടുന്നില്ല. used/cap. |
404 | ജോലി യുഐആര്ഐ കണ്ടില്ല. |
409 | ജോലി കഴിയുന്നതിനു് മുമ്പ് ഇറക്കിവെക്കുവാനുളള ഉപാധികള് നല്കിയിരിക്കുന്നു. |
ഓരോ താളും ക്രമീകരിച്ചിരിക്കുന്ന വിലകള്, ഫ്ളൈന്സ് സ്ട്രിങ് സ്കൌണില് (1/ താള്), കൂടുതല് ഇന്പുട്ട്. പാദി പദ്ധതികള് ഒരു ഫയല് താളിന്റെ ക്പപ്സ് ഉയര്ത്തി മുന്ഗണന കൂട്ടുന്നു. പ്രിമിനിസ്.
പലപ്പോഴും ചോദ്യങ്ങൾ ചോദിച്ചു
language=auto കണ്ടെത്താനോ, അല്ലെങ്കിൽ ഒരു പ്രത്യേക കോഡ് പാസ് ചെയ്യാനോ.