Skip to Content
Introducing PageIndex Flash

PageIndex Client

Choose where to index and store documents, then connect your preferred LLM or agent framework.

Choose an index mode

import os from pageindex import PageIndexClient

Index and store documents in PageIndex Cloud. Set your PageIndex API key:

os.environ["PAGEINDEX_API_KEY"] = "your-pageindex-key" index = "cloud"

Set up the client

Use the index selected above with either integration.

Set chat= to use built-in chat() with your preferred model:

os.environ["OPENAI_API_KEY"] = "your-openai-key" client = PageIndexClient(index=index, chat="gpt-5.6-sol")

Continue with LLM Integration.


Use different LLMs

Model names follow LiteLLM’s naming convention. Choose your provider, then pass chat to PageIndexClient.

os.environ["OPENAI_API_KEY"] = "your-openai-api-key" chat = "gpt-5.6-sol"
client = PageIndexClient(index=index, chat=chat)

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


Backend overrides

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

client = PageIndexClient( index=index, 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"}, )

Client parameters

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