The problem of not executing the code (error 401) #37
Replies: 2 comments
-
It appears that your OpenAI key may not have been loaded correctly. Could you add the line For best practices, we recommend storing your |
Beta Was this translation helpful? Give feedback.
-
I removed getenv from the code and the problem was solved But the texts produced through API have a much lower quality than the ChatGPT website :( |
Beta Was this translation helpful? Give feedback.
-
I ran the following code
But I got this error while running:
Fatal error: Uncaught Tectalic\OpenAi\ClientException: Unsuccessful response. HTTP status code: 401 (Unauthorized). in /private/var/www/chatgpt/vendor/tectalic/openai/src/Handlers/ChatCompletions.php:150 Stack trace: #0 /private/var/www/chatgpt/index.php(21): Tectalic\OpenAi\Handlers\ChatCompletions->toModel() #1 {main} thrown in /private/var/www/chatgpt/vendor/tectalic/openai/src/Handlers/ChatCompletions.php on line 150
My api is completely correct and I changed it several times but still it doesn't work.
I am using the free version of chatgpt and I want to test it and if it works, I will buy the premium account of chatgpt.
How can I fix this problem?
Beta Was this translation helpful? Give feedback.
All reactions