3. Connecting your AI model
LatticeMind uses a large language model (LLM) to reason about your calculations. You supply the model through an API key. OpenAI is the default, but Anthropic Claude, Google Gemini, Qwen, and a local Ollama model all work.
Important
The AI model is used only to reason and prepare. Your calculations run on the RESCU/NanoDCAL/VASP solver, and your API key is never sent to a remote execution host.
3.1. What LatticeMind sends
To reason about your work, LatticeMind sends requests to the LLM provider you configure (OpenAI by default). Those requests include your prompts, the calculation context it builds from them — structures, generated input files, results it reads back, and short excerpts of solver logs or errors — and any files you attach. If you turn on web research (off by default), your search queries are sent to the provider’s web-search tool as well.
What is not sent to the AI provider: the calculations themselves. They run on the RESCU/NanoDCAL/VASP solver on your own machine or the remote host you choose, and your API key is never sent to an execution host. The bundled RESCU documentation is consulted locally and never leaves your machine. If you supply a Materials Project key, structure lookups are sent to Materials Project.
Data sent to a provider is handled under that provider’s data policy — review it for retention and training terms. For fully local operation with no external LLM calls, use a local Ollama model (Choosing a provider).
3.2. The quickest way to connect a model
Run:
latticemind setup
It asks two questions — which model to use and where RESCU is — and saves the
answers to ~/.latticemind/.env, which the terminal and the browser both
read. latticemind setup --show prints what is ready. A first latticemind
with no model configured asks the same two questions itself. Inside a
conversation, /model lists the models you can use and asks for a missing key
(see Interactive commands).
3.3. Where LatticeMind looks for keys
LatticeMind reads settings from three places. The first one that sets a value wins:
Environment variables in the shell you start from.
A
.envfile in the folder you start in, or the nearest one found in a folder above it.Your saved settings,
~/.latticemind/.env, written bylatticemind setup,/modeland the browser setup screen.
When /model or the browser saves a key, it writes to the folder’s own
.env if there is one, otherwise to ~/.latticemind/.env. A key that a file
already sets is updated in that file, so a new key is never hidden behind an
old one.
Using a .env file:
OPENAI_API_KEY=your_key_here
Using an environment variable instead:
export OPENAI_API_KEY="your_key_here" # macOS / Linux
$env:OPENAI_API_KEY="your_key_here" # Windows (PowerShell)
3.4. Choosing a provider
/model and latticemind setup choose the provider for you. To set it by
hand, set RESCU_LLM_PROVIDER and the provider’s key:
Provider |
|
API key variable |
|---|---|---|
OpenAI (default) |
|
|
Anthropic Claude |
|
|
Google Gemini |
|
|
Qwen (DashScope) |
|
|
Local Ollama |
|
none — set |
3.5. Choosing models
/model saves the model you pick for each provider as
LATTICEMIND_<PROVIDER>_MODEL, so switching provider and back keeps your
choice:
RESCU_LLM_PROVIDER=openai
OPENAI_API_KEY=your_key_here
LATTICEMIND_OPENAI_MODEL=gpt-5.6-sol
A conversation stays on the model it began with. Switching model after the first message starts a fresh conversation in the same folder and keeps the earlier one.
Tip
The one-shot pipeline (latticemind quick) has its own quick and thorough
model settings, listed in Settings & configuration reference.
3.6. Optional: Materials Project
LatticeMind can seed crystal structures from the Materials Project database, which improves structure sourcing for less common materials. Provide a key if you have one:
MATERIALS_PROJECT_API_KEY=your_key_here
3.7. Verifying it works
Start LatticeMind and type a trivial prompt:
What can you do?
If no model is configured, LatticeMind asks the setup questions instead. If a
key is rejected, run /model or latticemind setup to enter a new one.
Otherwise you are ready to build
your first project — continue to Licenses and solver executables if you also want to run
calculations, or jump to Getting started.