update
This commit is contained in:
@@ -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()
|
||||
Reference in New Issue
Block a user