PyMolAI extends open-source PyMOL with an integrated AI assistant panel for molecular workflows. It adds provider-backed reasoning, tool execution, and optional OpenBio API gateway access while keeping normal PyMOL usage unchanged.
The upstream open-source foundation remains this repository: pymol-open-source.
| Capability | Status |
|---|---|
| Chat panel in Qt desktop UI | Included |
| OpenRouter-backed model access | Included |
Internal PyMOL tool: run_pymol_command |
Included |
Internal validation tool: capture_viewer_snapshot |
Included |
| OpenBio API gateway tools | Optional (only when OPENBIO_API_KEY is set) |
CLI mode fallback (/cli) |
Included |
- Base package supports
Python >= 3.9. - Full Claude SDK agent path requires
Python >= 3.10becauseclaude-agent-sdkis only installed on 3.10+.
From pyproject.toml:
openai>=1.0.0keyring>=24claude-agent-sdk>=0.1.38(Python 3.10+)
PyMolAI chat UI is designed for Qt desktop usage (pmg_qt).
- OpenRouter access for model turns.
- Optional OpenBio access for OpenBio tools (default base URL:
https://api.openbio.tech).
git clone https://github.com/ravishar313/PyMolAI
cd PyMolAIThe C++ build requires several native libraries. Install them before building:
brew install netcdf glew glmlibxml2 and freetype are typically already present via Homebrew. If the build still fails, install them too:
brew install libxml2 freetype libpngUse uv (recommended):
uv venv .venv
source .venv/bin/activate
PREFIX_PATH=/opt/homebrew:/opt/homebrew/opt/libxml2:/opt/homebrew/opt/netcdf uv pip install --python .venv/bin/python --reinstall .PyMOL's Qt GUI layer must use PyQt5. PyQt6 is detected later in the fallback chain but has enum API incompatibilities with this codebase. Install PyQt5 explicitly:
uv pip install --python .venv/bin/python PyQt5.venv/bin/python -c "import keyring, openai; print('ok: keyring/openai')"
.venv/bin/python -c "import claude_agent_sdk; print('ok: claude-agent-sdk')"
.venv/bin/python -c "from PyQt5 import QtWidgets; print('ok: PyQt5')"If claude_agent_sdk import fails, verify the interpreter is Python 3.10+.
git clone https://github.com/ravishar313/PyMolAI
cd PyMolAI
uv venv .venv --python 3.10
.\.venv\Scripts\Activate.ps1
$env:PREFIX_PATH = "C:\path\to\deps"; uv pip install --python .venv\Scripts\python.exe --reinstall .
uv pip install --python .venv\Scripts\python.exe PyQt5Optional import verification:
python -c "import keyring, openai; print('ok: keyring/openai')"
python -c "import claude_agent_sdk; print('ok: claude-agent-sdk')"
python -c "from PyQt5 import QtWidgets; print('ok: PyQt5')"- Launch PyMOL.
- Open AI settings from:
Display -> PyMolAI Settings -> OpenRouter API Key...Display -> PyMolAI Settings -> OpenBio API Key...
- To create an OpenBio API key, sign up at openbio.tech first.
- In the OpenRouter dialog:
- Save key (stores in system keychain)
- Test key
- Clear key
- In the OpenBio dialog (optional):
- Save key
- Test key
- Clear key
Important behavior:
- Without OpenRouter key (
OPENROUTER_API_KEYorANTHROPIC_AUTH_TOKEN), AI mode is disabled. - Without OpenBio key (
OPENBIO_API_KEY), OpenBio tools are not registered, but the rest of app behavior remains unchanged.
Model selection is available at:
Display -> PyMolAI Settings -> Model
Supported models:
google/gemini-3.1-pro-previewanthropic/claude-sonnet-4.6(default)z-ai/glm-5minimax/minimax-m2.5moonshotai/kimi-k2.5google/gemini-3-flash-previewanthropic/claude-haiku-4.5
Behavior:
- The UI selector only lists and selects the supported models above.
/ai model <id>remains flexible and accepts custom model IDs.- If you switch model while a run is active, the current run continues and the new model applies on the next turn.
Example scene output:
OPENROUTER_API_KEYANTHROPIC_AUTH_TOKENOPENBIO_API_KEYOPENBIO_BASE_URL(optional override, default ishttps://api.openbio.tech)
PYMOL_AI_OPENROUTER_KEY_SOURCEPYMOL_AI_OPENBIO_KEY_SOURCE
PYMOL_AI_DISABLEPYMOL_AI_DEFAULT_MODELPYMOL_AI_REASONING_DEFAULTPYMOL_AI_AGENT_MODEPYMOL_AI_CONVERSATION_MODEPYMOL_AI_TRACE_STREAM
Symptom:
- Save/Test dialogs report no keychain backend.
Cause:
keyringis installed but no OS keychain backend is available.
Action:
- Configure OS credential storage (macOS Keychain / Windows Credential Manager), then retry.
Symptom:
- Dialog returns invalid/revoked or auth errors.
Action:
- Confirm the key is from the correct provider.
- Re-test with current network/proxy.
- For OpenBio, verify endpoint/network path to
api.openbio.tech.
Symptom:
- AI runtime cannot use Claude SDK features.
Cause:
claude-agent-sdkis not installed for Python 3.9.
Action:
- Use Python 3.10+ for full PyMolAI agent behavior.
Symptom:
AttributeError: type object 'Qt' has no attribute 'ScrollBarAlwaysOff'(or similar enum errors).
Cause:
- PyQt6 is installed but not PyQt5. PyMOL detects PyQt6 as a fallback, but the GUI code uses PyQt5-style flat enum access (
Qt.ScrollBarAlwaysOff) which was namespaced in PyQt6 (Qt.ScrollBarPolicy.ScrollBarAlwaysOff).
Action:
- Install PyQt5 explicitly. PyMOL's Qt detection tries PyQt5 first, so it will be used instead of PyQt6:
uv pip install --python .venv/bin/python PyQt5
Symptom:
- Build error:
fatal error: 'netcdf.h' file not found
Action:
- Install netcdf via Homebrew and add it to PREFIX_PATH:
brew install netcdf PREFIX_PATH=/opt/homebrew:/opt/homebrew/opt/libxml2:/opt/homebrew/opt/netcdf uv pip install ...
Symptom:
- Build error:
fatal error: 'GL/glew.h' file not found
Action:
- Install GLEW and GLM via Homebrew:
brew install glew glm
Symptom:
- Regular AI works, OpenBio tools do not appear or fail.
Action:
- Ensure
OPENBIO_API_KEYexists (or save in OpenBio dialog). - Confirm
OPENBIO_BASE_URLif overridden. - Check network restrictions/firewall policy.
- API keys are masked in UI status (for example
****abcd). - Key save/clear flows use system keychain via
keyring. - Saved keys can be loaded into environment at runtime startup.
- Avoid putting real keys in scripts or checked-in files.
- The legal project license remains unchanged in
LICENSE. - PyMolAI additions in this fork are documented under the same repository licensing context.
- AI service/library usage notes are listed in
docs/THIRD_PARTY_AI.md. - Fork maintainer attribution for PyMolAI additions is included in
LICENSE,AUTHORS, andDEVELOPERS, with upstream Schrodinger notices preserved.
- Website: proteinlanguagemodel.com
- X/Twitter: @ravishar313

