openai-cpp icon indicating copy to clipboard operation
openai-cpp copied to clipboard

Getting:OpenAI curl_easy_perform() failed: SSL peer certificate or SSH remote key was not OK

Open sasmaster opened this issue 1 year ago • 4 comments

I am testing this:

openai::start("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"); // Or you can handle it yourself

    auto completion = openai::completion().create(R"(
    {
        "model": "text-davinci-003",
        "prompt": "Say this is a test",
        "max_tokens": 7,
        "temperature": 0
    }
    )"_json); // Using user-defined (raw) string literals
    std::cout << "Response is:\n" << completion.dump(2) << '\n';

    auto image = openai::image().create({
        { "prompt", "A logo with a cello in a heart"},
        { "n", 1 },
        { "size", "512x512" }
        }); // Using initializer lists
    std::cout << "Image URL is: " << image["data"][0]["url"] << '\n';
    std::cout << "Hello World!\n";

Getting this error from CURL: Type: CURLE_PEER_FAILED_VERIFICATION

OpenAI curl_easy_perform() failed: SSL peer certificate or SSH remote key was not OK

Any idea why it happens?

sasmaster avatar Apr 05 '23 12:04 sasmaster

Hello, thank you for reporting this, unfortunately it is hard for me to reproduce this. Searching your problem maybe take a look at this: https://community.openai.com/t/ssl-certificate-verify-failed/32442/39 Do you happen to use a VPN ? If yes can you deactivate it ?

coin-au-carre avatar Apr 08 '23 15:04 coin-au-carre

Well. that's weird... I have tried also liboai and the connection went okay. Same key, same stuff. My VPN is not running.

sasmaster avatar Apr 08 '23 18:04 sasmaster

I will definitely check this sorry for the inconveniency

coin-au-carre avatar Apr 12 '23 16:04 coin-au-carre

@sasmaster I have made a modification which is available on master branch which should solve your issue. Is it possible to test this on your side :) ? Thank you !

coin-au-carre avatar Apr 13 '23 12:04 coin-au-carre