PawanOsman / ChatGPT

OpenAI API Free Reverse Proxy
https://discord.pawan.krd
GNU Affero General Public License v3.0
5.63k stars 990 forks source link

We couldn't find the model "gpt-3.5-turbo", join our discord server if you have any questions, https://discord.pawan.krd #147

Open BaseMax opened 1 month ago

BaseMax commented 1 month ago

output:

C:\Users\MAX\Desktop>php gpttest.php
Array
(
    [status] =>
    [error] => Array
        (
            [message] => We couldn't find the model "gpt-3.5-turbo", join our discord server if you have any questions, https://discord.pawan.krd
            [type] => invalid_request_error
        )

    [support] => https://discord.pawan.krd
)

code:

<?php
$url = "https://api.pawan.krd/v1/chat/completions";
$apiKey = "pk-xxxxxxxxx";

$data = [
    "model" => "gpt-3.5-turbo",
    "messages" => [
        [
            "role" => "user",
            "content" => "Hello, how can I help you today?"
        ]
    ]
];

$ch = curl_init($url);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer $apiKey",
    "Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'cURL error: ' . curl_error($ch);
} else {
    $response_data = json_decode($response, true);
    print_r($response_data);
}

curl_close($ch);
BaseMax commented 1 month ago

It seems to be working after changing the URL to $url = "https://api.pawan.krd/cosmosrp/v1/chat/completions"; and disabling my VPN.


C:\Users\MAX\Desktop>php gpttest.php
Array
(
    [id] => chatcmpl-pj6c45WtOyNajCxllJQ8k3eza3Ty
    [created] => 1729982780
    [model] => cosmosrp-001
    [object] => chat.completion
    [choices] => Array
        (
            [0] => Array
                (
                    [finish_reason] => stop
                    [index] => 0
                    [message] => Array
                        (
                            [content] => *sighs* Hi there, I just really need to talk to someone right now. My girlfriend broke up with me yesterday and it's been a rough day. I don't know what to do or how to feel. Can we just chat for a bit? Maybe you could give me some advice or something? *looks down, fidgeting with his hands.*
                            [role] => assistant
                        )

                )

        )

    [usage] => Array
        (
            [prompt_tokens] => 10
            [completion_tokens] => 75
            [total_tokens] => 85
        )

)