PDF Q&A with RAG

Users upload PDFs and ask questions; answers are grounded in the documents with page citations, using retrieval-augmented generation.

Good fit: Internal knowledge bases, contract or policy assistants, research tools: up to a few thousand documents per workspace.

Infrastructure
$258/mo
$173 at half the usage · $780 at double

How the parts connect

  1. Web app & API$20/mo

    Vercel · Pro

  2. Ingestion jobs$0

    Inngest · Free

    ← ingest document from Web app & API

  3. AI framework$0

    Vercel AI SDK

    ← built with from Web app & API

  4. PDF parsing$50/mo

    LlamaParse · Starter

    ← PDF → text + pages from Ingestion jobs

  5. Embedding model$0.05/mo

    OpenAI API · text-embedding-3-small

    ← chunks from Ingestion jobs · question from Web app & API

  6. Vector database$20/mo

    Pinecone · Builder

    ← upsert vectors from Ingestion jobs · top-k search from Web app & API

  7. App database$25/mo

    Supabase · Pro

    ← users, docs, chats from Web app & API

  8. File storage$0

    Cloudflare R2

    ← uploaded PDFs from Web app & API

  9. Answer model$114/mo

    Claude API · Claude Sonnet 5.5

    ← question + passages from Web app & API

  10. LLM observability$29/mo

    Langfuse · Core

    ← traces from Web app & API

Monthly cost

Estimate

Expected cost at the usage below, and the range from half to double that usage. Worked out from each vendor's current prices and free tiers; your real bill depends on your traffic.

PartPickExpected / moRange
Web app & APIVercel · Pro$20/mofixed
AI frameworkVercel AI SDK$0fixed
PDF parsingLlamaParse · Starter$50/mo$50–$225
Embedding modelOpenAI API · text-embedding-3-small$0.05/mo$0.01–$0.20
Vector databasePinecone · Builder$20/mofixed
App databaseSupabase · Pro$25/mofixed
File storageCloudflare R2$0$0–$0.72
Ingestion jobsInngest · Free$0fixed
Answer modelClaude API · Claude Sonnet 5.5$114/mo$28.60–$458
LLM observabilityLangfuse · Core$29/mo$29–$31.24
Infrastructure total$258/mo$173–$780
Show the arithmetic behind every number

Web app & API · Vercel · Pro

  • vcpu = app_vcpu = 0.5
  • ram_gb = app_ram_gb = 0.5
  • Pro list price $20.00/month
  • note: includes $20 of usage credit; function, bandwidth and build usage beyond it is not modeled

AI framework · Vercel AI SDK

  • free open-source software (Apache-2.0); runs inside the app

PDF parsing · LlamaParse · Starter

  • pages = documents_per_month * pages_per_document = 300 × 15 = 4,500
  • credits = documents_per_month * pages_per_document * parse_credits_per_page = 300 × 15 × 3 = 13,500
  • Starter list price $50.00/month
  • credits: 13,500 − 40,000 free = 0 ÷ 1,000 × $1.25 = $0.00

Embedding model · OpenAI API · text-embedding-3-small

  • input_tokens = documents_per_month * pages_per_document * tokens_per_page + monthly_active_users * questions_per_user_per_month * question_tokens = 300 × 15 × 500 + 200 × 40 × 30 = 2,490,000
  • input: 2,490,000 tokens ÷ 1M × $0.02 = $0.05

Vector database · Pinecone · Builder

  • vector_gb = retention_months * documents_per_month * pages_per_document * tokens_per_page / chunk_tokens * vector_kb_per_chunk / 1000000 = 12 × 300 × 15 × 500 / 800 × 8 / 1000000 = 0.27
  • db_gb = retention_months * documents_per_month * pages_per_document * tokens_per_page / chunk_tokens * vector_kb_per_chunk / 1000000 = 12 × 300 × 15 × 500 / 800 × 8 / 1000000 = 0.27
  • write_units = documents_per_month * pages_per_document * tokens_per_page / chunk_tokens * vector_kb_per_chunk = 300 × 15 × 500 / 800 × 8 = 22,500
  • read_units = monthly_active_users * questions_per_user_per_month * read_units_per_query = 200 × 40 × 1 = 8,000
  • Builder list price $20.00/month

App database · Supabase · Pro

  • db_gb = monthly_active_users * questions_per_user_per_month * retention_months * kb_per_chat_turn / 1000000 = 200 × 40 × 12 × 4 / 1000000 = 0.384
  • mau = monthly_active_users = 200
  • Pro list price $25.00/month
  • database GB: 0.384 − 8 free = 0 × $0.125 = $0.00
  • file storage GB: 0 − 100 free = 0 × $0.0213 = $0.00
  • monthly active users: 200 − 100,000 free = 0 × $0.00325 = $0.00

File storage · Cloudflare R2

  • storage_gb = documents_per_month * retention_months * mb_per_document / 1000 = 300 × 12 × 2 / 1000 = 7.2
  • write_ops = documents_per_month = 300
  • read_ops = documents_per_month + monthly_active_users * questions_per_user_per_month * citations_opened_per_question = 300 + 200 × 40 × 0.3 = 2,700
  • storage GB-month: 7.2 − 10 free = 0 × $0.015 (catalog: Storage) = $0.00
  • Class A (write) ops: 300 − 1,000,000 free = 0 ÷ 1,000,000 → 0 (rounded up) × $4.50 (catalog: Class A Operations) = $0.00
  • Class B (read) ops: 2,700 − 10,000,000 free = 0 ÷ 1,000,000 → 0 (rounded up) × $0.36 (catalog: Class B Operations) = $0.00

