import requests url = "https://chatgpt-42.p.rapidapi.com/gpt4" ask_content = """ """ payload = { "messages": [ { "role": "user", "content": ask_content } ], "web_access": False } headers = { "x-rapidapi-key": "e16e316d63msh6e35819315c19a5p1af51djsnd681b7296d67", "x-rapidapi-host": "chatgpt-42.p.rapidapi.com", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()['result'])