PDF.chat API
ከራሳችሁ አፕሊኬሽን ፒዲኤፍን እና chatን ይዘው ያስተላልፉ - ጥያቄዎችን ጠይቁ እና መልሶችን በ100+ ቋንቋዎች ወደ ገጹ ይላኩ። በገጽ ላይ የሚወሰነው መጠን፣ ምንም አስደሳች ነገር የለም ፡፡
ማጠቃለያ
የ PDF.chat API ትንሽ REST መገናኛ ነው. POST ሰነድ POST ጥያቄዎች በአንድ ሥራ ላይ እና መልሶች በጽሑፉ ውስጥ የተመሰረተ ማግኘት, ሁሉም ከመጣው ገጽ ላይ የሚጠቀስ. የ 5 ገጾች ወይም ያነሰ inline ተመልሰው ሥራዎች; ትልቅ ሥራዎች በአንድ ጋር በፍጥነት ተመልሰው pending ወቅት done.
- መሠረታዊ URL:
https://pdf.chat - ሰነዶች PDF, plus Word, PowerPoint, ጽሑፍ, እና ምስሎች (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/, ፋይል
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"
የስራውን ብዛት ይመልሳል 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 | ያስፈልጋል ምስል |
tier | string | cpu (የተቀመጠው, ፈጣን/የተጻፈ) ወይም vlm (የተሻለ AI: የፊደል ቅርጽ, ቅርጽ, ቁጥሮች) |
language | string | auto (የመጀመሪያ) ወይም የቋንቋ ኮድ (en, ch, ja, ar,... |
tool | string | የምርጫው ቱል ሱልግ (ለምሳሌ summarize-pdf, ask-pdfchatን ለዚያ ሥራ ለማዘጋጀት |
ስህተቶች እና ገደቦች
| ኮድ | ትርጉም |
|---|---|
400 | ፋይል የለም፣ አይደገፍም ወይም ፋይል በጣም ትልቅ ነው |
401 | የቀረበ ወይም ያልሆነ API Token |
402 | ገጾች አልተገኙም፤የቀን/የወራት ነጻነት ልክ ደርሷል፤ወይም ምንም ክሬዲት የለም፤ አካል የሚከተለውን ያካትታል used/cap. |
404 | የስራ UUID አልተገኘም |
409 | ፋይል (_F) |
ገጽ እያንዳንዱ የተስተካከለ ዋጋዎች ክሬዲቶች (1/ገጽ በፍጥነት ደረጃ, የበለጠ በፕሪሚየም ላይ). የተከፈለ ፕሮግራሞች በፋይል ገጽ ከፍታ እና ትኩረት ጨምር. ተመልከት ዋጋ.
የሚጠየቁ ጥያቄዎች
language=auto ለመለየት ወይም የተወሰነ ኮድ ለመለየት