[Edit: This seems fixed now.]
The following breaks with an absolutely unfathomable error message when the model is chatgpt-4o-latest
, but works with other models e.g. gpt-4o
import json
import requests
api_key = "REDACTED"
url = "https://api.openai.com/v1/responses"
headers = {
"Content-Type": "application/json",
"Authorization": f"Bearer {api_key}"
}
data = {
"model": "chatgpt-4o-latest",
"input": "Hello! This is just a test of the new API."
}
response = requests.post(url, headers = headers, json = data)
print(json.dumps(response.json(), indent = 4))