This commit is contained in:
2025-11-24 22:35:47 +08:00
parent 3508a1b496
commit f2a149d2cf
10 changed files with 269 additions and 217 deletions
+37
View File
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
import json
import httpx
with open('config.json', 'r') as f:
config = json.load(f)
siliconflow = config['siliconflow']
token = siliconflow['api_keys']
headers = {"Authorization": f"Bearer {token}"}
def get_user_info():
# 获取用户信息
url = "https://api.siliconflow.cn/v1/user/info"
response = httpx.get(url, headers=headers)
for key, value in response.json().items():
if key != "data":
print(f"{key}: {value}")
else:
for sub_key, sub_value in value.items():
print(f"{sub_key}: {sub_value}")
def get_models_info():
url = "https://api.siliconflow.cn/v1/models"
response = httpx.get(url, headers=headers)
data = response.json()['data']
for d in data:
print(d)
# get_models_info()
# get_user_info()