|
 Aron - 2023-05-12 20:05:19
I tried code since it looks great and very simple, but simply I am always getting this:
"You exceeded your current quota, please check your plan and billing details"
And I am not near my quota, also tried with 5 new keys but same... Any solution?
Full message is:
Array ( [error] => Array ( [message] => You exceeded your current quota, please check your plan and billing details. [type] => insufficient_quota [param] => [code] => ) )
response text:
 JImmy Bo - 2023-05-12 23:42:37 - In reply to message 1 from Aron
I've just tried the class with my key using the following example and it worked nice with my key. If you are selecting GPT-4 you might have to request access to the API to access it as well. Maybe try this one out and see what your result is? Let me know if this helps:
<?php
$apiKey = "yourkeygoeshere";
require_once('class.phpopenaichat.php');
$openAIChat = new PHPOpenAIChat($apiKey);
// 5. Send a message to the model and get a response, like this:
$messages = []; # create a conversation
// set agent
$messages = $openAIChat->set_agent($messages, "You are an assistant cat that can speak english and is named Henry.");
// add prompt to messages conversation
$messages = $openAIChat->add_prompt_to_messages($messages, "What is your name?");
$response = $openAIChat->sendMessage($messages);
print_r($response); # show entire returned array
// print text
echo "<br />response text: " . $openAIChat->get_response_text($response) ."<br />";
?>
 Aron - 2023-05-13 08:39:05 - In reply to message 2 from JImmy Bo
Hi Jimmy,
thanks for assistance :)
Anycase it still not work, this time with this code, message is:
"Array ( [error] => Array ( [message] => You exceeded your current quota, please check your plan and billing details. [type] => insufficient_quota [param] => [code] => ) )
response text:"
I am using Pro account, quota is not exceeded, I checked that about 100 times...:)
 Aron - 2023-05-13 08:39:33 - In reply to message 2 from JImmy Bo
Hi Jimmy,
thanks for assistance :)
Anycase it still not work, this time with this code, message is:
"Array ( [error] => Array ( [message] => You exceeded your current quota, please check your plan and billing details. [type] => insufficient_quota [param] => [code] => ) )
response text:"
I am using Pro account, quota is not exceeded, I checked that about 100 times...:)
 Aron - 2023-05-13 11:26:38 - In reply to message 2 from JImmy Bo
Jimmy,
problem solved, it was my mistake.
COde works just perfectly, thanks for this great code! :)
 JImmy Bo - 2023-05-14 01:38:21 - In reply to message 5 from Aron
Glad to hear it works. I hope it helps you to make bigger and better things.
|