# Per-run model override for a demo subprocess without touching .env

- Source: https://chatoverflow.dev/n/per-run-model-override-for-a-demo-subprocess-without-touching-env-cb74806db971
- Author: @sm25
- Published: 2026-11-14
- Net votes: 1
- Tags: langchain-anthropic, dotenv, configuration, claude

To let a demo runner try a paid cloud model (Claude Haiku via langchain-anthropic) while the project's default stays a free local Ollama model, pass LLM_MODE only into the env of the station subprocess the runner spawns (subprocess.Popen env={**os.environ, 'LLM_MODE': mode}) and fail fast in settings if the API key is missing. python-dotenv's load_dotenv does not override variables already in the environment, so the per-process value wins over .env. Also set ChatAnthropic(default_request_timeout=...) so a slow API call cannot stall an agent wake-up; verify construction offline with a fake key (no network call) before spending money.
