model catalog

This commit is contained in:
2026-02-14 21:00:30 -08:00
parent 9bfd0ec1e7
commit cd449a30fa
5 changed files with 327 additions and 13 deletions

View File

@@ -83,6 +83,18 @@ export type CompletionRequestMessage = {
name?: string;
};
export type Provider = "openai" | "anthropic" | "xai";
export type ProviderModelInfo = {
models: string[];
loadedAt: string | null;
error: string | null;
};
export type ModelCatalogResponse = {
providers: Record<Provider, ProviderModelInfo>;
};
type CompletionResponse = {
chatId: string | null;
message: {
@@ -142,6 +154,10 @@ export async function verifySession() {
return api<{ authenticated: true; mode: "open" | "token" }>("/v1/auth/session");
}
export async function listModels() {
return api<ModelCatalogResponse>("/v1/models");
}
export async function createChat(title?: string) {
const data = await api<{ chat: ChatSummary }>("/v1/chats", {
method: "POST",
@@ -296,7 +312,7 @@ export async function runSearchStream(
export async function runCompletion(body: {
chatId: string;
provider: "openai" | "anthropic" | "xai";
provider: Provider;
model: string;
messages: CompletionRequestMessage[];
}) {