Skip to content

Commit f7335de

Browse files
committed
feat: add GLM-4.5 model support with pricing
1 parent 1ab431e commit f7335de

File tree

13 files changed

+26
-13
lines changed

13 files changed

+26
-13
lines changed

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CLAUDE.md
1+
CLAUDE.md

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
./apps/ccusage/README.md
1+
./apps/ccusage/README.md

apps/ccusage/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CLAUDE.md
1+
CLAUDE.md

apps/ccusage/eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { ryoppippi } from '@ryoppippi/eslint-config';
33
/** @type {import('eslint').Linter.FlatConfig[]} */
44
const config = ryoppippi({
55
type: 'lib',
6+
ignores: [
7+
'packages',
8+
],
69
}, {
710
rules: {
811
'test/no-importing-vitest-globals': 'error',

apps/ccusage/src/_pricing-fetcher.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,47 +51,51 @@ if (import.meta.vitest != null) {
5151
it('calculates cost for Claude model tokens', async () => {
5252
using fetcher = new PricingFetcher(true);
5353
const pricing = await Result.unwrap(fetcher.getModelPricing('claude-sonnet-4-20250514'));
54+
expect(pricing).not.toBeNull();
5455
const cost = fetcher.calculateCostFromPricing({
5556
input_tokens: 1000,
5657
output_tokens: 500,
5758
cache_read_input_tokens: 300,
58-
}, pricing);
59+
}, pricing!);
5960

6061
expect(cost).toBeGreaterThan(0);
6162
});
6263

6364
it('calculates cost for GLM-4.5 model tokens', async () => {
6465
using fetcher = new PricingFetcher(true);
6566
const pricing = await Result.unwrap(fetcher.getModelPricing('glm-4.5'));
67+
expect(pricing).not.toBeNull();
6668
const cost = fetcher.calculateCostFromPricing({
6769
input_tokens: 1000,
6870
output_tokens: 500,
6971
cache_read_input_tokens: 300,
70-
}, pricing);
72+
}, pricing!);
7173

7274
expect(cost).toBeGreaterThan(0);
7375
});
7476

7577
it('calculates cost for GLM-4.5 model with provider prefix', async () => {
7678
using fetcher = new PricingFetcher(true);
7779
const pricing = await Result.unwrap(fetcher.getModelPricing('deepinfra/zai-org/GLM-4.5'));
80+
expect(pricing).not.toBeNull();
7881
const cost = fetcher.calculateCostFromPricing({
7982
input_tokens: 1000,
8083
output_tokens: 500,
8184
cache_read_input_tokens: 300,
82-
}, pricing);
85+
}, pricing!);
8386

8487
expect(cost).toBeGreaterThan(0);
8588
});
8689

8790
it('calculates cost for GLM-4.5-Air model', async () => {
8891
using fetcher = new PricingFetcher(true);
8992
const pricing = await Result.unwrap(fetcher.getModelPricing('glm-4.5-air'));
93+
expect(pricing).not.toBeNull();
9094
const cost = fetcher.calculateCostFromPricing({
9195
input_tokens: 1000,
9296
output_tokens: 500,
9397
cache_read_input_tokens: 300,
94-
}, pricing);
98+
}, pricing!);
9599

96100
expect(cost).toBeGreaterThan(0);
97101
});

apps/codex/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CLAUDE.md
1+
CLAUDE.md

apps/codex/eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { ryoppippi } from '@ryoppippi/eslint-config';
33
/** @type {import('eslint').Linter.FlatConfig[]} */
44
const config = ryoppippi({
55
type: 'app',
6+
ignores: [
7+
'packages',
8+
],
69
}, {
710
rules: {
811
'test/no-importing-vitest-globals': 'error',

apps/codex/src/commands/daily.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const dailyCommand = define({
3737
until = normalizeFilterDate(ctx.values.until);
3838
}
3939
catch (error) {
40-
logger.error(String(error));
40+
logger.error(error instanceof Error ? error.message : String(error));
4141
process.exit(1);
4242
}
4343

apps/mcp/AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
CLAUDE.md
1+
CLAUDE.md

apps/mcp/eslint.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import { ryoppippi } from '@ryoppippi/eslint-config';
33
/** @type {import('eslint').Linter.FlatConfig[]} */
44
const config = ryoppippi({
55
type: 'app',
6+
ignores: [
7+
'packages',
8+
],
69
}, {
710
rules: {
811
'test/no-importing-vitest-globals': 'error',

0 commit comments

Comments
 (0)