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 దానిని లోడ్పాటుకి మరియు పత్రం యొక్క వచనముతో ఒక ఉద్యోగం తిరిగి పొందుటకు మరియు ఒక పేజి (వచన, బఫైలు, backup పెట్టెలు, ఔట్కార్డుింగ్) తో తిరిగిపొందు. మీరు తరువాతే మీరు పొందవచ్చు. POST 5 పేజీల ఉద్యోగాలు లేదా అంతకంటే తక్కువ పేజీల్లో ఉన్న ఉద్యోగాలు వెంటనే ఇంధనానికి తిరిగివస్తాయి. pending మీరు వ్రాయిన స్థితి done.
- మూల URL:
https://pdf.chat - (o) లొని పత్రాలు: పిడిఎఫ్, అరేகி, పదము, వచనము, పాఠ్యము మరియు ప్రతిరూపాలు (PNG, JPG, WEG, GIF, BMP, TIF)
- Chat బయటకు: పేజీలోని సింక్సెస్తో జవాబులు; చరిత్ర ముగింపు పాయింట్ ద్వారా అన్వేషకులు
- దీనితో సహా టైపుచేసిన వచనము:
txt,md,docx,pdf,csv,json - (n) ఇంజన్ స్కాన్సును వినుచున్నది:
cpu(అప్రస్తుతం, ముద్రిత డొక్స్)vlm(గ్రిమిమ్ AI, నకలు, సంక్లిష్ట కూర్పు, గణిత)
ధృవీకరణ
మీతో ఒప్పందం చేసుకోండి API గుర్తు (మీపైగాఫోల్డింగ్) ఖాతా పేజీ(ఒక ఎలుగుబంటి శీర్షిక)
Authorization: Bearer YOUR_API_TOKEN
మీరు కూడా పాస్ చేయవచ్చు ?api_token=… ఒక ప్రశ్న ఆదేశము. మీ ఖాతా యొక్క పేజీ కొలత వ్యతిరేకంగా వాడుకతో గీత.
పత్రాన్ని అందించు
POST /api/v1/ocr/, మల్టీపార్ట్ రూపం లోడైంది. Name
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.05- పేజీ దస్త్రాలు 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>/, (w) పెంచు వరకు 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
ఒక పత్రంతో ChatName
పూర్తి పని గురించి ప్రశ్నలు వేయండి. సరిచేయబడిన పాఠములో మాత్రమే జవాబులు ప్లే చేయబడతాయి మరియు మూలపు పేజీను పేర్కొనుతుంది. ఒక ఖాతా గుర్తు అవసరం, 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 | అవసరం. ప్రాసెస్ చేయుటకు ప్రతిబింబము లేదా PDF. |
tier | string | cpu (అప్రమెయం, వేగము/అంతరం) vlm (ప్రమాణశాస్త్రం AI: నకలు, పెరామిక, గణితం. |
language | string | auto (అప్రమెయం) లేదా భాష కోడ్ (అప్రమేయ)en, ch, ja, ar. |
tool | string | ఐచ్చిక సాధనం స్పెల్బాక్స్ (ఉ. దా. యె. యె. summarize-pdf, ask-pdfఆ పని కోసం ముందు ఫ్రేమ్ chat. |
దోషములు( l) ಮತ್ತು పరిమితులు
| కోడ్ | అర్థం |
|---|---|
400 | ఏ ఫైలు, మద్దతిచ్చని రకము, లేదా ఫైలు చాలా పెద్దది. |
401 | API గుర్తు చెల్లని లేదా చెల్లనివి. |
402 | పేజీల నుండి, నెలలు/ నెలలు వృథాగా ఉచితంగా రుణాలు చేరుకొంటాయి లేదా రుణాలు రాదు. used/cap. |
404 | యోబు యూఎన్ దొరకలేదు. |
409 | పని పూర్తవుటకు ముందుగా దింపుకోబడిన పని. |
ప్రతి పేజీ అభ్యర్ధించిన ఖర్చులు (1/ పేజీ) స్ట్రిప్ నందలి ఫాల్ స్ట్రింపర్ పై (1/ పేజీ), మరింత దారుణత మీద రుద్దులు. పాడ్ పుటలు ఒక file పేజీ కుప్లు పెంచతాయి మరియు వాటి ప్రాధాన్యతను పెంచుతాయి. చూడండి ప్రింటింగ్.
ప్రశ్నలు తరచుగా అడగండి
language=auto గుర్తించడానికి లేదా ఒక నిర్దిష్టమైన కోడ్ను దాటడానికి.