Skip to Content
Python SDKClient Configuration

🔧 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

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 (your own model), "cloud" (managed chat, cloud clients only), "local", or {"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_modelstringYour 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
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
summary_modelstringLocal only — legacy override for node summaries and document descriptions; index_model covers this.None
retrieve_modelstringLegacy 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:

  • Folderscreate_folder(), list_folders(), and folder_id filters
  • beta_headers on submit_document()
  • The deprecated retrieval APIsubmit_query(), get_retrieval()
  • enable_citations=True on chat_completions() (managed chat only)

💬 Community & Support

Last updated on