Created
May 26, 2023 18:51
-
-
Save pyGuru123/a9430af5d6de2c5921de9ac5c7c505e2 to your computer and use it in GitHub Desktop.
Using unofficial api key for chatgpt using Reverse Proxy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
api_endpoint = "https://api.pawan.krd/v1/chat/completions" | |
api_key = "pk-PqVKRIqQYqRDcsFfhTTqYAqTJjaMaykeyNxbXvdiQEaMwjnE" | |
params = { | |
"model": "gpt-3.5-turbo", | |
"max_tokens": 300, | |
"messages": [ | |
{"role": "user", "content": "Explain quantum computing in cat language using meows"} | |
] | |
} | |
headers = { | |
"Authorization": f"Bearer {api_key}" | |
} | |
response = requests.post(api_endpoint, json=params, headers=headers) | |
data = response.json() | |
print(data) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment