Skip to Content
Introducing PageIndex Flash

PageIndex Client

Configure index to process and store your documents, and chat to answer questions with your own LLM.

For index, you choose where documents are processed — cloud, which runs multimodal processing with OCR and image understanding, or local, which builds the index from the PDF’s text layer using your own LLM. For chat there is no choice: it uses your own LLM in either mode. So the only setup difference between the two is which API keys you need.

CloudLocal
PageIndex API keyRequiredNot needed
LLM provider API keyRequired for chatRequired for indexing and chat

See Compare local and cloud for the full feature comparison.

Set up your client

Choose your index mode below for a complete configuration.

Set your PageIndex API key  for indexing:

export PAGEINDEX_API_KEY="your-pageindex-key"

And your LLM provider’s API key for chat:

export OPENAI_API_KEY="your-openai-key"

Then create the client:

from pageindex import PageIndexClient client = PageIndexClient(index="cloud", chat="gpt-5.6-sol")

Continue with LLM Integration.


Use different LLMs

Model names follow LiteLLM’s naming convention . Choose your provider below — the index mode is independent, so either one works with any model.

export OPENAI_API_KEY="your-openai-api-key"
client = PageIndexClient(index="cloud", chat="gpt-5.6-sol") # or index="gpt-5.6-luna" for local indexing

The same provider naming convention applies to local indexing models passed as index=. For other providers, see the LiteLLM provider documentation .


Using your own agent framework

Configure your LLM and its API key in your agent framework. Keep the index configuration and its required credentials from above, and omit chat when creating the PageIndex client:

client = PageIndexClient(index="cloud")

Continue with Agent Integration.


Backend overrides

Include connection settings in the backend field of your index or chat configuration.

client = PageIndexClient( index="cloud", # or "gpt-5.6-luna" for local indexing chat={ "model": "gpt-5.6-sol", "backend": { "api_key": "your-api-key", "base_url": "https://my-gateway.internal/v1", }, }, )

Keys are passed through to the underlying client, such as api_key, base_url, api_version, and aws_*.

Per-call backend overrides

A call’s backend keys override the corresponding defaults in chat["backend"]:

answer = client.chat( "What changed?", doc_id=doc_id, backend={"api_key": "another-api-key"}, )

PageIndexClient() parameters

Use one configuration style per side. When passing index=, put local model, summary_model, storage_path, and backend inside its dict instead of also passing index_model, summary_model, storage_path, or index_backend. Likewise, use chat={"model": ..., "backend": ...} instead of combining chat= with chat_model or chat_backend.

NameTypeDescriptionDefault
api_keystringPageIndex cloud API key . Omit for local mode.None
indexstring or dictThe index side, grouped: "cloud", "local", a local index model name, or a dict ({"api_key"} for cloud; {"model", "summary_model", "backend", "storage_path"} for local).None
chatstring or dictThe chat side, grouped: a model name, or a dict {"model", "backend"}.None
modestringCross-check on where documents live — "cloud" or "local". Always optional; the other arguments already carry the mode.None
index_modelstringLocal only — model used to index documents (structure and summaries).gpt-5.6-luna
chat_modelstringThe model that searches the tree and answers. Runs in your process, on your keys, in either index mode.gpt-5.6-sol
modelstringLocal only — one model for both roles. The role-specific arguments win over it.None
storage_pathstringLocal only — directory where indexed documents are stored../.pageindex
index_backenddictLocal only — connection overrides for the indexing lane’s LLM calls (LiteLLM connection params).None
chat_backenddictDefault connection overrides for the chat surfaces. A call’s own backend keys win over it.None
instructionsstringStanding guidance for the answering agent — persona, language, format — appended after PageIndex’s managed prompt on every surface that answers: chat() on every lane, and agent_instructions(). A call’s own instructions= adds to it.None
summary_modelstringLocal only — legacy override for node summaries and document descriptions; index_model covers this.None
retrieve_modelstringLegacy name for chat_model.None
Last updated on