Available in pre-release 3.7+ on Windows 10 or later.
SumatraPDF can show a chat sidebar where you ask questions about the document you are reading. Answers come from an AI agent CLI running on your computer — SumatraPDF does not send your files to its own servers.
Claude Code #
This feature requires Claude Code to be installed and available on your system. SumatraPDF launches the
claude command-line tool when you send a message.If Claude Code is missing, the chat panel shows an error such as Cannot find claude. Is Claude Code installed?
Install and set up Claude Code using Anthropic’s official guide:
After installation, make sure
claude (or claude.exe) is on your PATH. SumatraPDF also looks in %USERPROFILE%\.local\bin\, %USERPROFILE%\AppData\Local\Programs\claude-code\, and %USERPROFILE%\AppData\Roaming\npm\.The model picker includes Claude Code’s documented aliases:
default, best, sonnet, opus, haiku, sonnet[1m], opus[1m], and opusplan. Claude Code resolves these aliases according to the user’s account and configured provider.Grok Build #
This feature can also use Grok Build (the
grok command-line tool).If Grok Build is missing, the chat panel shows an error such as Cannot find grok. Is Grok Build installed?
Install Grok Build and sign in using xAI’s instructions. SumatraPDF looks for
grok.exe on PATH, in %USERPROFILE%\.grok\bin\, and in %USERPROFILE%\.local\bin\.Open the panel with View → Grok chat (
CmdAIChatWithGrokBuild), or search for Grok in the command palette.Grok Build settings are in the
GrokBuild section of advanced settings. The Always Approve checkbox passes --always-approve to Grok Build.The first time you open the Grok chat panel in an app session, SumatraPDF runs
grok models and uses the models available to the signed-in Grok CLI in the model picker. If that query fails, the picker falls back to grok-4.5.OpenAI Codex #
This feature can also use OpenAI Codex (the
codex command-line tool).If OpenAI Codex is missing, the chat panel shows an error such as Cannot find codex. Is OpenAI Codex installed?
Install and sign in using OpenAI’s official guides:
After installation, make sure
codex (or codex.exe) is on your PATH, or in %USERPROFILE%\.codex\bin\ or %USERPROFILE%\.local\bin\.Open the panel with View → Codex chat (
CmdAIChatWithOpenAICodex), or search for Codex in the command palette.Codex settings are in the
CodexBuild section of advanced settings. The Skip Sandbox checkbox passes --dangerously-bypass-approvals-and-sandbox to Codex — use only if you understand the security implications.The first time you open the Codex chat panel in an app session, SumatraPDF asks the signed-in Codex CLI which models are available and uses them in the model picker. If that query fails, the picker falls back to
gpt-5.5, gpt-5.4, and o3. You can also pick a sandbox mode: Read-only, Workspace write, or Full access.How to use #
- Open a supported document (see below).
- Open a chat sidebar for your preferred backend:
- View → Claude chat (
CmdAIChatWithClaudeCode) - View → Grok chat (
CmdAIChatWithGrokBuild) - View → Codex chat (
CmdAIChatWithOpenAICodex)
- View → Claude chat (
- Type a question in the input box at the bottom of the sidebar and press
Enter. - Drag the splitter between the document and the chat panel to resize the sidebar.
Each document tab has its own chat session. Switching tabs switches the sidebar to that tab’s conversation history.
You can pick a previous session from the session dropdown and choose model options. Backend-specific controls:
- Claude Code: model, effort level, and optionally Skip Permissions (passes
--dangerously-skip-permissions— use only if you understand the security implications). - Grok Build: model, effort level, and optionally Always Approve (passes
--always-approve). - OpenAI Codex: model, sandbox mode, and optionally Skip Sandbox.
While the agent is working on a reply, use Stop to cancel the current request.
Supported documents #
AI Chat is available only for PDF (
.pdf) files.It is not available for single images, comic archives (
.cbr, .cbz, etc.), folders of images, DjVu, ebooks (EPUB, MOBI, …), CHM, XPS, PostScript, plain text, and other formats. On those tabs the AI chat with document commands and context-menu submenu are hidden.Settings #
Sidebar width is shared by all backends via the
AIChatSidebarDx advanced setting.Backend-specific options are in advanced settings (
SumatraPDF-settings.txt):ClaudeCode— default model, effort level, Skip Permissions, background colorGrokBuild— default model, effort level, Always Approve, background colorCodexBuild— default model, extra models, sandbox mode, Skip Sandbox, background color
You can assign your own keyboard shortcut to any of the chat commands — there is no default key binding. See Customize keyboard shortcuts.
Requirements and limitations #
- Windows 10+ only (uses WebView2 for the chat UI).
- Requires a working installation of at least one supported agent CLI and network access as required by that CLI.
- Session history is stored by each CLI in its own location; SumatraPDF can list and resume sessions for the current document’s folder:
- Claude Code:
~/.claude/projects/(encoded by project directory) - Grok Build:
~/.grok/sessions/ - OpenAI Codex:
~/.codex/sessions/(with descriptions from~/.codex/history.jsonl)
- Claude Code:
- Each agent runs as a separate process; behavior, models, and billing follow that provider’s terms and your account.
See also #
- Commands —
CmdAIChatWithClaudeCode,CmdAIChatWithGrokBuild,CmdAIChatWithOpenAICodex - Command Palette
- Advanced options / settings —
ClaudeCode,GrokBuild, andCodexBuildsections - Version history — 3.7 AI Chat entry
- Claude Code documentation (Anthropic)
- Grok Build (xAI)
- OpenAI Codex CLI (OpenAI)