blob: 05da3b91a4acb6378ad222cf44078880cbb530df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import sys
import os
request_timeout_seconds = 15
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()
|