From 91b8c01a9db59f779096447e1fb3e8768aefae37 Mon Sep 17 00:00:00 2001 From: user Date: Fri, 3 Jan 2025 04:41:29 +0000 Subject: [PATCH] Do the same for the AWS endpoint --- src/proxy/aws.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/proxy/aws.ts b/src/proxy/aws.ts index c64e551..69cc9fb 100644 --- a/src/proxy/aws.ts +++ b/src/proxy/aws.ts @@ -54,11 +54,18 @@ function handleModelsRequest(req: Request, res: Response) { .filter((id) => availableModelIds.has(id)) .map((id) => { const vendor = id.match(/^(.*)\./)?.[1]; + const date = new Date(); return { + // Common id, - object: "model", - created: new Date().getTime(), owned_by: vendor, + // Anthropic + type: "model", + display_name: id.split('.')[1], + created_at: date.toISOString(), + // OpenAI + object: "model", + created: date.getTime(), permission: [], root: vendor, parent: null, @@ -66,8 +73,13 @@ function handleModelsRequest(req: Request, res: Response) { }); modelsCache[vendor] = { + // Common object: "list", data: models.filter((m) => vendor === "all" || m.root === vendor), + // Anthropic + has_more: false, + first_id: models[0]?.id, + last_id: models[models.length - 1]?.id, }; modelsCacheTime[vendor] = new Date().getTime();