Skip to content

Commit 4dcb7e6

Browse files
authored
fix(models): price Hermes lowercase glm-5.2 the same as GLM-5.2 (#545)
1 parent 10d911d commit 4dcb7e6

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

src/models.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,10 @@ const BUILTIN_ALIASES: Record<string, string> = {
325325
// ZCode runs GLM-5.2 through z.ai's start-plan subscription; it isn't in
326326
// LiteLLM yet. Price as the nearest released sibling (GLM-5.1) until it is.
327327
'GLM-5.2': 'glm-5p1',
328+
// Hermes Agent stores the same model id lowercased (`glm-5.2`) in its
329+
// sessions table, so it misses the capitalized alias above and goes
330+
// unpriced. Map the lowercase spelling to the same sibling.
331+
'glm-5.2': 'glm-5p1',
328332
}
329333

330334
let userAliases: Record<string, string> = {}

tests/models.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@ describe('getModelCosts', () => {
3232
expect(costs).not.toBeNull()
3333
expect(costs!.inputCostPerToken).toBe(5e-6)
3434
})
35+
36+
it('prices lowercase glm-5.2 (Hermes spelling) the same as capitalized GLM-5.2', () => {
37+
const lower = getModelCosts('glm-5.2')
38+
const upper = getModelCosts('GLM-5.2')
39+
expect(lower).not.toBeNull()
40+
expect(upper).not.toBeNull()
41+
expect(lower!.inputCostPerToken).toBe(upper!.inputCostPerToken)
42+
expect(lower!.outputCostPerToken).toBe(upper!.outputCostPerToken)
43+
})
3544
})
3645

3746
describe('getShortModelName', () => {

0 commit comments

Comments
 (0)