olivebot/2598290917api_test.py

25 lines
595 B
Python
Raw Normal View History

2025-08-08 17:17:58 +08:00
import requests
import json
url = "https://chatapi.midjourney-vip.cn/v1/chat/completions"
payload = json.dumps({
"model": "gpt-3.5-turbo",
"messages": [
{
"role": "user",
"content": "Hello!"
}
]
})
headers = {
'Accept': 'application/json',
# 'xxx' is your API key, 换成你的令牌
'Authorization': 'sk-QxlvoGgkYT1idnvP129595EdA4324330A84f441b58A7E478',
'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)