Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

1.0 KB
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-only
// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0

import { authFetch } from "@/features/auth";

import {
  type AudioApiModel,
  type OpenAIModel,
  audioModelsFromCatalog,
  chatModelsFromCatalog,
} from "./openai-model-catalog";

export type { AudioApiModel, OpenAIModel };

/** Chat-capable only: /v1/models also lists image, video and STT models. */
export async function listOpenAIModels(): Promise<OpenAIModel[]> {
  const res = await authFetch("/v1/models");
  if (!res.ok) {
    throw new Error(`Failed to list models (${res.status})`);
  }
  return chatModelsFromCatalog(await res.json());
}

/** The downloaded speech and transcription models, for the Audio API examples. */
export async function listOpenAIAudioModels(): Promise<AudioApiModel[]> {
  const res = await authFetch("/v1/models");
  if (!res.ok) {
    throw new Error(`Failed to list models (${res.status})`);
  }
  return audioModelsFromCatalog(await res.json());
}