I'm new to using APIs. I found myself interested inn the new OpenAI product, GPT-3 (I know, it's not that new. But I just found out about it). I'm trying to use the API key in Python, but it seems the key is invalid.
This is my code (I can't put my API key here for obvious reasons):
import requests
prompt = 'Tell me the history of Europe in summary'
model = 'davinci'
url = 'https://api.openai.com/v1/engines/davinci/jobs'
headers = {
'content-type': 'application/json',
'Authorization': 'Bearer MY_API_KEY',
}
data = {
'prompt': prompt,
'max-tokens': 100,
'temperature': 0.5,
}
response = requests.post(url,headers=headers, json=data)
response_json = response.json()
print(response_json)
I keep receiving this error: {'error': {'message': 'Unknown endpoint for this model.', 'type': 'invalid_request_error', 'param': None, 'code': None}}
I have tried using a new API key several times but it doesn't work. How can I find out why my key is invalid?