PDF.chat API
PDF અને chat સાથે તમારી પોતાની એપ્લિકેશનમાંથી અપલોડ કરો - પ્રશ્નો પૂછો અને પાના પર ઉલ્લેખિત જવાબો મેળવો, 100+ ભાષાઓમાં. પાના પર માપવામાં આવે છે, કોઈ અચરજ નથી.
સમીક્ષા
PDF.chat API એ નાનું REST ઇન્ટરફેસ છે. પહેલું તમે POST તેને ઉમેરી અને દસ્તાવેજના લખાણ સાથે પાછી કામ મેળવવા માટે દસ્તાવેજ અને પ્રતિ-પાનું વિભાજન (લખાણ, સીમા બોક્સ, વિશ્વાસ) સાથે પાછા મેળવવા માટે દસ્તાવેજ. પછી તમે POST આ કામ વિરુદ્ધ પ્રશ્નો અને દસ્તાવેજમાં મૂળભૂત જવાબો મેળવો, દરેક પાનાંને ઉલ્લેખ કરતો કે જે તેમાંથી આવ્યો છે.5પાનાંઓ અથવા ઓછા પાનાંઓની કામગીરી લીટીમાં પાછી આવે છે; મોટી કામગીરી તરત જ ચિહ્ન સાથે પાછી આવે છે pending સ્થિતિ કે જે તમે પોલ કરો ત્યાં સુધી done.
- આધાર URL:
https://pdf.chat - દસ્તાવેજો: PDF, વર્ડ, પાવરપોઈન્ટ, લખાણ અને ચિત્રો (PNG, JPG, WEBP, GIF, BMP, TIFF)
- Chat out: પાનાં ઉલ્લેખ સાથે જવાબો; ઇતિહાસ અંતબિંદુ મારફતે ટ્રાન્સક્રિપ્ટ્સ
- બહારનું પ્રક્રિયા કરેલ લખાણ:
txt,md,docx,pdf,csv,json - વાંચન એન્જિનો:
cpu(ઝડપી, છાપેલ દસ્તાવેજો) અનેvlm(પ્રીમિયમ AI, હસ્તલિખિત, જટિલ દેખાવ, ગણિત)
સત્તાધિકરણ
તમારા સાથે સત્તાધિકરણ કરો API ટોકન (તેને તમારા પર શોધો ખાતા પાનું) બેરીયર હેડર તરીકે:
Authorization: Bearer YOUR_API_TOKEN
તમે પણ પાસ કરી શકો છો ?api_token=… પ્રશ્ન પરિમાણ તરીકે. વપરાશ તમારા ખાતાના પાનાં સંતુલન સામે માપવામાં આવે છે.
દસ્તાવેજને રજૂ કરો
POST /api/v1/ocr/, multipart ફોર્મ અપલોડ.
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"
કામ પાછું આપે છે. ≤5-પાનાની ફાઇલો માટે તે પહેલેથી જ છે 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
સમાપ્ત થયેલ કામ વિશે પ્રશ્નો પૂછો. જવાબો ફક્ત બહાર કાઢેલ લખાણમાં જ સ્થાપિત થયેલ છે અને સ્ત્રોત પાનાંને ઉલ્લેખ કરે છે. ખાતા ટોકનની જરૂર છે, વાતચીત લક્ષણ ખાતા-ગેટ થયેલ છે.
POST /api/v1/chat/<uuid>/, 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?"}'
તેના જવાબ અને ઉલ્લેખિત પાનાંઓની યાદી સાથે સહાયક સંદેશો પાછો આપે છે:
{"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 | જરૂરી. પ્રક્રિયા કરવા માટેનું ચિત્ર અથવા PDF. |
tier | string | cpu (મૂળભૂત, ઝડપી/પ્રિન્ટ થયેલ) અથવા vlm (પ્રીમિયમ AI: હસ્તલિખિત, લેઆઉટ, ગણિત). |
language | string | auto (મૂળભૂત) અથવા ભાષા કોડ (en, ch, ja, ar,...). |
tool | string | વૈકલ્પિક સાધન સ્લેગ (દા.ત. summarize-pdf, ask-pdfઆ કામગીરી માટે chatની પ્રી-ફ્રેમિંગ કરવા માટે. |
ભૂલો અને મર્યાદાઓ
| કોડ | અર્થ |
|---|---|
400 | ફાઇલ નથી, બિનઆધારભૂત પ્રકાર, અથવા ફાઇલ ખૂબ મોટી છે. |
401 | ગુમ થયેલ અથવા અયોગ્ય API ટોકન. |
402 | પાનાંઓ બહાર, દિવસ/મહિના મુક્ત મર્યાદા પહોંચી, અથવા ક્રેડિટ નથી. શરીર સમાવે છે used/cap. |
404 | કામ UUID મળ્યું નથી. |
409 | કામ પૂરુ થાય તે પહેલાં ડાઉનલોડ કરવાની વિનંતી કરી. |
દરેક પાનાંને પ્રક્રિયા કરવા માટે ક્રેડિટ ખર્ચ થાય છે (ઝડપી સ્તર પર ૧/પાનું, પ્રીમિયમ પર વધુ). ચૂકવણી કરેલ યોજનાઓ ફાઇલ પાનાની મર્યાદા વધારે છે અને પ્રાથમિકતા ઉમેરે છે. જુઓ કિંમત.
વારંવાર પૂછાતા પ્રશ્નો
language=auto શોધવા માટે, અથવા ચોક્કસ કોડને પસાર કરવા માટે.