You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
843 B
37 lines
843 B
# -*- 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() |