Files
octopus/myproject/test_glm_models.py

42 lines
1.4 KiB
Python

"""
Скрипт для тестирования доступных моделей GLM
"""
from zai import ZaiClient
# Список моделей для тестирования
models_to_test = [
"glm-4.7",
"glm-4-flash",
"glm-4",
"glm-3",
"glm-4-air",
"glm-4-flashx",
]
# Ваш API ключ (замените на свой)
api_key = "YOUR_API_KEY_HERE"
client = ZaiClient(api_key=api_key)
for model in models_to_test:
try:
print(f"Тестирование модели: {model}")
response = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": "ping"}],
temperature=0.7,
max_tokens=10
)
print(f"✅ Модель {model} работает!")
print(f" Ответ: {response.choices[0].message.content if response.choices else 'Нет ответа'}")
break # Если модель работает, останавливаем тест
except Exception as e:
error_msg = str(e)
if "Unknown Model" in error_msg or "1211" in error_msg:
print(f"❌ Модель {model} не существует")
elif "429" in error_msg or "1113" in error_msg:
print(f"✅ Модель {model} существует, но нет баланса")
break
else:
print(f"❌ Модель {model} вызвала ошибку: {error_msg}")