@CycleBai 在 一键 Api Check 网址生成 中发帖
自己需要 随手写的
import requests
import json
# 定义常量
endpoint = "https://api.chatoai.tech/v1" # 带/v1
apikey = "sk-***************" # 替换为实际的 API Key
def fetchModels(apiEndpoint, apiKey):
"""获取 OpenAI 模型列表"""
url = f"{apiEndpoint}/models"
headers = {
"Authorization": f"Bearer {apiKey}"
}
response = requests.get(url, headers=headers)
response.raise_for_status() # 如果请求失败,...