From b81a1b60e274175804c9d1523208a85a2b3b8780 Mon Sep 17 00:00:00 2001 From: Mehmet Sagir Date: Wed, 20 Sep 2023 07:32:27 +0000 Subject: [PATCH] get API key over environment variable --- stream-api.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stream-api.php b/stream-api.php index 0269bae..89bc762 100644 --- a/stream-api.php +++ b/stream-api.php @@ -20,11 +20,10 @@ } -$env = parse_ini_file('.env'); // Replace with your API URL and API key $apiUrl = 'https://api.openai.com/v1/chat/completions'; -$apiKey = $env['OPENAI_API_KEY']; +$apiKey = getenv('OPENAI_API_KEY'); // Read the request payload from the client $requestPayload = file_get_contents('php://input');