Use DALL · E to generate images and return 401. How to solve this problem #17
-
Fatal error: Uncaught Tectalic\OpenAi\ClientException: Unsuccessful response. HTTP status code: 401 (UNAUTHORIZED). in /www/wwwroot/deng/src/Handlers/ImagesGenerations.php:150 Stack trace: #0 /www/wwwroot/deng/demo.php(38): Tectalic\OpenAi\Handlers\ImagesGenerations->toModel() #1 {main} thrown in /www/wwwroot/deng/src/Handlers/ImagesGenerations.php on line 150 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi there @djy22032626, An Could you please copy and paste the code snippet that you are using to instantiate and query the API? Have you gone to https://platform.openai.com/account/api-keys and created an API key, and then used that API key in your code? Are you using the recommended Thanks, James |
Beta Was this translation helpful? Give feedback.
Hi there @djy22032626,
An
401 Unauthorized
error response typically indicates that your OpenAI API key is not valid or has expired.Could you please copy and paste the code snippet that you are using to instantiate and query the API?
Have you gone to https://platform.openai.com/account/api-keys and created an API key, and then used that API key in your code?
Are you using the recommended
OPENAI_API_KEY
environment variable, and is the value of that variable a valid API key from your Account API Keys screen?Thanks,
James