mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-16 04:18:05 +00:00
fix(analytics): price Claude Opus 4.7 thinking
This commit is contained in:
committed by
Tam Nhu Tran
parent
62a4d44b58
commit
062e77e55f
@@ -243,6 +243,12 @@ const PRICING_REGISTRY: Record<string, ModelPricing> = {
|
||||
cacheCreationPerMillion: 6.25,
|
||||
cacheReadPerMillion: 0.5,
|
||||
},
|
||||
'claude-opus-4-7-thinking': {
|
||||
inputPerMillion: 5.0,
|
||||
outputPerMillion: 25.0,
|
||||
cacheCreationPerMillion: 6.25,
|
||||
cacheReadPerMillion: 0.5,
|
||||
},
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// OpenAI Models - Source: better-ccusage
|
||||
|
||||
@@ -256,14 +256,14 @@ describe('model-pricing', () => {
|
||||
expect(cost).toBe(36.75); // 5 + 25 + 6.25 + 0.5
|
||||
});
|
||||
|
||||
it('should calculate Claude Opus 4.7 cache cost consistently across repeat lookups', () => {
|
||||
it('should calculate Claude Opus 4.7 thinking cost including cache token rates', () => {
|
||||
const usage: TokenUsage = {
|
||||
inputTokens: 1_000_000,
|
||||
outputTokens: 1_000_000,
|
||||
cacheCreationTokens: 1_000_000,
|
||||
cacheReadTokens: 1_000_000,
|
||||
};
|
||||
const cost = calculateCost(usage, 'claude-opus-4-7');
|
||||
const cost = calculateCost(usage, 'claude-opus-4-7-thinking');
|
||||
expect(cost).toBe(36.75); // 5 + 25 + 6.25 + 0.5
|
||||
});
|
||||
});
|
||||
@@ -469,17 +469,15 @@ describe('model-pricing', () => {
|
||||
});
|
||||
|
||||
it('gracefully ignores malformed cached model entries', () => {
|
||||
setCachedModelsDevRegistry(
|
||||
{
|
||||
openai: {
|
||||
id: 'openai',
|
||||
models: {
|
||||
'null-entry': null,
|
||||
'gpt-5.5': { id: 'gpt-5.5', cost: { input: 5, output: 30 } },
|
||||
},
|
||||
setCachedModelsDevRegistry({
|
||||
openai: {
|
||||
id: 'openai',
|
||||
models: {
|
||||
'null-entry': null,
|
||||
'gpt-5.5': { id: 'gpt-5.5', cost: { input: 5, output: 30 } },
|
||||
},
|
||||
} as unknown as Parameters<typeof setCachedModelsDevRegistry>[0]
|
||||
);
|
||||
},
|
||||
} as unknown as Parameters<typeof setCachedModelsDevRegistry>[0]);
|
||||
|
||||
expect(() => getModelPricing('openai/gpt-5.5')).not.toThrow();
|
||||
expect(getModelPricing('openai/gpt-5.5').inputPerMillion).toBe(5);
|
||||
|
||||
Reference in New Issue
Block a user