Skip to content

Configuring an AI provider

PKrunal26 edited this page Jul 26, 2026 · 1 revision

Configuring an AI provider

OpenFOAM Studio is bring-your-own-key. There is no bundled account, no proxy, and no per-simulation charge from this project — you pay your provider directly, or nothing at all if you run a local model.

Open Settings from the top bar, pick a provider, paste a key, choose a model.


Your options

Anthropic, OpenAI, or Google

Paste an API key. Suggested models appear in a dropdown:

Provider Models offered
Anthropic Claude Sonnet 5, Claude Opus 4.8, Claude Haiku 4.5
OpenAI GPT-5.2, GPT-5.1, GPT-5, GPT-5 mini, GPT-4.1
Google Gemini 3 Pro Preview, Gemini 2.5 Pro / Flash / Flash-Lite

The dropdowns are suggestions, not an allowlist — type any model ID your key can reach, including ones released after this build.

Claude Code CLI — no key

If you already have Claude Code installed and have run claude login, select Claude Code CLI and the app uses that session. No API key to manage, no separate billing.

This is the default when no key is configured. The setup screen checks that the claude binary is reachable and will offer to install it.

Any OpenAI-compatible endpoint — including local models

Select Custom OpenAI-compatible endpoint and give it a base URL. This covers OpenRouter, Groq, Together, and — the interesting case — fully local models via Ollama or LM Studio.

For local endpoints the API key is optional; only the base URL is required. Point it at your local server, type the model name it serves, and no data leaves your machine at all.


Which should you pick?

Case generation is a demanding task: the model has to hold OpenFOAM's file layout, dependency ordering, and patch-name consistency in its head across a dozen files. Stronger models fail noticeably less.

  • Best results: a frontier model — Claude Sonnet 5, GPT-5.2, or Gemini 3 Pro.
  • Already have Claude Code: use the CLI provider. Nothing else to set up.
  • Privacy-critical or offline: a local model through Ollama or LM Studio. Expect more retries on non-trivial cases; small models struggle to keep patch names consistent across files.

Two providers — the Claude CLI and custom OpenAI-compatible endpoints — additionally get a post-generation validation loop: the app runs blockMesh, setFields, and foamRun immediately after generating, diagnoses anything that fails, and applies fixes before handing the case to you.


Where your key is stored

config.json in the app's settings directory, written with 0600 permissions:

  • macOS — ~/Library/Application Support/OpenFOAM Studio/config.json
  • Windows — %APPDATA%\OpenFOAM Studio\config.json

Keys are never committed, never logged, and never sent anywhere except to the provider you selected. The Settings screen shows only whether a key is present, never the value.

The app also honours these environment variables if a key is not configured in Settings: ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY (or GOOGLE_API_KEY).


Switching providers

Change it in Settings at any time. Keys for each provider are stored separately, so switching back and forth does not make you re-paste them. The active provider and model apply to the next generation — a run already in flight is unaffected.

Clone this wiki locally