Список моделей
GET /api/v1/models возвращает активные модели, доступные в API. В SDK OpenAI это client.models.list(). id — имя модели для запросов, owned_by — провайдер в нижнем регистре, created — дата релиза модели.
Одну модель можно получить по имени: GET /api/v1/models/<id>, в SDK OpenAI — client.models.retrieve().
Список моделей
SDK OpenAI
Python
cURL
PHP
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://ai.mitup.ru/api/v1",
)
models = client.models.list()
for model in models:
print(model.id)import requests
url = "https://ai.mitup.ru/api/v1/models"
api_key = "YOUR_API_KEY"
headers = {
"Authorization": f"Bearer {api_key}"
}
response = requests.get(url, headers=headers)
print(response.json())curl -X GET "https://ai.mitup.ru/api/v1/models" \
-H "Authorization: Bearer YOUR_API_KEY"<?php
$url = "https://ai.mitup.ru/api/v1/models";
$api_key = "YOUR_API_KEY";
$headers = [
"Authorization: Bearer " . $api_key,
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "mitupai-API-client");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response, true);
print_r($response);
?>Пример возвращаемого результата:
JSON 200
{
"object": "list",
"data": [
{
"id": "alice-ai",
"object": "model",
"created": 1761609600,
"owned_by": "yandexgpt"
},
{
"id": "gemini-3.5-flash",
"object": "model",
"created": 1761609600,
"owned_by": "gemini"
}
]
}Получение модели
GET /api/v1/models/<id> возвращает одну модель по имени. Если модели нет или она недоступна в API — HTTP 404.
SDK OpenAI
Python
cURL
PHP
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://ai.mitup.ru/api/v1",
)
model = client.models.retrieve("alice-ai")
print(model)import requests
url = "https://ai.mitup.ru/api/v1/models/alice-ai"
api_key = "YOUR_API_KEY"
headers = {
"Authorization": f"Bearer {api_key}"
}
response = requests.get(url, headers=headers)
print(response.json())curl -X GET "https://ai.mitup.ru/api/v1/models/alice-ai" \
-H "Authorization: Bearer YOUR_API_KEY"<?php
$url = "https://ai.mitup.ru/api/v1/models/alice-ai";
$api_key = "YOUR_API_KEY";
$headers = [
"Authorization: Bearer " . $api_key,
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "mitupai-API-client");
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
$response = json_decode($response, true);
print_r($response);
?>Пример возвращаемого результата:
Успех (200)
Ошибка (4хх)
{
"id": "alice-ai",
"object": "model",
"created": 1761609600,
"owned_by": "yandexgpt"
}{
"error": {
"message": "The model `unknown-model` does not exist or is not available.",
"type": "invalid_request_error",
"param": "model",
"code": "model_not_found"
}
}