19 lines
453 B
Python
19 lines
453 B
Python
import os
|
|
import json
|
|
from ..core.node import node_path
|
|
|
|
def load_api_key(provider):
|
|
|
|
node_dir = node_path()
|
|
json_path = os.path.join(node_dir, "api.json")
|
|
|
|
try:
|
|
|
|
with open(json_path, 'r') as f:
|
|
json_file = json.load(f)
|
|
return json_file.get(provider + '_api_key')
|
|
|
|
except Exception as e:
|
|
|
|
print(f"Error loading json file: {e}")
|
|
return None |