import http.client
import json
conn = http.client.HTTPSConnection("4.0.wokaai.com")
payload = json.dumps({
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Hello!"
}
],
"stream": True
})
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer {{YOUR_API_KEY}}',
'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
'Content-Type': 'application/json'
}
conn.request("POST", "/v1/chat/completions", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))