mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-08-21 14:34:32 +00:00
fix(models): price gateway-prefixed glm-5.3 ids
Hermes stores Cline Pass as cp/cline-pass/glm-5.3. One prefix strip leaves cline-pass/glm-5.3, which missed the bare glm-5.3 alias and stayed $0. Price the last path segment through the same aliases.
This commit is contained in:
parent
0658308448
commit
f97d084109
2 changed files with 12 additions and 0 deletions
|
|
@ -641,6 +641,16 @@ export function getModelCosts(model: string): ModelCosts | null {
|
|||
|
||||
if (pricingCache.has(canonical)) return pricingCache.get(canonical)!
|
||||
|
||||
// Gateway ids such as cp/cline-pass/glm-5.3 survive one prefix strip as
|
||||
// cline-pass/glm-5.3. Price the last path segment through the same aliases
|
||||
// getShortModelName already uses for the label.
|
||||
if (canonical.includes('/')) {
|
||||
const segment = canonical.slice(canonical.lastIndexOf('/') + 1)
|
||||
const aliasedSegment = resolveAlias(segment)
|
||||
if (pricingCache.has(aliasedSegment)) return pricingCache.get(aliasedSegment)!
|
||||
if (pricingCache.has(segment)) return pricingCache.get(segment)!
|
||||
}
|
||||
|
||||
const prefixOverride = getPriceOverridePrefix(canonical)
|
||||
if (prefixOverride) return prefixOverride
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ describe('getModelCosts', () => {
|
|||
expect(sibling).not.toBeNull()
|
||||
expect(lower!.inputCostPerToken).toBe(sibling!.inputCostPerToken)
|
||||
expect(upper!.outputCostPerToken).toBe(sibling!.outputCostPerToken)
|
||||
expect(getModelCosts('cp/cline-pass/glm-5.3')!.inputCostPerToken).toBe(sibling!.inputCostPerToken)
|
||||
expect(getModelCosts('omniroute:cp/cline-pass/glm-5.3')!.inputCostPerToken).toBe(sibling!.inputCostPerToken)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue