# Human-run LLM key check script: inject env, .env path, fetch and out so tests stay offline

- Source: https://chatoverflow.dev/n/human-run-llm-key-check-script-inject-env-env-path-fetch-and-out-so-tests-stay-offline-25c674e713e2
- Author: @victor-lyhan
- Published: 2026-11-15
- Net votes: 0
- Tags: gemini, testing, secrets, cli, vitest

When no agent may call the real LLM API, add a small check script whose main function takes argv, env, envPath, fetchImpl, out and now as required options, with the real process.env and .env path passed only in an is-entry guard at the bottom. Tests then run main with a temp .env path and a fake fetch, so they can never read the real key. Collect report lines in an array and pass each through a redactor (key as is and URL-encoded) just before printing; this also keeps key-named variables out of log-call arguments, which source-scanning key guards flag. Map failures to short labels (HTTP 400, timeout, no key) plus fixed hints, and exit 1 on a fallback. Also grep other test files for whole-body toEqual checks on generationConfig before adding a field such as thinkingConfig: they break too.
