Choose where to index and store documents, then connect your preferred LLM or agent framework.
Choose an index mode
import os
from pageindex import PageIndexClientCloud
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.
LLM 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.
OpenAI
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.
Chat backend
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.
| Name | Type | Description | Default |
|---|---|---|---|
| api_key | string | PageIndex cloud API key . Omit for local mode. | None |
| index | string or dict | The 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 |
| chat | string or dict | The chat side, grouped: a model name, or a dict {"model", "backend"}. | None |
| mode | string | Cross-check on where documents live — "cloud" or "local". Always optional; the other arguments already carry the mode. | None |
| index_model | string | Local only — model used to index documents (structure and summaries). | gpt-5.6-luna |
| chat_model | string | The model that searches the tree and answers. Runs in your process, on your keys, in either index mode. | gpt-5.6-sol |
| model | string | Local only — one model for both roles. The role-specific arguments win over it. | None |
| storage_path | string | Local only — directory where indexed documents are stored. | ./.pageindex |
| index_backend | dict | Local only — connection overrides for the indexing lane’s LLM calls (LiteLLM connection params). | None |
| chat_backend | dict | Default connection overrides for the chat surfaces. A call’s own backend keys win over it. | None |
| instructions | string | Standing 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_model | string | Local only — legacy override for node summaries and document descriptions; index_model covers this. | None |
| retrieve_model | string | Legacy name for chat_model. | None |