Closed littleblack111 closed 3 months ago
the base url is a forwarding server that is a supported country. the code: Country, region, or territory not supported is recived when connecting to api.openai.com in a region that is not allowed(which i am in):
╰─$ curl https://api.openai.com/v1/chat/completions -H "Content-Type: application/json" -H "Authorization: Bearer sk-xx" -d '{ ─╯
"model": "gpt-3.5-turbo",
"messages": [{"role": "user", "content": "hiiiiaaaaaa"}],
"stream":true,
"temperature": 0.7
}'
{"error":{"code":"unsupported_country_region_territory","message":"Country, region, or territory not supported","param":null,"type":"request_forbidden"}}%
OpenAI can determine your location based on your IP address. You can deploy the service in a supported country or region.
Yes. The base url is deployed is as a relay to OpenAI in a supported location. But this doesn't work while curl does
If you are using Cloudflare Workers as a relay, it won't work because the worker will pass the client's information to OpenAI.
but it worked when I tested it via curl. perhaps its caused by /api/v1/currencies? from the log, it seem to be keep returning 401
The /api/v1/currencies API is used for currency conversion. In the latest version of Raycast, I haven't seen any calls to this API. If you have more detailed logs, please provide them to me. I just conducted a test and didn't find any information indicating that geographical location data is being transmitted to the OpenAI server through this project. Therefore, I can't provide more detailed assistance. You might want to add more logging to your relay to test further.
I see. The problem seems to be openai removed support for OPENAI_API_BASE
thus I cannot change the base url of it. hence I cannot point to the relay service(seen in https://github.com/openai/openai-python/issues/745). they changed to OPENAI_BASE_URL
I made a PR to fix the documentation: #44
I tried using the openai base url locally(via curl) and it worked. this is the log: