# -*- coding: utf-8 -*- import json import httpx headers = {"Authorization": f"Bearer sk-pvdiisdowmuwkrpnxsrlhxaovicqibmlljwrwwvbbdjaitdl"} 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'] model_list = [] for d in data: if d.get('object') and d.get('object') == 'model': model_name = d.get('id') # print(model_name) model_list.append(model_name) print(model_list) # get_models_info() get_user_info()