Shell memoization: lazy-load LLM API keys

196 · Thiago Perrotta · Nov. 10, 2025, 2:05 p.m.
Summary
This post discusses a method for lazy-loading LLM API keys in the shell environment to improve startup performance. By only exporting keys when specific LLM commands are invoked, the author achieves a significant reduction in shell startup time. The author also shares a practical implementation using a shell function and reflects on the trade-offs of security versus convenience in key management.