ege-skill/models_list.py
2026-03-26 23:12:59 +03:00

23 lines
632 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import os
from dotenv import load_dotenv
from openai import OpenAI
# Загружаем настройки из .env
load_dotenv()
client = OpenAI(
api_key=os.getenv("LAOZHANG_API_KEY"),
base_url=os.getenv("LAOZHANG_BASE_URL")
)
try:
print("--- Список доступных моделей ---")
# Запрашиваем список у сервера
models = client.models.list()
# Выводим только ID моделей (названия)
for model in models:
print(f"ID: {model.id}")
except Exception as e:
print(f"Ошибка при получении списка: {e}")