From e63299802676982023134df7d0e47c2385838528 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 5 Jan 2025 16:28:12 -0600 Subject: [PATCH 1/4] feat: add cache information --- src/api/providers/glama.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/providers/glama.ts b/src/api/providers/glama.ts index 4805219..8b58b15 100644 --- a/src/api/providers/glama.ts +++ b/src/api/providers/glama.ts @@ -107,6 +107,8 @@ export class GlamaHandler implements ApiHandler { if (completionRequest.tokenUsage) { yield { type: "usage", + cacheWriteTokens: completionRequest.tokenUsage.cacheCreationInputTokens, + cacheReadTokens: completionRequest.tokenUsage.cacheReadInputTokens, inputTokens: completionRequest.tokenUsage.promptTokens, outputTokens: completionRequest.tokenUsage.completionTokens, totalCost: completionRequest.totalCostUsd, From 8b0e9bbf32f9196377b9438532c8b19c01712759 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 5 Jan 2025 16:34:44 -0600 Subject: [PATCH 2/4] fix: remove unnecessary comment --- src/shared/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/api.ts b/src/shared/api.ts index 7675237..2863893 100644 --- a/src/shared/api.ts +++ b/src/shared/api.ts @@ -315,7 +315,7 @@ export const bedrockModels = { // Glama // https://glama.ai/models -export const glamaDefaultModelId = "anthropic/claude-3-5-sonnet" // will always exist in openRouterModels +export const glamaDefaultModelId = "anthropic/claude-3-5-sonnet" export const glamaDefaultModelInfo: ModelInfo = { maxTokens: 8192, contextWindow: 200_000, From f813d65b5a5d01b20c1bea25a1577ee5079d587a Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 5 Jan 2025 16:47:49 -0600 Subject: [PATCH 3/4] fix: parse text to float --- src/api/providers/glama.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/providers/glama.ts b/src/api/providers/glama.ts index 8b58b15..2ded280 100644 --- a/src/api/providers/glama.ts +++ b/src/api/providers/glama.ts @@ -111,7 +111,7 @@ export class GlamaHandler implements ApiHandler { cacheReadTokens: completionRequest.tokenUsage.cacheReadInputTokens, inputTokens: completionRequest.tokenUsage.promptTokens, outputTokens: completionRequest.tokenUsage.completionTokens, - totalCost: completionRequest.totalCostUsd, + totalCost: parseFloat(completionRequest.totalCostUsd), } } } catch (error) { From ac776cc8bf8781f536749a1b5191643559c80e02 Mon Sep 17 00:00:00 2001 From: Frank Date: Sun, 5 Jan 2025 17:52:44 -0600 Subject: [PATCH 4/4] fix: adjust log wording --- src/api/providers/glama.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/api/providers/glama.ts b/src/api/providers/glama.ts index 2ded280..c17db05 100644 --- a/src/api/providers/glama.ts +++ b/src/api/providers/glama.ts @@ -115,8 +115,7 @@ export class GlamaHandler implements ApiHandler { } } } catch (error) { - // ignore if fails - console.error("Error fetching Glama generation details:", error) + console.error("Error fetching Glama completion details", error) } }