🔧 PageIndexClient
PageIndexClient has two independent sides, each either local or cloud-managed:
- index — where documents live and how they are processed. With a PageIndex API key they live in your cloud account and are indexed by the managed pipeline. Without one, they are indexed on your machine by the open-source pipeline (using your own LLM provider key) and stored under
storage_path. - chat — who answers. With a chat model configured, the document-QA agent runs in your process against your own model and credentials — in both index modes. On a cloud client with no chat model, PageIndex’s managed chat answers.
An API key moves your documents, never your model. chat_model always means your own model on your own keys.
from pageindex import PageIndexClient
# Local documents + your model
client = PageIndexClient(index="gpt-5.6-luna", chat="gpt-5.6-sol")
# Cloud documents + your model
client = PageIndexClient(index="cloud", chat="gpt-5.6-sol")index="cloud" (or "pageindex-cloud") is the keyless cloud spelling — the key is read from the PAGEINDEX_API_KEY environment variable. That variable is only consulted when your code explicitly says cloud: a bare PageIndexClient() stays local regardless of the environment.
Constructor parameters
| 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 (your own model), "cloud" (managed chat, cloud clients only), "local", or {"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 | Your own model for the chat surfaces. On a cloud client, setting it runs the agent in your process over the cloud documents. | 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 |
| 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 |
Model naming
Model names follow LiteLLM’s naming convention . Choose the format that matches your provider.
OpenAI — use the model name directly and set OPENAI_API_KEY:
os.environ["OPENAI_API_KEY"] = "your-openai-api-key"
chat_model = "gpt-5.6-sol"Anthropic — prefix with anthropic/ and set ANTHROPIC_API_KEY:
os.environ["ANTHROPIC_API_KEY"] = "your-anthropic-api-key"
chat_model = "anthropic/claude-sonnet-4-6"OpenRouter — prefix with openrouter/ and set OPENROUTER_API_KEY:
os.environ["OPENROUTER_API_KEY"] = "your-openrouter-api-key"
chat_model = "openrouter/anthropic/claude-sonnet-4-6"Bare names are OpenAI-compatible shorthand, so any OpenAI-compatible server works through the usual OPENAI_API_KEY / OPENAI_BASE_URL configuration. Write openai/Qwen/... when the server itself serves slashed model ids (vLLM, TGI).
For other providers, see the LiteLLM provider documentation .
Backend overrides
index_backend and chat_backend carry connection details — keys, base URLs, cloud credentials — without touching environment variables. Keys are passed through verbatim to the underlying client.
client = PageIndexClient(
index_model="gpt-5.6-luna",
chat_model="gpt-5.6-sol",
chat_backend={"api_key": "sk-...", "base_url": "https://my-gateway.internal/v1"},
)
# Per-call overrides win over the client default
client.chat_completions(messages, doc_id=doc_id, backend={"api_key": "sk-other"})The vocabulary follows whichever door runs: LiteLLM connection params for chat_completions(), the OpenAI SDK’s client params for responses(), the Anthropic SDK’s for messages(). api_key and base_url mean the same thing on all three.
Cloud-only surfaces
These raise PageIndexAPIError in local mode:
- Folders —
create_folder(),list_folders(), andfolder_idfilters beta_headersonsubmit_document()- The deprecated retrieval API —
submit_query(),get_retrieval() enable_citations=Trueonchat_completions()(managed chat only)