diff --git a/src/models.ts b/src/models.ts index d929edaf..68d85208 100644 --- a/src/models.ts +++ b/src/models.ts @@ -325,6 +325,10 @@ const BUILTIN_ALIASES: Record = { // ZCode runs GLM-5.2 through z.ai's start-plan subscription; it isn't in // LiteLLM yet. Price as the nearest released sibling (GLM-5.1) until it is. 'GLM-5.2': 'glm-5p1', + // Hermes Agent stores the same model id lowercased (`glm-5.2`) in its + // sessions table, so it misses the capitalized alias above and goes + // unpriced. Map the lowercase spelling to the same sibling. + 'glm-5.2': 'glm-5p1', } let userAliases: Record = {} diff --git a/tests/models.test.ts b/tests/models.test.ts index 2943f2e3..452adc17 100644 --- a/tests/models.test.ts +++ b/tests/models.test.ts @@ -32,6 +32,15 @@ describe('getModelCosts', () => { expect(costs).not.toBeNull() expect(costs!.inputCostPerToken).toBe(5e-6) }) + + it('prices lowercase glm-5.2 (Hermes spelling) the same as capitalized GLM-5.2', () => { + const lower = getModelCosts('glm-5.2') + const upper = getModelCosts('GLM-5.2') + expect(lower).not.toBeNull() + expect(upper).not.toBeNull() + expect(lower!.inputCostPerToken).toBe(upper!.inputCostPerToken) + expect(lower!.outputCostPerToken).toBe(upper!.outputCostPerToken) + }) }) describe('getShortModelName', () => {