Ingestion jobs · Inngest · Free

  • executions = documents_per_month * (ingest_steps + 1) = 300 × (4 + 1) = 1,500
  • job_runs = documents_per_month = 300
  • job_compute_seconds = documents_per_month * pages_per_document * seconds_per_page = 300 × 15 × 2 = 9,000
  • Free list price $0.00/month

Answer model · Claude API · Claude Sonnet 5.5

  • input_tokens = monthly_active_users * questions_per_user_per_month * (top_k * chunk_tokens + prompt_overhead_tokens) = 200 × 40 × (6 × 800 + 600) = 43,200,000
  • output_tokens = monthly_active_users * questions_per_user_per_month * answer_tokens = 200 × 40 × 350 = 2,800,000
  • input: 43,200,000 tokens ÷ 1M × $2.00 = $86.40
  • output: 2,800,000 tokens ÷ 1M × $10.00 = $28.00

LLM observability · Langfuse · Core

  • units = monthly_active_users * questions_per_user_per_month * observations_per_question = 200 × 40 × 4 = 32,000
  • traces = monthly_active_users * questions_per_user_per_month = 200 × 40 = 8,000
  • seats = team_seats = 2
  • Core list price $29.00/month
  • units (traces + observations + scores): 32,000 − 100,000 free = 0 ÷ 100,000 × $8.00 = $0.00

The tools, and why

Web app & API

$20/mo

Vercel · Pro

Next.js app and API routes with preview deploys and no servers to run

vercel.com ↗

AI framework

$0

Vercel AI SDK

Streaming chat UI hooks and one API for every model provider, in TypeScript

ai-sdk.dev ↗

PDF parsing

$50/mo

LlamaParse · Starter

Best table and layout extraction for messy, scanned or multi-column PDFs

llamaindex.ai ↗

Vector database

$20/mo

Pinecone · Builder

Serverless index with metadata filtering per workspace; no capacity planning

pinecone.io ↗

App database

$25/mo

Supabase · Pro

Postgres plus auth and row-level security for per-workspace access

supabase.com ↗

File storage

$0

Cloudflare R2

S3-compatible with no egress fees when users open their PDFs

cloudflare.com ↗

Ingestion jobs

$0

Inngest · Free

Durable step functions: a failed embed retries without re-parsing the PDF

inngest.com ↗

LLM observability

$29/mo

Langfuse · Core

Traces plus evals and datasets to measure answer quality

langfuse.com ↗

All costs are estimates. Prices are read from each vendor's pricing page and checked every 12 hours (last: Oct 30, 2026); your bill depends on your traffic.

Model quality scores: Intelligence Index by Artificial Analysis.

The usage these costs assume

"Half" and "double" in the ranges scale these numbers.

Monthly active usersA small team or early customer base
200 users
Questions per userAbout two questions per working day
40 questions/user/month
New documentsOngoing uploads after the initial backfill
300 documents/month
Pages per documentTypical contract, report or policy length
15 pages
File sizeText PDFs with some images
2 MB/document
Documents keptStorage and index size grow with history
12 months
Engineering assumptions (17)
Tokens per pageDense text page; scanned pages yield fewer after OCR
500 tokens
Chunk sizeLarge enough to keep a clause or table together
800 tokens
Chunks per answerEnough context for most questions without diluting it
6 chunks
System prompt + questionInstructions, citation format and the user's question
600 tokens
Answer lengthA few paragraphs with citations
350 tokens
Tokens per questionA one-sentence question, embedded for search
30 tokens
LlamaParse credits per pageBasic parsing is as low as 1 credit; layout-aware modes cost more
3 credits
Stored size per chunk1,536-dim float vector (6 KB) plus text and metadata
8 KB
Read units per searchA small index; bigger namespaces cost more per query
1 read units
Stored size per question + answerQuestion, answer and citations
4 KB
Cited PDFs openedSome answers send the user to the source page
0.3 opens/question
Steps per ingestion jobParse, chunk, embed, index
4 steps
Job time per pageMostly waiting on the parser and embedding APIs
2 seconds
Trace units per questionTrace + retrieval + embedding + generation
4 units
Team seatsPeople who look at traces
2 seats
App vCPUA small Next.js server
0.5 vCPU
App RAMA small Next.js server
0.5 GB

How to build it

  1. 1

    Set up the app and database

    Create the Next.js app, connect the database, add sign-in and a workspaces table so every document belongs to one workspace.

    Uses: Web app & API, App database, AI framework

  2. 2

    Upload to storage

    Upload PDFs straight to object storage with signed URLs and record each file in the documents table.

    Uses: File storage, App database

  3. 3

    Ingestion pipeline

    On upload, start a job: parse to text with page numbers, split into chunks with overlap, embed and upsert with workspace and page metadata. Show progress in the UI.

    Uses: Ingestion jobs, PDF parsing, Embedding model, Vector database

  4. 4

    Answering

    Embed the question, fetch the top chunks for the user's workspace only, and stream an answer that cites document and page.

    Uses: Embedding model, Vector database, Answer model, AI framework

  5. 5

    Measure quality

    Trace every question, collect thumbs up/down, and build a small evaluation set of real questions with expected sources.

    Uses: LLM observability

  6. 6

    Harden

    Rate-limit questions per user, delete vectors when a document is deleted, and re-index when the parser or embedding model changes.

    Uses: Web app & API, Vector database

Get this built for you

We'll adapt this blueprint to your product, set it up on your accounts and hand it over working, with the monthly bill you saw here.