blob: c9e88f2104b2b519c057ab52cd0d253b41daa5e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
import sys
import os
def load_api_key():
config_file_path = os.path.join(os.path.expanduser("~"), ".config/openai.token")
api_key = os.getenv("OPENAI_API_KEY")
try:
with open(config_file_path, 'r') as file:
api_key = file.read()
except Exception:
pass
return api_key.strip()
|