This API allows you to interact with the XTHK system. Below is the information you need to get started:
https://api.xthk.aischat.xyz/v1/chat/completions
You need a valid API key to access the API. Example keys include:
sk-freekeysk-vf5QEDldURsk-vf5QEDldURrNOO2DB831B17262B647B7B13aF9Ae2386E0C8xthk-1 (corresponds to glm-4)xthk-1q (corresponds to qwen)
import requests
url = "https://api.xthk.aischat.xyz/v1/chat/completions"
api_key = "sk-freekey"
headers = {
"Authorization": "Bearer {}".format(api_key),
}
data = {
"messages": [
{"role": "user", "content": "默写出并翻译《活版》全文"}
],
"stream": False, # 启用流式改为 True
"model": "xthk-1",
}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200:
print("Request successful")
print(response.json())
else:
print(f"Request failed with status code {response.status_code}")
print(response.text)