mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-18 16:13:35 +00:00
fix(usage): honor provider-aware pricing precedence
This commit is contained in:
1 parent
f736190196
commit
c7141b3d3a
4 files changed
+91
-8
No files matched your search
@@ -327,6 +327,11 @@ describe('model-pricing', () => {
|
||||
name: 'GPT-5.5',
|
||||
cost: { input: 5, output: 30, cache_read: 0.5 },
|
||||
},
|
||||
'gpt-4o': {
|
||||
id: 'gpt-4o',
|
||||
name: 'GPT-4o',
|
||||
cost: { input: 2.5, output: 10, cache_read: 1.25 },
|
||||
},
|
||||
'openai-exclusive-model': {
|
||||
id: 'openai-exclusive-model',
|
||||
name: 'OpenAI Exclusive Model',
|
||||
@@ -343,6 +348,11 @@ describe('model-pricing', () => {
|
||||
name: 'GPT-5.5',
|
||||
cost: { input: 0, output: 0 },
|
||||
},
|
||||
'gpt-4o': {
|
||||
id: 'gpt-4o',
|
||||
name: 'GPT-4o',
|
||||
cost: { input: 0, output: 0 },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -371,6 +381,13 @@ describe('model-pricing', () => {
|
||||
expect(pricing.outputPerMillion).toBe(0);
|
||||
});
|
||||
|
||||
it('prefers provider-aware models.dev pricing over exact static table matches', () => {
|
||||
const pricing = getModelPricing('gpt-4o', { provider: 'github-copilot' });
|
||||
expect(pricing.inputPerMillion).toBe(0);
|
||||
expect(pricing.outputPerMillion).toBe(0);
|
||||
expect(getModelPricing('gpt-4o').inputPerMillion).toBe(2.5);
|
||||
});
|
||||
|
||||
it('does not use ambiguous model-only models.dev matches', () => {
|
||||
const pricing = getModelPricing('gpt-5.5');
|
||||
expect(pricing).toEqual(getModelPricing('unknown-model-xyz'));
|
||||
|
||||
Reference in new issue
Block a user