题意:
从OpenAI的API服务中获取数据时,由于你所在的国家、地区或领土不被支持,因此请求被拒绝了
问题背景:
I have tried to run openai API in python with this code:
尝试在Python中使用OpenAI的API
client = OpenAI(api_key='sk-...')
def response(question):
response = client.chat.completions.create(
model="gpt-4-turbo-preview",
messages=[
{
"role": "user",
"content": question
}
]
)
if __name__ == '__main__':
response(question)
But I get this error: 但是我得到下面的错误
openai.PermissionDeniedError: Error code: 403 - {'error&