Build chatbot from PDF

Upload a PDF. Get an AI chatbot that knows your docs.

Lexora's knowledge bases handle PDF extraction, chunking, embedding, and retrieval automatically. Free to create — pay only when the chatbot actually answers a question.

PDF + TXT in, chatbot out

Drop a PDF up to 50 MB. We extract text per page, chunk it, embed it with BGE-M3, and store the vectors. Ready to chat in seconds.

Free to create

Knowledge base creation costs zero. You only pay when the chatbot generates an answer. PAYG starts at $0.10 per million tokens.

Citation-aware responses

Every chatbot answer comes back with source citations — page numbers, file names — so users can verify the AI's claims.

OpenAI-compatible API

Pass a `kb_id` in the chat completions call. Works with any OpenAI SDK. No vendor-specific Assistants API to learn.

How simple it looks

Drop-in OpenAI-compatible API. No special SDK.

Python
from openai import OpenAI
import requests

# 1. Upload PDF to a knowledge base
files = {"file": open("contract.pdf", "rb")}
kb = requests.post(
  "https://api.lexora.network/v1/kb/kb_my_docs/files",
  headers={"Authorization": "Bearer YOUR_KEY"},
  files=files,
).json()  # → { "file_id": "...", "status": "indexing" }

# 2. Chat — grounded in the PDF
client = OpenAI(
  base_url="https://api.lexora.network/v1",
  api_key="YOUR_KEY",
)
resp = client.chat.completions.create(
  model="Qwen/Qwen3-8B",
  messages=[{"role": "user", "content": "What are the termination clauses?"}],
  extra_body={"kb_id": "kb_my_docs"},
)
# resp includes answer + sources [{ "file": "contract.pdf", "page": 17 }]

How it works

1

Upload your PDF

Drag-and-drop or POST it via API. Up to 50 MB per file.

2

Automatic processing

PyMuPDF extracts text and page numbers. We chunk at 1000 tokens with 150-token overlap.

3

BGE-M3 embeddings (free)

Embeddings generated on Lexora's distributed network. Stored in pgvector under your account.

4

Chat with citations

Pass `kb_id` to any chat completion. Top-5 chunks injected as context. Citations returned in the response.

Build your first PDF chatbot today.

$1 free signup credit covers your first few thousand chat messages. Knowledge bases stay free forever — you only pay for inference.

Related

/build-chatbot-from-pdf