The best practice for storing an OpenAI API key among the options you've provided would be **2. Environment variable**.
Using environment variables helps keep sensitive information like API keys secure and out of your source code, reducing the risk of accidental exposure in version control systems.