Skip to content

Instantly share code, notes, and snippets.

@pyGuru123
Created May 26, 2023 18:51
Show Gist options
  • Save pyGuru123/a9430af5d6de2c5921de9ac5c7c505e2 to your computer and use it in GitHub Desktop.
Save pyGuru123/a9430af5d6de2c5921de9ac5c7c505e2 to your computer and use it in GitHub Desktop.
Using unofficial api key for chatgpt using Reverse Proxy
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