Overview

Start Building with PageIndex

PageIndex works in two steps, and only the first one has a choice to make.

1. Index

PageIndex turns each document into a tree index. This runs either on your own machine or in PageIndex Cloud.

Local
Cloud
Handles
Text-based PDFs
Text-based, scanned, and image-rich documents
Indexing
On your machine
Managed by PageIndex
Storage
Local directory
Cloud storage
Citations
Page-level
Block-level
OCR & image understanding
—

2. Retrieve

An LLM searches that tree and answers the question. This model is always your own, in either index mode.


Build with a coding agent

Paste this into Claude Code, Cursor, or any agent that can read a URL.

Read https://pageindex.ai/docs/SKILL.md and follow it to set up PageIndex in this project.

Quick Start for humans

Install the SDK

pip install -U pageindex

Set up the client

These examples use OpenAI models — see Use different LLMs for other providers.

PageIndex API key — for indexing and storage. Generate one and PageIndex handles parsing, OCR, and image understanding for you.

export PAGEINDEX_API_KEY="your-pageindex-key"

LLM provider API key — bring your own LLM for chat.

export OPENAI_API_KEY="your-openai-key"

Then create the client:

from pageindex import PageIndexClient

client = PageIndexClient(
    index="cloud",            # index and store in PageIndex Cloud
    chat="gpt-5.6-sol",       # your own model still answers
)

Submit a document

# wait=True blocks until the document is ready
doc_id = client.submit_document("./2023-annual-report.pdf", wait=True)["doc_id"]

For batch submission and file organization, see the Document Processing reference.

Ask a question

query = "What are the key findings in this document?"

for chunk in client.chat(query, doc_id=doc_id, stream=True):
    print(chunk, end="", flush=True)

For multi-document search and citations, see the LLM Integration reference.


Integrations

chat() runs PageIndex's own document-QA agent against your model. You can also take PageIndex's retrieval tools into your own agent, or reach them over MCP.