<?php
namespace boru\boruai\Api\Model;

use boru\boruai\Api\BaseAPI;
use boru\boruai\Models\ChatSession;
use boru\boruai\Openai\Api\Endpoints\ModelsAPI;
use boru\dhapi\core\Dispatcher;

class ModelListAPI extends BaseAPI {

    public function execute() {
        try {
            $models = ModelsAPI::listModels();
            $output = [];
            foreach($models as $model) {
                $output[] = $model->id();
            }
            return $this->success($output);
        } catch (\Exception $e) {
            return $this->error($e->getMessage());
        }
    }
}
